Compiler Construction MCQs with Answers
Practice important Compiler Construction MCQs with answers and explanations.
Multiple Choice Questions
Q111: What is the role of the middle end in a compiler?
- A: Scan source code
- B: Optimize intermediate representation
- C: Convert IR to binary code
- D: Check for syntax errors
View Answer
B
Q112: Which component is responsible for optimizing code performance?
- A: Front end
- B: Back end
- C: Middle end
- D: Scanner
View Answer
C
Q113: The optimizer performs code transformations in ______.
- A: Single step
- B: Series of passes
- C: Parser phase
- D: Runtime checks
View Answer
B
Q114: Which transformation is used to eliminate repeated computations?
- A: Code formatting
- B: Error handling
- C: Redundant computation removal
- D: Type conversion
View Answer
C
Q115: Useless or unreachable code is removed during ______.
- A: Linking
- B: Code generation
- C: Optimization
- D: Execution
View Answer
C
Q116: Which code transformation involves placing computations in less frequent paths?
- A: Code duplication
- B: Loop unrolling
- C: Computation motion
- D: Inlining
View Answer
C
Q117: What is a benefit of encoding idioms efficiently in compiler optimization?
- A: Improved error handling
- B: More readable syntax
- C: Faster and compact machine code
- D: Better debug output
View Answer
C
Q118: The runtime system interacts with the ______.
- A: Compiler
- B: Operating system
- C: UI designer
- D: Code editor
View Answer
B
Q119: Dynamic memory allocation is managed by the ______.
- A: Scanner
- B: IR generator
- C: Runtime system
- D: Parser
View Answer
C
Q120: Which component allocates and de-allocates memory at runtime?
- A: Middle end
- B: Runtime system
- C: Front end
- D: Symbol table
View Answer
B