Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q61: What is the output of the parser for a legal program?
- A: Tokens only
- B: Error messages only
- C: Intermediate Representation
- D: Compiler report
View Answer
C
Q62: The intermediate representation produced by the compiler front-end is used by the ______.
- A: Hardware
- B: Linker
- C: Back end
- D: Editor
View Answer
C
Q63: The parser assists in ______ analysis.
- A: Lexical
- B: Semantic
- C: Instructional
- D: Code
View Answer
B
Q64: A context-free grammar is defined by the tuple G = (S, N, T, ___)?
- A: R
- B: Rules
- C: Tokens
- D: P
View Answer
D
Q65: The terminal set T includes which of the following?
- A: goal
- B: id
- C: expr
- D: term
View Answer
B
Q66: What will be the first token produced from input “x = x + y”?
- A:
- B:
- C:
- D:
View Answer
A
Q67: Which of the following is NOT part of the compiler front end?
- A: Scanner
- B: Parser
- C: Error handler
- D: Code generator
View Answer
D
Q68: The component that maps IR to machine code is called the ______.
- A: Scanner
- B: Parser
- C: Back end
- D: Semantic module
View Answer
C
Q69: The sentence “x + 2 - y” is built in CFG using repeated ______.
- A: Translation
- B: Backtracking
- C: Substitution
- D: Recursion
View Answer
C
Q70: Which module in the compiler produces error messages for illegal code?
- A: Back end
- B: Scanner
- C: Parser
- D: Assembler
View Answer
C