250+ TOP MCQs on Lexical Analysis and Answers

Compilers Multiple Choice Questions & Answers (MCQs) on “Lexical Analysis”.

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

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

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

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

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

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

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

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

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

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *