Compiler Design GATE previous year questions with answer
Ques 27 GATE 2015 SET-2
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
Ques 28 Gate 2015 Set-1
Which one of the following is True at any valid state in shift-reduce parsing?
Ques 29 GATE 2015 SET-1
A variable x is said to be live at a statement Si in a program if the following three conditions hold simultaneously:
i. There exists a statement Sj that uses x
ii. There is a path from Si to Sj in the flow graph corresponding to the program
iii. The path has no intervening assignment to x including at Si and Sj

Ques 30 GATE 2015 SET-1
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 _______.
Ques 31 GATE 2014 SET-3
The primary reason of using intermediate code in compilers is to
Ques 32 GATE 2014 SET-3
Which of the following statements are CORRECT?
1) Static allocation of all data areas by a compiler makes it impossible to implement recursion.
2) Automatic garbage collection is essential to implement recursion.
3) Dynamic allocation of activation records is essential to implement recursion.
4) Both heap and stack are essential to implement recursion.
Ques 33 GATE 2014 SET-3
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
Ques 34 GATE 2014 SET-1
A canonical set of items is given below:
S → L. > R
Q → R.
On input symbol <, the set has
Total Unique Visitors