Compilers Multiple Choice Questions & Answers (MCQs) on “LR Parser”.
1. What is terminal table?
a) Contains all constants in the program
b) Is a permanent table of decision rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure
c) Consist of a full or partial list of the token is as they appear in the program created by lexical analysis and used for syntax analysis and interpretation
d) Is a permanent table which lists all keywords and special symbols of the language in symbolic form
Answer: d
Clarification: A permanent database that has entry for each terminal symbols such as arithmetic operators, keywords, punctuation characters such as ‘;’, ‘,’etc Fields: Name of the symbol.
2. Advantage of incorporating the macro-processor into pass 1 is that _________
a) Many functions have to be implemented twice
b) Functions are combined not necessarily creating intermediate files as output from the macro-processor and input to the assembler
c) More flexibility is provided to the programmer in that he may use all the features of the assembler in conjunction with macros
d) All of the mentioned
Answer: d
Clarification: A general-purpose macro processor or general purpose pre-processor is a macro designed primarily for string manipulation, macro definition.
3. Which of the following is a phase of a compilation process?
a) Lexical Analysis
b) Code Generation
c) Lexical Analysis & Code Generation
d) None of the mentioned
Answer: c
Clarification: Lexical analysis and code generation is a phase of compilation process.
4. System program such as compiler are designed so that they are _________
a) Re-enterable
b) Non reusable
c) Serially usable
d) None of the mentioned
Answer: a
Clarification: Re-enterable is the keyword for compiler being designed.
5. A series of statements explaining how the data is to be processed is called _________
a) Assembly
b) Machine
c) COBOL
d) Program
Answer: d
Clarification: A program is a sequence of instructions, written to perform a task by computer. It requires programs to function, typically executing the program’s instructions in a central processor.
6. A loader is a program that _________
a) Program that places functions into memory and prepares them for execution
b) Program that automates the translation of assembly language into machine language
c) Program accepting another program written in a high level language and produces as object program
d) None of the mentioned
Answer: a
Clarification: A loader is the part of an operating system that is responsible for loading programs and libraries. It is important in the process of placing the programs into memory and executing them.
7. A system program that setup an executable program in main memory ready for execution is?
a) Assembler
b) Linker
c) Loader
d) Load and go
Answer: c
Clarification: A loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution.
8. Which of the following system program forgoes the production of object code to generate absolute machine code and load it into the physical main storage location from which it will be executed immediately upon completion of the assembly?
a) Two pass assembler
b) Load and go assembler
c) Macro processor
d) Linker
Answer: b
Clarification: A load and go assembler generates absolute machine code and loads it to physical memory.
9. Uniform symbol table _________
a) Has all constants in the program
b) Permanent table of rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure
c) Consists of full or partial list of the tokens as they appear in the program created by Lexical analysis and used for syntax analysis and interpretation
d) A permanent table which has all key words and special symbols of the language in symbolic form
Answer: c
Clarification: Each pass scans the program, the first pass generates the symbol table and the second pass generates the machine code.
10. Assembler is a program that _________
a) Puts programs into memory and executes them
b) Translates the assembly language into machine language
c) Writes in high level language and produces an object program
d) None of the mentioned
Answer: b
Clarification: An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer’s processor can use to perform its basic operations.