Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Chapter: 17
Q581:
LL(1) parsers are ________ driven and use a parsing table.
A. stack
B. recursion
C. top-down
D. token
Correct Answer: A
Chapter: 17
Q582:
________ sets help determine which production to use for a given input symbol.
A. FOLLOW
B. FIRST
C. LAST
D. NEXT
Correct Answer: B
Chapter: 17
Q583:
________ is included in FIRST(X) if X can derive a string starting with b.
A. b
B. e
C. $
D. A
Correct Answer: A
Chapter: 17
Q584:
Parsing tables in LL(1) grammar have rows for ________ and columns for ________.
A. terminals, non-terminals
B. non-terminals, terminals
C. start symbols, productions
D. productions, rules
Correct Answer: B
Chapter: 18
Q585:
What is the FIRST set of a terminal symbol 'b'?
A. {ε}
B. {b}
C. {b, ε}
D. {}
Correct Answer: B
Chapter: 18
Q586:
Which of the following is true for computing FIRST(X) when X → A1 A2 ... An?
A. Add FIRST(A1) including ε
B. Add only ε from A1
C. Add FIRST(A1) excluding ε and continue if ε ∈ FIRST(A1)
D. Stop if FIRST(A1) is empty
Correct Answer: C
Chapter: 18
Q587:
What is added to FOLLOW(S), where S is the start symbol?
A. +
B. (
C. $
D. *
Correct Answer: C
Chapter: 18
Q588:
In computing FIRST sets, if ε ∈ FIRST(bi), what action is taken?
A. Add {ε} to FIRST(bi)
B. Stop the loop
C. Skip bi
D. Continue to bi+1
Correct Answer: D
Chapter: 18
Q589:
Which symbol is included in FIRST('(')?
A. {)}
B. {ε}
C. {(}
D. {id}
Correct Answer: C
Chapter: 18
Q590:
What does the FOLLOW set of a non-terminal represent?
A. All terminals that can appear before the non-terminal
B. All terminals that can appear after the non-terminal
C. All terminals that derive ε
D. Only terminal id
Correct Answer: B
Chapter: 18
Q591:
FOLLOW(F) in the expression grammar includes which symbols?
A. {+, *, ), $}
B. {(, id}
C. {+}
D. {*}
Correct Answer: A
Chapter: 18
Q592:
The FOLLOW set of T is equal to FOLLOW of which non-terminal?
A. F
B. E'
C. T'
D. S
Correct Answer: C
Chapter: 18
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
Correct Answer: A
Chapter: 18
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
Correct Answer: B
Chapter: 18
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
Correct Answer: A
Chapter: 18
Q596:
When computing FOLLOW(B) for A → aBb and ε ∉ FIRST(b), what is added?
A. Nothing
B. FIRST(b) – {ε}
C. FOLLOW(A)
D. ε
Correct Answer: B
Chapter: 18
Q597:
For E → T E', what is FOLLOW(E') based on FOLLOW(E)?
A. Only $
B. Only )
C. {), $}
D. {(, id}
Correct Answer: C
Chapter: 18
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 ε
Correct Answer: C
Chapter: 18
Q599:
If ε ∈ FIRST(β) in A → aBβ, then what is added to FOLLOW(B)?
A. FOLLOW(A)
B. ε
C. $
D. FIRST(B)
Correct Answer: A
Chapter: 18
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
Correct Answer: D

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now