Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q691: What is the first step in shift-reduce parsing algorithm?
  • A: shift symbol
  • B: lookup production
  • C: pop all elements
  • D: push $ on stack
View Answer
D

Q692: The handle ⟨Expr → Expr – Term •⟩ shows what parsing state?
  • A: Production is incomplete
  • B: Right-hand side is matched
  • C: Goal reached
  • D: Error occurred
View Answer
B

Q693: In step 2 of the example, which production is applied?
  • A: Factor → num
  • B: Term → Factor
  • C: Expr → Term
  • D: Factor → id
View Answer
D

Q694: After reducing ⟨Term → Factor⟩, what is pushed to the stack?
  • A: id
  • B: Term
  • C: Expr
  • D: Goal
View Answer
B

Q695: In the parsing sequence, what comes after reducing ⟨Expr → Expr – Term⟩?
  • A: Shift next token
  • B: Accept
  • C: Reduce to Goal
  • D: Error occurs
View Answer
C

Q696: In expression grammar parsing, when does the parser accept the input?
  • A: When no symbols are left
  • B: When input ends with id
  • C: When Goal is on top of stack over $
  • D: When expression reduces to Term
View Answer
C

Q697: The production Expr → Expr – Term has how many placeholder positions?
  • A: 2
  • B: 3
  • C: 4
  • D: 5
View Answer
C

Q698: Placeholder position “Expr → • Expr –Term” means parser is about to parse ______.
  • A: Term
  • B: Expr
  • C: Minus
  • D: Goal
View Answer
B

Q699: The stack helps eliminate the need to track the _______ of a handle.
  • A: Grammar symbol
  • B: Value
  • C: Position
  • D: Production index
View Answer
C

Q700: The shift-reduce parser can handle expressions such as:
  • A: x + y – z
  • B: x – 2 × y
  • C: x * y / z
  • D: a + b + c
View Answer
B

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now