Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q441: Fill in the blank: The parsing method that grows the parse tree from the leaves is called __________ parsing.
  • A: Top-down
  • B: Bottom-up
  • C: Leftmost
  • D: Rightmost
View Answer
B

Q442: What is represented by <id,x> in the parse tree?
  • A: Terminal symbol
  • B: Non-terminal
  • C: Operator
  • D: Keyword
View Answer
A

Q443: Which of the following best describes context-free grammar?
  • A: Non-terminals can be replaced in any context
  • B: Non-terminals replaced depending on neighbors
  • C: Terminals replaced by non-terminals
  • D: Terminals replaced in any context
View Answer
A

Q444: A top-down parser starts parsing from the ________ of the parse tree.
  • A: root
  • B: node
  • C: leaf
  • D: terminal
View Answer
A

Q445: If a terminal symbol added to the fringe does not match the input string, the parser must ________.
  • A: continue
  • B: backtrack
  • C: restart
  • D: skip
View Answer
B

Q446: In a top-down parser, the key to correct parsing is picking the right ________.
  • A: production
  • B: terminal
  • C: lexer
  • D: token
View Answer
A

Q447: During parsing, if the parser makes the wrong choice at a production, it will ________.
  • A: backtrack
  • B: restart
  • C: abort
  • D: fail
View Answer
A

Q448: Top-down parsers cannot handle grammars with ________ recursion.
  • A: left
  • B: right
  • C: indirect
  • D: mutual
View Answer
A

Q449: A grammar is left recursive if a non-terminal A can derive a string starting with ________.
  • A: A itself
  • B: only terminals
  • C: only non-terminals
  • D: ε (empty string)
View Answer
A

Q450: To remove left recursion, the grammar A → A a | b is rewritten as ________.
  • A: A → b A' and A' → a A' | ε
  • B: A → A a B | b
  • C: B → b A | A a
  • D: A → b A | a B
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

šŸš€ Start Quiz Now