Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q1201: In the given example DAG, the node labeled '*' has children labeled:
  • A: a and b
  • B: b and c
  • C: t1 and b
  • D: c and b
View Answer
C

Q1202: In register allocation, the graph coloring algorithm aims to color the graph with how many colors?
  • A: K colors
  • B: N colors
  • C: M colors
  • D: 1 color
View Answer
A

Q1203: Which of these is NOT part of the register allocation algorithm described?
  • A: Compute liveness information
  • B: Create interference graph
  • C: Sort variables alphabetically
  • D: Simplify graph
View Answer
C

Q1204: The interference graph for variables a, t1, b, c, t2 shows that nodes a and t1 share which register?
  • A: R1
  • B: R2
  • C: R3
  • D: None
View Answer
A

Q1205: In the example, which register is assigned to variable t2?
  • A: R1
  • B: R2
  • C: R3
  • D: R4
View Answer
C

Q1206: Fill in the blank: The DAG node labeled '+' in the expression a = b + c represents the operation between ________ and ________.
  • A: a, b
  • B: b, c
  • C: c, a
  • D: a, c
View Answer
B

Q1207: Fill in the blank: The ________ graph is used in register allocation to represent interference among variables.
  • A: interference
  • B: data-flow
  • C: control
  • D: call
View Answer
A

Q1208: Fill in the blank: The step of assigning colors in graph coloring is done by popping elements off a ________.
  • A: queue
  • B: stack
  • C: list
  • D: set
View Answer
B

Q1209: Fill in the blank: The number of machine instructions required can be reduced by ________ the order of DAG traversal.
  • A: increasing
  • B: reordering
  • C: ignoring
  • D: delaying
View Answer
B

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now