Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q961: The YACC directive %nonassoc is used to declare tokens with ________.
  • A: No associativity
  • B: Left associativity
  • C: Right associativity
  • D: Both left and right
View Answer
A

Q962: In YACC, %left PLUS MINUS means that PLUS and MINUS have ________.
  • A: Left associativity
  • B: Right associativity
  • C: No associativity
  • D: Nonassociativity
View Answer
A

Q963: IRs fall into how many organizational categories?
  • A: 2
  • B: 3
  • C: 4
  • D: 5
View Answer
B

Q964: Which of the following is NOT an organizational category of IRs?
  • A: Graphical IRs
  • B: Linear IRs
  • C: Procedural IRs
  • D: Hybrid IRs
View Answer
C

Q965: Graphical IRs encode compiler knowledge in a ________.
  • A: graph
  • B: tree
  • C: list
  • D: stack
View Answer
A

Q966: Linear IRs resemble _______ for some abstract machine.
  • A: pseudo-code
  • B: assembly code
  • C: machine code
  • D: source code
View Answer
A

Q967: Hybrid IRs combine elements of ______ and ______.
  • A: linear and procedural
  • B: graphical and procedural
  • C: graphical and linear
  • D: stack and graph
View Answer
C

Q968: Parse trees are primarily used as an IR in ________.
  • A: parsing and attribute grammar
  • B: code generation
  • C: lexical analysis
  • D: optimization
View Answer
A

Q969: Abstract Syntax Trees (AST) remove _______ nodes compared to parse trees.
  • A: essential
  • B: extraneous
  • C: semantic
  • D: syntactic
View Answer
B

Q970: Which IR avoids duplication by contracting an AST?
  • A: Directed Acyclic Graph (DAG)
  • B: Parse Tree
  • C: Linear IR
  • D: Three-address code
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now