The GATE Grind

GATE Compiler Design: Intermediate Code Generation – Previous Year Questions

9 GATE previous year questions on Intermediate Code Generation (Compiler Design, Computer Science) with answers and explanations, from every paper.

  1. GATE 2017 CS Q22 (1 mark, Multiple choice) – Consider the following intermediate program in three address code Which one of the following corresponds to a *static single assignment* form of the…
  2. GATE 2017 CS Q62 (2 marks, Numerical answer) – Consider the expression (a - 1) * (((b + c) / 3) + d). Let X be the minimum number of registers required by an *optimal* code generation (without any…
  3. GATE 2016 CS Q29 (1 mark, Numerical answer) – Consider the following code segment. The minimum number of *total* variables required to convert the above code segment to *static single assignment*…
  4. GATE 2015 CS Q47 (2 marks, Numerical answer) – The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r/3 + s - t *…
  5. GATE 2025 CS (CS2) Q21 (1 mark, Multiple choice) – Consider the following statements about the use of backpatching in a compiler for intermediate code generation: (I) Backpatching can be used to…
  6. GATE 2025 CS (CS1) Q52 (2 marks, Numerical answer) – Refer to the given 3-address code sequence. This code sequence is split into basic blocks. The number of basic blocks is . (Answer in integer)
  7. GATE 2024 CS (CS2) Q21 (1 mark, Multiple choice) – Consider two sets. Set X: P. Lexical Analyzer, Q. Syntax Analyzer, R. Intermediate Code Generator, S. Code Optimizer. Set Y: 1. Abstract Syntax Tree,…
  8. GATE 2024 CS (CS2) Q43 (2 marks, Multiple choice) – Consider the expression x[i]=(p+r)*-s[i]+u/w. The triples are: (0) + p r; (1) ?; (2) uminus (1); (3) ?; (4) / u w; (5) + (3) (4); (6) ?; (7) = (6)…
  9. GATE 2024 CS (CS1) Q39 (2 marks, Multiple choice) – Consider the pseudo-code with lines L1: t1=−1; L2: t2=0; L3: t3=0; L4: t4=4*t3; L5: t5=4*t2; L6: t6=t5*M; L7: t7=t4+t6; L8: t8=a[t7]; L9: if t8<=max…