Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q1171: Fill in the blank: When a variable is non-live after an instruction, its register can be ______.
- A: Discarded
- B: Kept
- C: Duplicated
- D: Stored
View Answer
A
Q1172: Fill in the blank: In the example, the instruction MUL R2,R2 means multiplying register R2 by ______.
- A: Itself
- B: Zero
- C: One
- D: Another register
View Answer
A
Q1173: Fill in the blank: The instruction sequence MOV R2,R3 ADD R1,R3 corresponds to adding the values in registers R1 and ______.
- A: R2
- B: R3
- C: R1
- D: R4
View Answer
B
Q1174: In liveness analysis, a variable is considered live if it has a ______ use in the future.
- A: Next
- B: Previous
- C: No
- D: Immediate
View Answer
A
Q1175: What happens to a register when the variable it contains is no longer live?
- A: It can be reused
- B: It causes an error
- C: It is locked
- D: It must be spilled
View Answer
A
Q1176: Liveness information helps us to keep values in ________ if they will be used later.
- A: memory
- B: registers
- C: cache
- D: disk
View Answer
B
Q1177: Why do we assume all variables are live at the end of blocks?
- A: To save them for later use
- B: To discard them
- C: To optimize memory usage
- D: To reload them immediately
View Answer
A
Q1178: Global data-flow analysis is required to determine live/next use information across _______.
- A: functions
- B: blocks
- C: registers
- D: instructions
View Answer
B
Q1179: In a DAG for a basic block, leaves are labeled by ________.
- A: operator symbols
- B: unique identifiers
- C: values
- D: registers
View Answer
B
Q1180: Interior nodes in a DAG are labeled by ________.
- A: values
- B: operator symbols
- C: registers
- D: basic blocks
View Answer
B