Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q551: The entry Eโ€™ โ†’ e in the table represents
  • A: No input required
  • B: A default fallback
  • C: Empty production
  • D: Error state
View Answer
C

Q552: What does the parser output when a production is applied?
  • A: Non-terminal
  • B: Production used
  • C: Parsed string
  • D: None of these
View Answer
B

Q553: 2 + 4 * 6 results in ________ as per AST representation.
  • A: 14
  • B: 36
  • C: 26
  • D: None of the above
View Answer
A

Q554: In the trace, which function is called after Factor::isPresent() returns true?
  • A: Eprime::isPresent()
  • B: Tprime::isPresent()
  • C: Expr::isPresent()
  • D: None of these
View Answer
B

Q555: The predictive parser is also called
  • A: LL parser
  • B: Stack parser
  • C: Table-driven parser
  • D: All of the above
View Answer
D

Q556: What value does s->nextToken() return for operator *?
  • A: 269
  • B: 267
  • C: 270
  • D: 268
View Answer
A

Q557: To construct an AST, each subtree is built using
  • A: TreeNode
  • B: NodeTree
  • C: NodeRoot
  • D: TreeGraph
View Answer
A

Q558: ________ function handles grouping expressions with parentheses.
  • A: Factor::isPresent()
  • B: Term::isPresent()
  • C: Eprime::isPresent()
  • D: Tprime::isPresent()
View Answer
A

Q559: Which grammar rule supports left-recursive removal for Eโ€™?
  • A: E' โ†’ E + T
  • B: E' โ†’ + T E'
  • C: E' โ†’ T + E
  • D: T โ†’ F T'
View Answer
B

Q560: If M[X,a] = {X โ†’ UVW}, then stack top X is replaced by
  • A: UVW
  • B: WVU
  • C: None
  • D: Not replaced
View Answer
B

Test Your Knowledge

Take a timed quiz on Compiler Construction

๐Ÿš€ Start Quiz Now