Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q451: The symbol A' introduced in removing left recursion is a ________.
- A: new non-terminal
- B: terminal
- C: production rule
- D: parser function
View Answer
A
Q452: Predictive parsing avoids backtracking by using ________.
- A: look-ahead
- B: FIRST sets
- C: FOLLOW sets
- D: All of the above
View Answer
D
Q453: The FIRST set of a grammar symbol is the set of tokens that appear as the ________ symbol in some string derived from that symbol.
- A: first
- B: last
- C: middle
- D: optional
View Answer
A
Q454: The root node in a top-down parse tree is labeled with the ________.
- A: start symbol
- B: non-terminal
- C: terminal
- D: production rule
View Answer
A
Q455: If a parser selects a wrong production and fails to match input, it must ________.
- A: backtrack
- B: skip
- C: restart
- D: finish
View Answer
A
Q456: Left recursion in a grammar can cause ________ in a top-down parser.
- A: non-termination
- B: efficiency
- C: ambiguity
- D: optimization
View Answer
A
Q457: Left recursion can be converted to ________ recursion to ensure parser termination.
- A: right
- B: left
- C: indirect
- D: mutual
View Answer
A
Q458: After removing left recursion, the grammar retains the original ________.
- A: left associativity
- B: right associativity
- C: ambiguity
- D: precedence
View Answer
A
Q459: In the expression "x – 2 * y," after matching "x – 2," the parser must expand which symbol next?
- A: term
- B: factor
- C: expr
- D: goal
View Answer
A
Q460: When parsing "x – 2 * y," the operator "*" is handled by expanding ________.
- A: factor
- B: term
- C: expr
- D: goal
View Answer
A