Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q771: In the NFA of LR(0) items, a transition on symbol X from state A→ α•Xη leads to which state?
  • A: A→ αX•η
  • B: A→ α•Xη
  • C: A→ αXη•
  • D: A→ •αXη
View Answer
A

Q772: In the LR(1) parsing stack, a transition on a terminal symbol corresponds to which action?
  • A: Shift
  • B: Reduce
  • C: Accept
  • D: Reject
View Answer
A

Q773: If X is a non-terminal, what does the transition on X correspond to in the parser?
  • A: Pushing X onto the stack
  • B: Reading X from input
  • C: Reducing X
  • D: Shifting X
View Answer
A

Q774: The dot (•) in an LR(1) item indicates what?
  • A: The current parsing position
  • B: The start of production
  • C: The end of production
  • D: Lookahead symbol
View Answer
A

Q775: The set s changes during closure, so the procedure must be repeated to find ________.
  • A: All reachable items
  • B: Only terminals
  • C: Only non-terminals
  • D: Lookahead symbols
View Answer
A

Q776: FIRST(δa) in closure includes which of the following?
  • A: All terminals that can appear at start of δ and a
  • B: If ε ∈ FIRST(δ), it also includes a
  • C: Only ε
  • D: Only a
View Answer
B

Q777: The transition on terminal symbol X in LR(0) NFA corresponds to which parser operation?
  • A: Shift
  • B: Reduce
  • C: Push
  • D: Pop
View Answer
A

Q778: The production S → E in the augmented grammar is used to create which initial item?
  • A: [S → •E, $]
  • B: [E → •int, $]
  • C: [S → E•, $]
  • D: [E → •E+(E), $]
View Answer
A

Q779: Fill in the blank: In goto(s, y), the symbol y can be a ________.
  • A: Terminal or non-terminal
  • B: Only terminal
  • C: Only non-terminal
  • D: Only production
View Answer
A

Q780: Fill in the blank: The NFA of LR(0) items has transitions labeled by ________.
  • A: Grammar symbols
  • B: Dot positions
  • C: Lookahead symbols
  • D: Productions
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now