Skip to main content

Compiler Construction MCQs with Answers

Practice important Compiler Construction MCQs with answers and explanations.

Multiple Choice Questions

Q1141: What happens to variable x after executing the statement "x = y + z" in live variable analysis?
  • A: It is added to the live set
  • B: It is removed from the live set
  • C: It remains unchanged
  • D: It is duplicated
View Answer
B

Q1142: In basic block code generation, which technique uses node numbering?
  • A: Basic code generation
  • B: DAGS
  • C: Register allocation
  • D: None of the above
View Answer
B

Q1143: Which of the following is NOT a basic block code generation strategy?
  • A: Using liveness information
  • B: Using DAGs
  • C: Node numbering
  • D: Register removal
View Answer
D

Q1144: What is the final step in the algorithm for computing live status in a basic block?
  • A: Add variables y and z to live set
  • B: Attach live set to the statement
  • C: Remove x from live set
  • D: Initialize live set
View Answer
A

Q1145: Fill in the blank: The set of edges E in a CFG represent the ______ of control between basic blocks.
  • A: Memory flow
  • B: Data flow
  • C: Control flow
  • D: Information flow
View Answer
C

Q1146: Fill in the blank: In the CFG, the unique program entry point is called ______.
  • A: Exit
  • B: Entry
  • C: Leader
  • D: Block start
View Answer
B

Q1147: Fill in the blank: In partitioning basic blocks, any statement that immediately follows a ______ is a leader.
  • A: Goto
  • B: If statement
  • C: Function call
  • D: Return statement
View Answer
A

Q1148: Fill in the blank: The basic block code generation strategy using liveness information emits code to save any ______ left in registers at the end of the block.
  • A: Dead variables
  • B: Live values
  • C: Temporary variables
  • D: Constants
View Answer
B

Q1149: Fill in the blank: In liveness analysis, a variable is said to be ______ at a given point if it has a next use.
  • A: Dead
  • B: Live
  • C: Undefined
  • D: Constant
View Answer
B

Q1150: What is the purpose of live/next use information in basic code generation?
  • A: To optimize register usage
  • B: To increase memory size
  • C: To slow down execution
  • D: To delete dead code
View Answer
A

Test Your Knowledge

Take a timed quiz on Compiler Construction

🚀 Start Quiz Now