Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q1161: For "c = t1 * b", what happens when t1 is not live?
- A: Use R1
- B: Register spill
- C: Use R2
- D: Register free
View Answer
A
Q1162: Which instruction corresponds to "t2 = c + b" in assembly?
- A: MOV R2,R3 ADD R1,R3
- B: MOV R1,R2 ADD R3,R2
- C: MOV R3,R2 ADD R2,R1
- D: LOAD R1,R2 ADD R3,R1
View Answer
A
Q1163: In the last instruction "a = t2 + t2", what operation is performed?
- A: ADD R3,R3
- B: MUL R3,R3
- C: SUB R3,R3
- D: DIV R3,R3
View Answer
A
Q1164: Which instruction saves the variable a to memory at the end?
- A: MOV R3,a
- B: MOV a,R3
- C: MOV R1,a
- D: MOV a,R1
View Answer
A
Q1165: What is the benefit of using liveness information in register allocation?
- A: Free unused registers
- B: Increase code size
- C: Delay execution
- D: Increase memory usage
View Answer
A
Q1166: In basic code generation, which register descriptor status indicates a register is free?
- A: Empty
- B: InUse
- C: Busy
- D: Full
View Answer
A
Q1167: What is the typical order of processing instructions in basic code generation?
- A: End to start
- B: Beginning to end
- C: Random
- D: Parallel
View Answer
B
Q1168: Fill in the blank: The two main data structures used in basic code generation are ______ and ______.
- A: Register descriptor, Address descriptor
- B: Stack, Heap
- C: Symbol table, Register file
- D: Cache, Memory
View Answer
A
Q1169: Fill in the blank: MOV b,R1 means moving the value of variable b to register ______.
- A: R1
- B: R2
- C: R3
- D: R4
View Answer
A
Q1170: Fill in the blank: The assembly instruction ADD c,R1 adds the value of c to the contents of register ______.
- A: R1
- B: R2
- C: R3
- D: R4
View Answer
A