Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Chapter: 3
Q81:
Which part of the compiler is responsible for choosing machine instructions?
A. Front end
B. Parser
C. Back end
D. Scanner
Correct Answer:
C
Chapter: 3
Q82:
Register access is preferred over memory access because it is ______.
A. More secure
B. Faster
C. More portable
D. More visible
Correct Answer:
B
Chapter: 3
Q83:
Instruction selection in the compiler is mainly handled by ______.
A. Parser
B. Scanner
C. Back end
D. Optimizer
Correct Answer:
C
Chapter: 3
Q84:
Which of the following affects code speed and compactness?
A. Number of variables
B. Instruction selection
C. Token count
D. Loop unrolling
Correct Answer:
B
Chapter: 3
Q85:
The back end ensures conformance with ______.
A. User interface
B. Programming language semantics
C. System interfaces
D. Code comments
Correct Answer:
C
Chapter: 3
Q86:
Instruction selection is often solved using ______ algorithms.
A. Greedy
B. Recursive
C. Dynamic programming
D. Divide and conquer
Correct Answer:
C
Chapter: 3
Q87:
Instruction selection is viewed as a ______ problem.
A. Search
B. Tree
C. Pattern matching
D. Backtracking
Correct Answer:
C
Chapter: 3
Q88:
What is one way the back end improves performance?
A. By printing warnings
B. By minimizing variables
C. By avoiding memory access
D. By rewriting source code
Correct Answer:
C
Chapter: 3
Q89:
Which system architecture inspired compiler instruction selection?
A. RISC
B. VAX-11
C. VLSI
D. Pipelined CPU
Correct Answer:
B
Chapter: 3
Q90:
The VAX-11 used which kind of architecture?
A. RISC
B. CISC
C. Pipelined
D. RISC-V
Correct Answer:
B
Chapter: 3
Q91:
CISC stands for ______.
A. Common Instruction System Code
B. Compiler Instruction Set Code
C. Complex Instruction Set Computer
D. Compact Instruction Selection Code
Correct Answer:
C
Chapter: 3
Q92:
What feature of VAX-11 supported advanced instruction selection?
A. Limited addressing modes
B. Small instruction set
C. Rich instruction set
D. Fixed pipeline
Correct Answer:
C
Chapter: 3
Q93:
AST stands for ______.
A. Abstract Syntax Tree
B. Assembled Structure Tree
C. Advanced Syntax Translator
D. Applied Semantic Tree
Correct Answer:
A
Chapter: 3
Q94:
What does the back end use to implement each IR operation?
A. Grammar rules
B. Machine instructions
C. Tokens
D. Error handlers
Correct Answer:
B
Chapter: 3
Q95:
Which tree is more efficient for optimization tasks?
A. Parse Tree
B. Abstract Syntax Tree
C. Expression Tree
D. Token Tree
Correct Answer:
B
Chapter: 3
Q96:
The goal of instruction selection is to produce ______.
A. Secure code
B. Fast and compact code
C. Longer code
D. Complex expressions
Correct Answer:
B
Chapter: 3
Q97:
Which tree includes unnecessary grammatical information?
A. Abstract Syntax Tree
B. Parse Tree
C. Syntax Directed Tree
D. Binary Tree
Correct Answer:
B
Chapter: 3
Q98:
What does the AST for x + 2 - y represent at the top level?
A. Assignment
B. Subtraction
C. Addition
D. Multiplication
Correct Answer:
C
Chapter: 3
Q99:
In AST, internal nodes typically represent ______.
A. Tokens
B. Variables
C. Operators
D. Errors
Correct Answer:
C
Chapter: 3
Q100:
How many operands are used in the AST for x + 2 - y?
A. 1
B. 2
C. 3
D. 4
Correct Answer:
C