Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q741: The LR(1) item [S → •E, $] represents a configuration where S is expected followed by ________.
  • A: +
  • B: $
  • C: (
  • D: )
View Answer
B

Q742: What does the closure procedure compute in LR(1) parser construction?
  • A: Transitions between states
  • B: Lookahead symbols
  • C: All items reachable from a given set
  • D: Grammar rules
View Answer
C

Q743: In closure(s), if [X → α•Yβ, a] ∈ s and Y → γ is a production, then s is extended by ________.
  • A: [X → αY•β, a]
  • B: [Y → •γ, a]
  • C: [Y → •γ, b]
  • D: for all b ∈ FIRST(βa)
View Answer
D

Q744: The function FIRST(βa) is used in closure to determine ________.
  • A: Lookahead symbols
  • B: Stack size
  • C: Possible next symbols
  • D: Number of productions
View Answer
C

Q745: The initial set I0 of LR(1) items for the grammar S → E consists of how many items?
  • A: 1
  • B: 2
  • C: 3
  • D: 4
View Answer
C

Q746: Which of the following productions is part of the closure of [S → •E, $] for the grammar S → E; E → E + (E) | int?
  • A: [E → E + (E) •, $]
  • B: [E → •E + (E), $]
  • C: [S → E •, $]
  • D: [E → •int, +]
View Answer
B

Q747: If s changes in the closure procedure, what action is taken?
  • A: Stop and return s
  • B: Repeat the closure procedure
  • C: Discard s
  • D: Restart the parser
View Answer
B

Q748: In LR(1), the lookahead symbol 'a' belongs to which set?
  • A: Non-terminals
  • B: Terminals
  • C: Productions
  • D: Stack symbols
View Answer
B

Q749: The purpose of adding an augmented start symbol S is to ensure ________.
  • A: Unique goal symbol
  • B: More productions
  • C: Reduce ambiguity
  • D: Add states
View Answer
A

Q750: The item [E → •int, $] in I0 means the parser expects ________ next with lookahead $.
  • A: int followed by $
  • B: int followed by +
  • C: int alone
  • D: $ alone
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now