Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q731: Expr → Expr – Term • is an example of ________.
- A: Grammar rule
- B: Reduction step
- C: Completed handle
- D: Parsing error
View Answer
C
Q732: The parser recognizes handles using ________.
- A: Grammar productions
- B: Parsing tables
- C: Stack size
- D: DFA transitions
View Answer
D
Q733: The handle-finding mechanism is crucial for ________.
- A: Top-down parsing
- B: Bottom-up parsing
- C: Recursive descent parsing
- D: LL parsers
View Answer
B
Q734: The LR(1) parser constructs tables using a model of ________.
- A: Grammar tree
- B: Parse forest
- C: Handle-recognizing DFA
- D: Symbol precedence
View Answer
C
Q735: Parsing tables are generated using the ________ of the DFA.
- A: Transitions
- B: Stack
- C: Lookahead symbols
- D: Derivations
View Answer
A
Q736: To remember DFA state transitions, parsers store ______ in the stack.
- A: Only terminals
- B: Non-terminals and terminals
- C: Symbols and state numbers
- D: State machines
View Answer
C
Q737: An LR(1) item is represented as a pair consisting of a production and a ________.
- A: Non-terminal
- B: Lookahead symbol
- C: Grammar rule
- D: Stack symbol
View Answer
B
Q738: The set of LR(1) items representing each parser state is called the ________.
- A: Parsing stack
- B: Canonical Collection
- C: Handle set
- D: Closure set
View Answer
B
Q739: The initial state in the canonical collection is labeled as ________.
- A: I0
- B: I1
- C: S0
- D: S1
View Answer
A
Q740: In the augmented grammar, a new start symbol S is added with the production ________.
- A: S → S
- B: E → E + (E)
- C: S → E
- D: E → int
View Answer
C