Compilers Questions and Answers – Lexical Analysis – 2

This set of Compilers Multiple Choice Questions & Answers (MCQs) focuses on “Lexical Analysis – 2”.

1. What constitutes the stages of the compilation process?
a) Feasibility study, system, design, and testing
b) Implementation and documentation
c) Lexical analysis, syntax, Analysis and code generation
d) None of the mentioned
View Answer

Answer: c
Explanation: As defined in the compilation process.

2. The lexical analyzer takes _________ as input and produces a stream of _______ as output.
a) Source program, tokens
b) Token, source program
c) Either of the two
d) None of the mentioned
View Answer

Answer: a
Explanation: As per the definition of Lexical Analyser which states that lexical analysis is the process of converting a sequence of characters into tokens.

3. Parsing is also known as ________
a) Lexical Analysis
b) Syntax Analysis
c) Semantic Analysis
d) Code Generation
View Answer

Answer: b
Explanation: Parsing or syntactic analysis is the process of analysing a string of symbols and conforming to the rules of grammar.
advertisement
advertisement

4. A compiler program written in a high level language is called ________
a) Source Program
b) Object Program
c) Machine Language Program
d) None of the mentioned
View Answer

Answer: a
Explanation: The input that we give in high level language is also known as the source language.

5. System program such a compiler are designed so that they are ________
a) Re-enterable
b) Non-Usable
c) Serially usable
d) None of the mentioned
View Answer

Answer: a
Explanation: For the convince of the user compilers are made re-enterable.

6. Which of the following is not a feature of compiler?
a) Scan the entire program first and translate into machine code
b) To remove syntax errors
c) Slow for debugging
d) Execution time is more
View Answer

Answer: d
Explanation: The objective of the compiler is clearly not to increase the execution time of the program.

7. A system program that brings together separately compiled modules of a program into a form language that is suitable for execution.
a) Assembler
b) Linking loader
c) Cross compiler
d) None of the mentioned
View Answer

Answer: b
Explanation: A loader which brings together the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled into an executable program.
advertisement

8. A programmer by mistakes writes a program to multiply two numbers instead of dividing them, how can this error be detected?
a) Compiler
b) Interpreter
c) Compiler or interpreter
d) None of the mentioned
View Answer

Answer: d
Explanation: This is a logical error that can’t be detected by any compiler or interpreter.

Sanfoundry Global Education & Learning Series – Compilers.

advertisement

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.