Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q781: Fill in the blank: If γ begins with X, the transition from A→ α•Xη to A→ αX•η corresponds to recognizing ________.
- A: X symbol
- B: X dot
- C: β production
- D: Closure
View Answer
A
Q782: Fill in the blank: An ε-transition in the NFA corresponds to adding items for productions of ________.
- A: Non-terminals
- B: Terminals
- C: Lookahead symbols
- D: Terminals and non-terminals
View Answer
A
Q783: The initial DFA state I0 is computed as the _______ of the set containing [S → •E].
- A: ε-closure
- B: First set
- C: Follow set
- D: Closure
View Answer
A
Q784: In LR(1) items, the dot '•' indicates the parser's position _______.
- A: before the symbol after it
- B: after the symbol before it
- C: at the end of parsing
- D: start of parsing
View Answer
A
Q785: Closure of LR(1) items adds all productions of the _______ immediately after the dot.
- A: non-terminal
- B: terminal
- C: start symbol
- D: look-ahead symbol
View Answer
A
Q786: Which function computes the new state after recognizing symbol X in state Ij?
- A: goto
- B: closure
- C: reduce
- D: shift
View Answer
A
Q787: The collection of canonical LR(1) item sets is constructed by repeatedly applying _______ and goto operations.
- A: closure
- B: goto
- C: reduce
- D: shift
View Answer
A
Q788: In the item [E → int•, $], the dot at the right end means the parser should _______.
- A: reduce
- B: shift
- C: accept
- D: error
View Answer
A
Q789: State I2 = goto(I0, E) contains which of the following items?
- A: [S → E•, $]
- B: [E → int•, $]
- C: [S → •E, $]
- D: [E → •E+(E), $/+]
View Answer
A
Q790: In state I2, the dot before '+' indicates the next expected symbol is _______.
- A: +
- B: int
- C: (
- D: )$
View Answer
A