The GATE Grind

GATE Compiler Design: Code Optimization and Data Flow Analysis – Previous Year Questions

18 GATE previous year questions on Code Optimization and Data Flow Analysis (Compiler Design, Computer Science) with answers and explanations, from every paper.

18 questions worth 31 marks in all (5 1-mark, 13 2-mark). Asked between 2008 and 2026, so you can see how the topic has been tested over time.

  1. GATE 2008 CS Q12 (1 mark, Multiple choice) – Some optimizations are performed on intermediate code because
  2. GATE 2009 CS Q17 (1 mark, Multiple choice) – Match Group 1 with Group 2. Group 1: P. Regular expression; Q. Pushdown automata; R. Dataflow analysis; S. Register allocation. Group 2: 1. Syntax…
  3. GATE 2009 CS Q42 (2 marks, Multiple choice) – Which statements are TRUE? I. Some programming languages have parsing algorithms of complexity less than Θ(n³). II. A language allowing recursion can…
  4. GATE 2021 CS (CS2) Q40 (2 marks, Multiple choice) – Apply common-subexpression elimination to the code. y points to a heap struct with f1,f2; x,y,z,p,q,i reside in registers. Count additions and…
  5. GATE 2021 CS (CS2) Q48 (2 marks, Multiple choice) – For statement S, USE(S) contains variables used in S; IN(S) those live at entry; OUT(S) those live at exit. A basic block consists of S1 immediately…
  6. GATE 2015 CS (CS2) Q27 (1 mark, Multiple choice) – Match P: lexical analysis; Q: parsing; R: register allocation; S: expression evaluation. Techniques: 1 graph colouring; 2 DFA minimization; 3…
  7. GATE 2010 CS Q47 (2 marks, Multiple choice) – Without spilling values to memory, what is the minimum number of registers needed for this basic block?
  8. GATE 2013 CS Q58 (2 marks, Multiple choice) – A processor permits register operands only, at most two sources and one destination per instruction. All variables are dead after this segment. Only…
  9. GATE 2013 CS Q59 (2 marks, Multiple choice) – For the same register-only architecture and complete segment below, apply register allocation only, with no code motion. Find minimum registers to…
  10. GATE 2014 CS (CS3) Q44 (2 marks, Multiple choice) – Basic block: a = b + c c = a + d d = b + c e = d - b a = e + b Find the minimum numbers of nodes and edges, respectively, in its DAG representation.
  11. GATE 2014 CS (CS1) Q27 (1 mark, Multiple choice) – Which compiler statement is FALSE?
  12. GATE 2017 CS (CS1) Q53 (2 marks, Numerical answer) – Consider the following grammar: where `relop` is a relational operator (e.g., <, >, ...), ò refers to the empty statement, and `if`, `then`, `else`…
  13. GATE 2015 CS (CS1) Q46 (2 marks, Multiple choice) – A variable x is said to be live at a statement S i in a program if the following three conditions hold simultaneously: i. There exists a statement S j…
  14. GATE 2026 CS (CS2) Q45 (2 marks, Multiple choice) – Consider the control flow graph given below. Which one of the following options is the set of live variables at the exit point of each basic block?
  15. GATE 2026 CS (CS1) Q42 (2 marks, Multiple choice) – Consider the control flow graph shown in the figure. Which one of the following options correctly lists the set of redundant expressions (common…
  16. GATE 2025 CS (CS1) Q13 (1 mark, Multiple choice) – Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
  17. GATE 2023 CS Q37 (2 marks, Multiple choice) – Consider the control flow graph shown. Which one of the following choices correctly lists the set of live variables at the exit point of each basic…
  18. GATE 2021 CS (CS1) Q60 (2 marks, Numerical answer) – Consider the following C code segment: In a compiler, this code segment is represented internally as a directed acyclic graph (DAG). The number of…