Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q721: Which of the following is an example of a potential handle for Term → Term × Factor?
  • A: 〈Term → • Term × Factor〉
  • B: 〈Term → Term • × Factor〉
  • C: 〈Term → Term × • Factor〉
  • D: All of the above
View Answer
D

Q722: The parsing table with terminals and DFA states is known as the _________.
  • A: Action table
  • B: Goto table
  • C: LALR table
  • D: Transition table
View Answer
A

Q723: To resolve shift/reduce conflict, parser considers ________.
  • A: Grammar tree
  • B: Operator precedence
  • C: Lookahead symbol
  • D: First and follow sets
View Answer
C

Q724: The representation of a handle with a lookahead in LR(1) parsing is called ________.
  • A: DFA state
  • B: LR(1) item
  • C: Handle ID
  • D: Grammar node
View Answer
B

Q725: What action is taken when the parser sees Expr – Term × id?
  • A: Reduce to Expr
  • B: Reduce to Term
  • C: Shift
  • D: Accept
View Answer
C

Q726: How does a parser know whether to reduce or shift at step 9?
  • A: Length of stack
  • B: Input symbol
  • C: Right context of handle
  • D: Grammar goal
View Answer
C

Q727: At step 13 of bottom-up parsing, which reduction occurs?
  • A: Expr → Term
  • B: Expr → Expr – Term
  • C: Term → Factor
  • D: Factor → id
View Answer
B

Q728: What does the parser do when the input matches no handle?
  • A: Shift
  • B: Backtrack
  • C: Error
  • D: Accept
View Answer
C

Q729: In LR parsing, rows are DFA states and columns with non-terminals form the ________.
  • A: Action table
  • B: Goto table
  • C: Derivation table
  • D: State index
View Answer
B

Q730: Which of the following is the correct notation for a handle at the top of the stack?
  • A: 〈Expr → • Term〉
  • B: 〈Expr → Term •〉
  • C: 〈Expr • Term〉
  • D: 〈•Expr → Term〉
View Answer
B

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now