Intermediate Code Generation: GATE CS Previous Year Questions

Intermediate Code Generation · Compiler Design

32 questions · asked in 16 of 27 years (2000–2026)

MCQ 26 · MSQ 1 · NAT 51-mark 13 · 2-mark 19

2000Questions per year2026

Questions 16–20 of 32

Q16GATE 2016 (Session 1)1 markNAT
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__________ .

Q17GATE 2015 (Session 1)2 marksMCQ−0.67 if wrong
A variable x is said to be live at a statement SiS_{i} in a program if the following three conditions hold simultaneously:
i. There exists a statement SjS_{j} that uses x
ii. There is a path from SiS_{i} to SjS_{j} in the flow graph corresponding to the program
iii. The path has no intervening assignment to x including at SiS_{i} and SjS_{j}
p = q + rs = p + qu = s * v v = r + uq = s * uq = v + r 1234
The variables which are live both at the statement in basic block 2 and at the statement in basic block 3 of the above control flow graph are

Q18GATE 2015 (Session 1)2 marksNAT
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 _______________.

Q19GATE 2015 (Session 2)1 markMCQ−0.33 if wrong
In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?

Q20GATE 2015 (Session 2)2 marksMCQ−0.67 if wrong
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≤\leq5 goto (3)
(10) i=i+1
(11) if i<\lt5 goto (2)
The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, are

Keep practising

Topics in Compiler Design

All CS topics ›