This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Syntax Analyser – 2”.
1. Select a Machine Independent phase of the compiler.
a) Syntax Analysis
b) Intermediate Code generation
c) Lexical Analysis
d) All of the mentioned
View Answer
Explanation: All of them work independent of a machine.
2. A system program that combines the separately compiled modules of a program into a form suitable for execution?
a) Assembler
b) Compiler
c) Linking Loader
d) Interpreter
View Answer
Explanation: A loader which combines the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled.
3. Which of the following system software resides in the main memory?
a) Text Editor
b) Assembler
c) Linker
d) Loader
View Answer
Explanation: Loader is used to loading programs.
4. Output file of Lex is __________ the input file is Myfile.
a) Myfile.e
b) Myfile.yy.c
c) Myfile.lex
d) Myfile.obj
View Answer
Explanation: This Produce the filr “myfile.yy.c” which we can then compile with g++.
5. Type checking is normally done during ____________
a) Lexical Analysis
b) Syntax Analysis
c) Syntax Directed Translation
d) Code generation
View Answer
Explanation: It is the function of Syntax directed translation.
6. Suppose One of the Operand is String and other is Integer then it does not throw error as it only checks whether there are two operands associated with ‘+’ or not.
a) True
b) False
View Answer
Explanation: Syntax analyser does not check the type of the operand.
7. In Short Syntax Analysis Generates Parse Tree.
a) True
b) False
View Answer
Explanation: Short Syntax Analysis generates a parse tree.
8. By whom is the symbol table created?
a) Compiler
b) Interpreter
c) Assembler
d) None of the mentioned
View Answer
Explanation: Symbol table is created by the compiler which contains the list of lexemes or tokens.
9. What does a Syntactic Analyser do?
a) Maintain Symbol Table
b) Collect type of information
c) Create parse tree
d) None of the mentioned
View Answer
Explanation: Syntax analyzer will just create a parse tree. Semantic Analyzer checks the meaning of the string parsed.
10. Semantic Analyser is used for?
a) Generating Object code
b) Maintaining symbol table
c) Generating Object code & Maintaining symbol table
d) None of the mentioned
View Answer
Explanation: Maintaining the Symbol Table for each block.
Source Program for Semantic Errors.
Collects Type Information for Code Generation.
Reporting compile-time errors in the code Generating the object code (e.g., assembler or intermediate code).
Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Compiler Design Books
- Apply for Computer Science Internship
- Practice MCA MCQs
- Check Computer Science Books
- Practice Computer Science MCQs