Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q751: In closure(s), β in [X → α•Yβ, a] represents ________.
- A: The part after Y
- B: The part before α
- C: The lookahead symbol
- D: The entire right-hand side
View Answer
C
Q752: Which of the following is NOT true about LR(1) items?
- A: They include a dot indicating progress
- B: They include a lookahead symbol
- C: They represent entire parse trees
- D: They correspond to parser states
View Answer
C
Q753: The canonical collection is constructed by repeatedly applying ________.
- A: Closure and Goto functions
- B: Shift and Reduce
- C: Parsing and Lexing
- D: Stack operations
View Answer
A
Q754: The lookahead symbol in LR(1) items helps the parser decide whether to ________.
- A: Shift or reduce
- B: Go to next state
- C: Accept input
- D: Restart parse
View Answer
A
Q755: Fill in the blank: The initial core item of the first state I0 is ________.
- A: [S → E•, $]
- B: [S → •E, $]
- C: [S → E, $]
- D: [E → •int, $]
View Answer
B
Q756: Fill in the blank: The procedure closure continues until the set s is ________.
- A: Empty
- B: Unchanged
- C: Full
- D: Reduced
View Answer
B
Q757: Fill in the blank: FIRST(+(E)$) = ________.
- A: +
- B: E
- C: $
- D: (
View Answer
A
Q758: What symbol does the parser use to represent the end of input?
- A: $
- B: #
- C: *
- D: @
View Answer
A
Q759: In the closure procedure, for [E → •E+(E), $], the lookahead for new items is computed from ________.
- A: FIRST(+(E)$)
- B: FIRST(E)$
- C: FIRST($)
- D: FIRST(•E)$
View Answer
A
Q760: Fill in the blank: In the augmented grammar, the start symbol S produces ________.
- A: E
- B: int
- C: int + E
- D: $
View Answer
B