# GATE Questions & Answers of Intermediate Code Generation

## What is the Weightage of Intermediate Code Generation in GATE Exam?

Total 8 Questions have been asked from Intermediate Code Generation topic of Compiler Design subject in previous GATE papers. Average marks 1.38.

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 assignment form of the above code?

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_________ .

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\ast5+u\ast v/w$ 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 nodes and edges in the control-flow-graph constructed for the above code, 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 = k * 4
t3 = t1 + t0
t4 = t3 + t2
t5 = X[t4]

Which one of the following statements about the source code for the C program is CORRECT?