Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q601: Which of the following is TRUE about FOLLOW sets?
- A: They contain only $
- B: They are empty by default
- C: They contain all terminals that follow the non-terminal in some derivation
- D: They contain only FIRST set of non-terminals
View Answer
C
Q602: If X is a terminal, what is FIRST(X)?
- A: {}
- B: {X}
- C: {ε}
- D: {X, ε}
View Answer
B
Q603: Which of these rules is used for computing FOLLOW when A → aBb?
- A: Add FOLLOW(B)
- B: Add FOLLOW(A) to FOLLOW(B)
- C: Add FIRST(b) – {ε} to FOLLOW(B)
- D: Add ε to FOLLOW(B)
View Answer
C
Q604: In a production A → aB and ε ∈ FIRST(b), which set should be added to FOLLOW(B)?
- A: FIRST(B)
- B: FOLLOW(B)
- C: FOLLOW(A)
- D: FIRST(A)
View Answer
C
Q605: FIRST(E') =
- A: {+}
- B: {+ , ε}
- C: {ε}
- D: {id}
View Answer
B
Q606: The purpose of the FOLLOW set is to help in __________.
- A: top-down parsing
- B: bottom-up parsing
- C: ambiguity detection
- D: error recovery
View Answer
A
Q607: In the expression grammar, which symbol is NOT part of FIRST(E)?
- A: (
- B: +
- C: id
- D: )
View Answer
D
Q608: What does it mean if ε ∈ FIRST(X)?
- A: X can derive a non-empty string
- B: X always produces ε
- C: X can derive ε
- D: X is a terminal
View Answer
C
Q609: In computing FIRST, which condition will stop further additions?
- A: ε ∈ FIRST(Ai)
- B: ε ∉ FIRST(Ai)
- C: Terminal found in FIRST(Ai)
- D: FIRST(Ai) is empty
View Answer
B
Q610: For production F → (E), which symbol is in FOLLOW(E)?
- A: +
- B: $
- C: )
- D: (
View Answer
C