Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q461: The symbol ε in grammar rules represents ________.
- A: an empty string
- B: a terminal
- C: a non-terminal
- D: a look-ahead symbol
View Answer
A
Q462: Which is NOT part of the top-down parsing algorithm?
- A: Backtracking on mismatch
- B: Constructing root node
- C: Building children
- D: Evaluating semantic actions
View Answer
D
Q463: When a node labeled A is expanded, the parser selects a production with ________ on its left-hand side.
- A: A
- B: any symbol
- C: terminal
- D: token
View Answer
A
Q464: The example "x – 2 * y" demonstrates issues with ________.
- A: left recursion
- B: right recursion
- C: operator precedence
- D: ambiguity
View Answer
C
Q465: Removing left recursion preserves the original grammar's ________.
- A: left associativity
- B: right associativity
- C: ambiguity
- D: precedence
View Answer
A
Q466: In predictive parsing, the amount of look-ahead needed is generally ________.
- A: unbounded
- B: fixed to one
- C: sometimes zero
- D: none
View Answer
A
Q467: In the grammar A → b A' and A' → a A' | ε, A' is called a ________.
- A: auxiliary non-terminal
- B: terminal
- C: production
- D: rule lexer
View Answer
A
Q468: The FOLLOW set in parsing is the set of terminals that can appear ________ a given non-terminal.
- A: immediately after
- B: before
- C: in the middle
- D: of a string
View Answer
A
Q469: The LL(1) property requires that FIRST(a) ∩ FIRST(b) for productions A → a and A → b must be ________.
- A: non-empty
- B: empty
- C: partially overlapping
- D: undefined
View Answer
B
Q470: In LL(k) parsing, the 'k' stands for the number of ________.
- A: look-ahead tokens
- B: left-most derivations
- C: right-most derivations
- D: grammar rules
View Answer
A