Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q1111: MOV R5, M has a total cost of:
- A: 1
- B: 2
- C: 3
- D: 4
View Answer
B
Q1112: Which instruction performs a conditional jump?
- A: MOV
- B: ADD
- C: CJ
- D: GOTO
View Answer
C
Q1113: What is the main drawback of simple code generation?
- A: Produces inefficient code
- B: Requires too much memory
- C: Uses too many registers
- D: Produces incorrect code
View Answer
A
Q1114: The optimized code for a[i] = b[c[j]] reduces the cost to:
- A: 18
- B: 12
- C: 10
- D: 8
View Answer
C
Q1115: Register allocation aims to:
- A: Minimize memory use
- B: Maximize instruction count
- C: Make efficient use of limited registers
- D: Eliminate registers
View Answer
C
Q1116: Instruction scheduling helps to:
- A: Utilize CPU resources
- B: Avoid hardware stalls
- C: Reduce execution time
- D: All of the above
View Answer
D
Q1117: Which addressing mode has the highest added cost?
- A: Register
- B: Absolute
- C: Indexed
- D: Absolute with memory reference
View Answer
D
Q1118: In the instruction MOV addr(b), R0; ADD *R0, R1; what addressing mode is used for *R0?
- A: Indirect register
- B: Indexed
- C: Absolute
- D: Indirect indexed
View Answer
D
Q1119: Which instruction is used for an unconditional jump?
- A: MOV
- B: ADD
- C: CJ
- D: GOTO
View Answer
D
Q1120: The cost of MOV R0, R1; ADD R2, R3 is:
- A: 1
- B: 2
- C: 3
- D: 4
View Answer
C