Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q421: Bottom-up parsing begins from:
  • A: Root of parse tree
  • B: Leaves of parse tree
  • C: Middle of parse tree
  • D: Any node in parse tree
View Answer
B

Q422: Top-down parsing may require:
  • A: No backtracking
  • B: Backtracking
  • C: Only leftmost derivations
  • D: Only rightmost derivations
View Answer
B

Q423: In the parse tree for x – (2 * y), what is the order of evaluation?
  • A: Left to right
  • B: Right to left
  • C: Multiplication before subtraction
  • D: Subtraction before multiplication
View Answer
C

Q424: Which sentential form corresponds to the rule "expr → term * factor"?
  • A: expr - term * factor
  • B: expr + term * factor
  • C: expr * term * factor
  • D: expr * factor
View Answer
A

Q425: The term "sentential form" refers to:
  • A: A sequence of terminals and non-terminals
  • B: A complete parse tree
  • C: Only terminals
  • D: Only non-terminals
View Answer
A

Q426: Fill in the blank: The rule b A g → b a g is an example of __________ grammar.
  • A: Context-free
  • B: Context-sensitive
  • C: Regular
  • D: Unambiguous
View Answer
B

Q427: In bottom-up parsing, the parser's internal state encodes:
  • A: Parsing errors
  • B: Legal tokens and states
  • C: Possible parse trees
  • D: Grammar rules
View Answer
B

Q428: What is the goal symbol in the grammar that parses x - 2 * y?
  • A: Expr
  • B: Term
  • C: Factor
  • D: Goal
View Answer
D

Q429: Which parsing technique is generally more powerful and handles more grammar types?
  • A: Top-down
  • B: Bottom-up
  • C: Leftmost
  • D: Rightmost
View Answer
B

Q430: In ambiguous grammars, multiple __________ exist for the same sentential form.
  • A: Leftmost derivations
  • B: Rightmost derivations
  • C: Parse trees
  • D: Operators
View Answer
C

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now