Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q1151: Which data structure keeps track of register status and contents?
- A: Address descriptor
- B: Register descriptor
- C: Symbol table
- D: Stack frame
View Answer
B
Q1152: What does the address descriptor track in code generation?
- A: Register contents
- B: Location(s) of a variable
- C: Instruction set
- D: Memory leaks
View Answer
B
Q1153: In the instruction type "x = y op z", what is the first step if y is non-live and in register R?
- A: Generate OP z’, R
- B: Generate MOV y’, R
- C: Generate MOV z’, R
- D: Generate OP y’, R
View Answer
A
Q1154: If the operation is commutative and z is non-live in register R, what instruction is generated?
- A: OP y’, R
- B: OP z’, R
- C: MOV y’, R
- D: MOV z’, R
View Answer
A
Q1155: When no free register is available, how is code generated?
- A: Use a memory location
- B: Allocate new register
- C: Delete a variable
- D: Stop code generation
View Answer
A
Q1156: Initially, how many registers are empty before starting code generation in the example?
- A: One
- B: Two
- C: Three
- D: Four
View Answer
C
Q1157: After the instruction "a = b + c", which register is assigned to variable a?
- A: R1
- B: R2
- C: R3
- D: R4
View Answer
A
Q1158: What is the machine instruction generated for "a = b + c" when b is moved to R1?
- A: ADD c,R1
- B: MOV b,R1
- C: SUB c,R1
- D: MOV c,R1
View Answer
B
Q1159: During code generation, what operation is performed for "t1 = a * a" after moving a to R2?
- A: ADD R2,R2
- B: MUL R2,R2
- C: SUB R2,R2
- D: DIV R2,R2
View Answer
B
Q1160: In the instruction "b = t1 + a", which register holds the value of a?
- A: R1
- B: R2
- C: R3
- D: R4
View Answer
A