Compiler Design · Previous year questions
Intermediate Code Generation, Data Flow Analysis and Code Optimization
32 questions from GATE CS 2011 to 2026, newest first.
Questions
GATE CS 2026 Set 1, Q.42
Consider the control flow graph shown in the figure. Control flow graph with ENTRY leading to basic block B1 (a = b + i), which branches to B2 (a = g * k; f = d - f; a = c * 4)...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2026 Set 2, Q.45
Consider the control flow graph given below. Control flow graph with ENTRY leading to basic block B1 (a = b + c); B1 branches to B2 (d = a + e) and B3 (e = a + f); B3 loops back...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2025 Set 1, Q.13
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2025 Set 1, Q.52
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) 1001: i = 1 1002: j = 1 10...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2025 Set 2, Q.21
Consider the following statements about the use of backpatching in a compiler for intermediate code generation: (I) Backpatching can be used to generate code for Boolean express...
Intermediate Code Generation, Data Flow Analysis and Code Optimization · Syntax-Directed Translation
GATE CS 2024 Set 1, Q.39
Consider the following pseudo-code. 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 goto L11 L...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2024 Set 2, Q.21
Consider the following two sets: Set X Set Y P. Lexical Analyzer 1. Abstract Syntax Tree Q. Syntax Analyzer 2. Token R. Intermediate Code Generator 3. Parse Tree S. Code Optimiz...
Lexical Analysis · Parsing and Syntax Analysis (LL and LR) · Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2024 Set 2, Q.43
Consider the following expression: . The following sequence shows the list of triples representing the given expression, with entries missing for t...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2023, Q.11
Consider the following statements regarding the front-end and back-end of a compiler. S1: The front-end includes phases that are independent of the target hardware. S2: The back...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2023, Q.37
Consider the control flow graph shown. Control flow graph with basic blocks B1 (i = m - 1, j = n, a = 10), B2 (i = i + 1, j = j - 1), B3 (a = 20), and B4 (i = a + 1), edges ENTR...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2021 Set 1, Q.60 (CS Q.50)
Consider the following C code segment: a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f; In a compiler, this code segment is represented internally as a directed a...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2021 Set 2, Q.13 (CS Q.3)
Consider the following ANSI C program: int main() { Integer x; return 0; } Which one of the following phases in a seven-phase C compiler will throw an error?
Parsing and Syntax Analysis (LL and LR) · Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2021 Set 2, Q.23 (CS Q.13)
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2021 Set 2, Q.40 (CS Q.30)
Consider the following ANSI C code segment: z = x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2;...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2021 Set 2, Q.48 (CS Q.38)
For a statement in a program, in the context of liveness analysis, the following sets are defined: …
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2018, Q.18 (CS Q.8)
Which one of the following statements is FALSE?
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2017 Set 1, Q.12 (CS Q.12)
Consider the following intermediate program in three address code: p = a - b q = p * c p = u * v q = p + q Which one of the following corresponds to a static single assi...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2017 Set 1, Q.43 (CS Q.43)
Consider the following grammar: stmt -> if expr then expr else expr; stmt | 0 expr -> term relop term | term term -> id | number id -> a | b | c number -> [0-9] where…
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2017 Set 1, Q.52 (CS Q.52)
Consider the expression . Let be the minimum number of registers required by an optimal code generation (without any register spill) algorithm...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2016 Set 1, Q.29 (CS Q.19)
Consider the following code segment. x = u - t; y = x * v; x = y + w; y = t - z; y = x * y; The minimum number of total variables required to convert the above code...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2015 Set 1, Q.60 (CS Q.50)
A variable is said to be live at a statement in a program if the following three conditions hold simultaneously: i. There exists a statement that uses ii. Th...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2015 Set 1, Q.65 (CS Q.55)
The least number of temporary variables required to create a three-address code in static single assignment form for the expression is _____.
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2015 Set 2, Q.24 (CS Q.14)
In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2015 Set 2, Q.29 (CS Q.19)
Match the following compiler phases / tasks with their underlying algorithmic techniques: List-I P. Lexical analysis Q. Parsing R. Register allocation S. Expression evaluati...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2015 Set 2, Q.39 (CS Q.29)
Consider the intermediate code given below. (1) i = 1 (2) j = 1 (3) t1 = 5 * i (4) t2 = t1 + j (5) t3 = 4 * t2 (6) t4 = t3 (7) a[t4] = -1 (8) j = j + 1 (9) if j<=5 goto (3) (10)...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2014 Set 1, Q.27 (CS Q.17)
Which one of the following is FALSE?
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2014 Set 2, Q.44 (CS Q.34)
For a C program accessing
X[i][j][k], the following intermediate code is generated by a compiler. Assume that the size of an integer is 32 bits and the size of a character is...Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2014 Set 3, Q.27 (CS Q.17)
One of the purposes of using intermediate code in compilers is to
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2014 Set 3, Q.44 (CS Q.34)
Consider the basic block given below. a = b + c c = a + d d = b + c e = d - b a = e + b The minimum number of nodes and edges present in the DAG representation of th...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2013, Q.48 (CS Q.48)
Suppose the instruction set architecture of the processor has only two registers. The only allowed compiler optimization is code motion, which moves statements from one place to...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2013, Q.49 (CS Q.49)
What is the minimum number of registers needed in the instruction set architecture of the processor to compile this code segment without any spill to memory? Do not apply any op...
Intermediate Code Generation, Data Flow Analysis and Code Optimization
GATE CS 2011, Q.36 (CS Q.36)
Consider evaluating the following expression tree on a machine with load-store architecture in which memory can be accessed only through load and store instructions. The variabl...
Intermediate Code Generation, Data Flow Analysis and Code Optimization