Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Chapter: 45
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
Correct Answer:
C
Chapter: 45
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
Correct Answer:
A
Chapter: 45
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
Correct Answer:
C
Chapter: 45
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
Correct Answer:
A
Chapter: 45
Q1205:
In the example, which register is assigned to variable t2?
A. R1
B. R2
C. R3
D. R4
Correct Answer:
C
Chapter: 45
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
Correct Answer:
B
Chapter: 45
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
Correct Answer:
A
Chapter: 45
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
Correct Answer:
B
Chapter: 45
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
Correct Answer:
B