Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Chapter: 18
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
Correct Answer: C
Chapter: 18
Q602:
If X is a terminal, what is FIRST(X)?
A. {}
B. {X}
C. {ε}
D. {X, ε}
Correct Answer: B
Chapter: 18
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)
Correct Answer: C
Chapter: 18
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)
Correct Answer: C
Chapter: 18
Q605:
FIRST(E') =
A. {+}
B. {+ , ε}
C. {ε}
D. {id}
Correct Answer: B
Chapter: 18
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
Correct Answer: A
Chapter: 18
Q607:
In the expression grammar, which symbol is NOT part of FIRST(E)?
A. (
B. +
C. id
D. )
Correct Answer: D
Chapter: 18
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
Correct Answer: C
Chapter: 18
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
Correct Answer: B
Chapter: 18
Q610:
For production F → (E), which symbol is in FOLLOW(E)?
A. +
B. $
C. )
D. (
Correct Answer: C
Chapter: 18
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 ε
Correct Answer: C
Chapter: 18
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 (
Correct Answer: A
Chapter: 19
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
Correct Answer: C
Chapter: 19
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 → α
Correct Answer: C
Chapter: 19
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
Correct Answer: A
Chapter: 19
Q616:
What is inserted in each undefined entry of the LL(1) parsing table?
A. Error
B. Empty string
C. ε
D. $
Correct Answer: A
Chapter: 19
Q617:
Which symbols cause M[E, id] and M[E, (] to get E → TE'?
A. + and *
B. ε and id
C. ( and id
D. ( and $
Correct Answer: C
Chapter: 19
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, +]
Correct Answer: B
Chapter: 19
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', $]
Correct Answer: C
Chapter: 19
Q620:
Which symbol is part of FOLLOW(E') that allows E' → ε to be added in the table?
A. (
B. +
C. )
D. id
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now