Intermediate Code & Optimization
GATE CSE & IT · 22 questions across 10 years (1994-2025) · 25% recurrence rate
Recurrence sparkline
1994–2025Difficulty mix
Question types
All 22 questions on Intermediate Code & Optimization
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) $$\begin{aligned} & \text { 1001: } \mathrm{i}=1 \\ & \text { 1002:...
Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Consider the following expression: $x[i] = (p + r) * -s[i] + \frac{u}{w}$. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6). (0) + p r...
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 L10: t1 = t8 L11: t3 = t3 + 1 L12: if t3 L13: t2 = t2 + 1 L1...
Consider the following two sets: Set X P. Lexical Analyzer Q. Syntax Analyzer R. Intermediate Code Generator S. Code Optimizer Set Y 1. Abstract Syntax Tree 2. Token 3. Parse Tree 4. Constant Folding Which one of the fol...
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
For a statement S in a program, in the context of liveness analysis, the following sets are defined: USE(S): the set of variables used in S IN(S): the set of variables that are live at the entry of S OUT(S): the set of v...
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 -> f2; } else { p = p + y -> f2; q = q + x + 3; } } Assume that the variab...
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 acyclic graph (DAG). The number of nodes of nodes in...
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 segment to static single assignment form is .
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) i=i+1 (11) if i<5 goto (2) The number of n...
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 + u * v/w$$ is _______________.
Match the following: GROUP 1 GROUP 2 P. Lexical analysis 1. Graph coloring Q. Parsing 2. DFA minimization R. Register allocation 3. Post-order traversal S. Expression evaluation 4. Production tree
In the context of abstract-syntax-tree $$(AST)$$ and control-flow-graph $$(CFG),$$ which one of the following is TRUE?
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 the above basic block respectively are
Which one of the following is FALSE?
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 8 bits. t0 = i * 1024 t1 = j * 32 t2...
One of the purposes of using intermediate code in compilers is to
The program below uses six temporary variables a, b, c, d, e, f. a = 1 b = 10 c = 20 d = a + b e = c + d f = c + e b = c + e e = b + f d = 5 + e return d + f Assuming that all operations take their operands from register...
Some code optimizations are carried out on the intermediate code because
Consider the following C code segment. for (i = 0; i < n; i++) { for (j=0; j < n; j++) { if (i%2) { x += (4*j + 5*i); y += (7 + 4*j); } } } Which one of the following is false ?
Generation of intermediate code based on an abstract machine model is useful in compilers because