Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q681: Which direction does a bottom-up parser build the parse tree?
  • A: Top to bottom
  • B: Root to leaf
  • C: Leaf to root
  • D: Random
View Answer
C

Q682: What is the upper frontier in a bottom-up parser?
  • A: The left-most leaf
  • B: The root of the tree
  • C: The rightmost input token
  • D: The edge of the partially constructed parse tree
View Answer
D

Q683: Which of the following describes a handle in bottom-up parsing?
  • A: A terminal to be deleted
  • B: A left-hand side symbol
  • C: A pair representing a match of a production
  • D: A complete input stream
View Answer
C

Q684: A handle is represented by which of the following?
  • A: ⟨A→β,k⟩
  • B: β→A
  • C: 〈k,β→A〉
  • D: ⟨β→A⟩
View Answer
A

Q685: In a handle ⟨A→β,k⟩, what does 'k' represent?
  • A: Number of productions
  • B: Position on stack
  • C: Right-end of β on the frontier
  • D: Production index
View Answer
C

Q686: Which one is a valid handle from the sample?
  • A: ⟨Expr → Term •⟩
  • B: ⟨Expr ← Term •⟩
  • C: ⟨Expr → • Term⟩
  • D: ⟨Expr = Term ⟩
View Answer
A

Q687: How many handles are identified in the sample expression parse process?
  • A: 5
  • B: 7
  • C: 9
  • D: 3
View Answer
C

Q688: What happens when a handle is reduced in shift-reduce parsing?
  • A: New token is created
  • B: Partial tree is discarded
  • C: New node is added to parse tree
  • D: Input token is ignored
View Answer
C

Q689: What is the final handle that confirms successful parsing?
  • A: ⟨Goal → Expr,1⟩
  • B: ⟨Expr → Term,1⟩
  • C: ⟨Factor → id,1⟩
  • D: ⟨Goal → Term,1⟩
View Answer
A

Q690: Which expression is used to represent the top of the stack in handle notation?
  • A: ▲
  • B: ▼
  • C: •
  • D: ∗
View Answer
C

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now