Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Chapter: 41
Q1101:
The quadruple at index 107 in the example is:
A. x=y+z
B. x=y-z
C. goto _
D. goto 106
Correct Answer: C
Chapter: 42
Q1102:
The primary task of code generation in a compiler is to:
A. Map intermediate code to machine code
B. Map source code to machine code
C. Optimize source code
D. Parse source code
Correct Answer: A
Chapter: 42
Q1103:
Which of the following is NOT an issue handled by the code generation module?
A. Memory management
B. Instruction selection
C. Parsing syntax
D. Register allocation
Correct Answer: C
Chapter: 42
Q1104:
In code generation, what is the input to the code generation module?
A. High-level language code
B. Machine code
C. Intermediate code
D. Assembly language code
Correct Answer: C
Chapter: 42
Q1105:
The target machine architecture discussed uses instructions of which format?
A. One-address
B. Two-address
C. Three-address
D. Four-address
Correct Answer: B
Chapter: 42
Q1106:
What is the size of a word in the target machine?
A. 1 byte
B. 2 bytes
C. 4 bytes
D. 8 bytes
Correct Answer: C
Chapter: 42
Q1107:
The assembly instruction SUB source, destination performs which operation?
A. Destination = Destination - Source
B. Source = Destination - Source
C. Destination = Source - Destination
D. Source = Source - Destination
Correct Answer: A
Chapter: 42
Q1108:
Which addressing mode has zero added cost?
A. Absolute
B. Indexed
C. Register
D. Literal
Correct Answer: C
Chapter: 42
Q1109:
The addressing mode c(R) is called:
A. Absolute
B. Indexed
C. Indirect Register
D. Stack
Correct Answer: B
Chapter: 42
Q1110:
What does the "added cost" in code generation refer to?
A. Execution time
B. Instruction length
C. Memory address cost
D. Register usage cost
Correct Answer: B
Chapter: 42
Q1111:
MOV R5, M has a total cost of:
A. 1
B. 2
C. 3
D. 4
Correct Answer: B
Chapter: 42
Q1112:
Which instruction performs a conditional jump?
A. MOV
B. ADD
C. CJ
D. GOTO
Correct Answer: C
Chapter: 42
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
Correct Answer: A
Chapter: 42
Q1114:
The optimized code for a[i] = b[c[j]] reduces the cost to:
A. 18
B. 12
C. 10
D. 8
Correct Answer: C
Chapter: 42
Q1115:
Register allocation aims to:
A. Minimize memory use
B. Maximize instruction count
C. Make efficient use of limited registers
D. Eliminate registers
Correct Answer: C
Chapter: 42
Q1116:
Instruction scheduling helps to:
A. Utilize CPU resources
B. Avoid hardware stalls
C. Reduce execution time
D. All of the above
Correct Answer: D
Chapter: 42
Q1117:
Which addressing mode has the highest added cost?
A. Register
B. Absolute
C. Indexed
D. Absolute with memory reference
Correct Answer: D
Chapter: 42
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
Correct Answer: D
Chapter: 42
Q1119:
Which instruction is used for an unconditional jump?
A. MOV
B. ADD
C. CJ
D. GOTO
Correct Answer: D
Chapter: 42
Q1120:
The cost of MOV R0, R1; ADD R2, R3 is:
A. 1
B. 2
C. 3
D. 4
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now