Compilers Questions and Answers – Syntax Analyser – 2

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

Answer: d
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

Answer: c
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

Answer: d
Explanation: Loader is used to loading programs.
advertisement
advertisement

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

Answer: b
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

Answer: c
Explanation: It is the function of Syntax directed translation.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

Answer: a
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

Answer: a
Explanation: Short Syntax Analysis generates a parse tree.
advertisement

8. By whom is the symbol table created?
a) Compiler
b) Interpreter
c) Assembler
d) None of the mentioned
View Answer

Answer: a
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

Answer: c
Explanation: Syntax analyzer will just create a parse tree. Semantic Analyzer checks the meaning of the string parsed.
advertisement

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

Answer: c
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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.