Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q611: In FIRST computation, which of the following is the correct behavior for X → A1 A2 A3 where ε ∈ FIRST(A1) and ε ∈ FIRST(A2)?
- A: Stop after A1
- B: Add FIRST(A2) only
- C: Add FIRST(A3) – {ε} to FIRST(X)
- D: Add only ε
View Answer
C
Q612: The set FIRST(E') = {+, ε} implies what?
- A: E' must begin with + or can be empty
- B: E' must be empty
- C: E' begins with id
- D: E' starts with (
View Answer
A
Q613: What does the predictive parsing table M[A, a] store?
- A: Derivations of terminals
- B: Error messages
- C: Productions for parsing
- D: A list of variables
View Answer
C
Q614: If ε is in FIRST(α), and b is in FOLLOW(A), what should be added to M[A, b]?
- A: A → b
- B: A → ε
- C: A → α
- D: B → α
View Answer
C
Q615: What is added to the parsing table M when a production A → α is found and α starts with a terminal?
- A: A → a is added to M[A, a]
- B: A → a is added to M[a, A]
- C: Error is added
- D: Nothing is added
View Answer
A
Q616: What is inserted in each undefined entry of the LL(1) parsing table?
- A: Error
- B: Empty string
- C: ε
- D: $
View Answer
A
Q617: Which symbols cause M[E, id] and M[E, (] to get E → TE'?
- A: + and *
- B: ε and id
- C: ( and id
- D: ( and $
View Answer
C
Q618: In the LL(1) table, production E' → +TE' is placed in which entry?
- A: M[E', id]
- B: M[E', +]
- C: M[E, +]
- D: M[T, +]
View Answer
B
Q619: Production E' → ε is added to which entries in the LL(1) table?
- A: M[E', id] and M[E', $]
- B: M[E', (] and M[E', +]
- C: M[E', )] and M[E', $]
- D: M[E, $] and M[E', $]
View Answer
C
Q620: Which symbol is part of FOLLOW(E') that allows E' → ε to be added in the table?
- A: (
- B: +
- C: )
- D: id
View Answer
C