Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q591: FOLLOW(F) in the expression grammar includes which symbols?
- A: {+, *, ), $}
- B: {(, id}
- C: {+}
- D: {*}
View Answer
A
Q592: The FOLLOW set of T is equal to FOLLOW of which non-terminal?
- A: F
- B: E'
- C: T'
- D: S
View Answer
C
Q593: In which case is ε added to the FIRST set of X?
- A: If all Ai in X → A1 A2 ... An derive ε
- B: If any Ai derives ε
- C: If X is a terminal
- D: If X starts with a terminal
View Answer
A
Q594: What is the purpose of the FIRST set?
- A: To find all terminals that can follow a non-terminal
- B: To find all terminals that can start a string derived from a symbol
- C: To eliminate left recursion
- D: To detect syntax errors
View Answer
B
Q595: What is added to FIRST(X) when X → A1 A2 A3 and ε ∈ FIRST(A1), FIRST(A2)?
- A: FIRST(A3) excluding ε
- B: FIRST(A1) only
- C: Nothing
- D: FIRST(A2) only
View Answer
A
Q596: When computing FOLLOW(B) for A → aBb and ε ∉ FIRST(b), what is added?
- A: Nothing
- B: FIRST(b) – {ε}
- C: FOLLOW(A)
- D: ε
View Answer
B
Q597: For E → T E', what is FOLLOW(E') based on FOLLOW(E)?
- A: Only $
- B: Only )
- C: {), $}
- D: {(, id}
View Answer
C
Q598: The FOLLOW set of a non-terminal is built using the productions in which it appears ________.
- A: as a start symbol
- B: as a terminal
- C: on the right-hand side
- D: as ε
View Answer
C
Q599: If ε ∈ FIRST(β) in A → aBβ, then what is added to FOLLOW(B)?
- A: FOLLOW(A)
- B: ε
- C: $
- D: FIRST(B)
View Answer
A
Q600: What does the notation FIRST(X) = { b | X ⇒* ba } mean?
- A: b appears before X in derivation
- B: b is derived directly from X
- C: b is in the right-hand side
- D: b can be first terminal in any derivation from X
View Answer
D