The GATE Grind

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

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

  1. GATE 2017 CS 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`…
  2. GATE 2015 CS 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…
  3. 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?
  4. 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…
  5. GATE 2025 CS (CS1) Q13 (1 mark, Multiple choice) – Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
  6. GATE 2023 CS Q37 (2 marks, Multiple choice) – Consider the control flow graph shown. [Figure: ENTRY → B1 (i = m − 1; j = n; a = 10) → B2 (i = i + 1; j = j − 1); B3 (i = a + 1); B4 (a = 20); EXIT.]…
  7. GATE 2021 CS 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…