Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q661: A handle is always a substring that matches the _______ of a production rule.
  • A: Left-hand side
  • B: Entire production
  • C: Right-hand side
  • D: First terminal
View Answer
C

Q662: What is the role of the stack in bottom-up parsing?
  • A: To store terminals only
  • B: To hold the input buffer
  • C: To maintain the upper frontier
  • D: To hold error messages
View Answer
C

Q663: Handle pruning refers to repeatedly locating handles and _______.
  • A: Deleting them
  • B: Shifting them
  • C: Reducing them
  • D: Pushing them back
View Answer
C

Q664: Why does the bottom-up parser use a stack?
  • A: To manage memory efficiently
  • B: To represent the grammar
  • C: To track terminals only
  • D: To avoid errors
View Answer
A

Q665: The stack ensures that all handles occur with their _______ at the top.
  • A: Left end
  • B: Right end
  • C: Middle
  • D: End of input
View Answer
B

Q666: Which of the following simplifies space management in bottom-up parsing?
  • A: Buffers
  • B: Tokens
  • C: Grammar rules
  • D: Stacks
View Answer
D

Q667: The algorithm begins by pushing _______ onto the stack.
  • A: ►
  • B: $
  • C: Top symbol
  • D: Start symbol
View Answer
B

Q668: What is the stopping condition for the shift-reduce parsing algorithm?
  • A: Input is empty and stack has $
  • B: Input has only terminals
  • C: Input is reduced to start symbol and stack has Goal on top of $
  • D: Stack is full
View Answer
C

Q669: In the algorithm, what is sym assigned to?
  • A: $
  • B: NextToken()
  • C: Top of stack
  • D: Last terminal
View Answer
B

Q670: What happens if there is no handle and no input?
  • A: Parsing continues
  • B: Shift occurs
  • C: Reduce occurs
  • D: Error is reported and halt
View Answer
D

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now