Time Left - 10:00 mins

GATE CS 2018 - Compiler Design Quiz- 5 (Intermediate Code generation)

Attempt now to get your rank among 416 students!

Question 1

Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is _____.

Question 2

The least number of temporary variables required to create a three-address code in static single assignment form for the expression q + r / 3 + st * 5 + u * v /wis _____________.

Question 3

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

Question 4

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

Question 5

Consider the following assembly code
MOV R1,b ; R1b
MOV R2,c ;
MUL R1,R2 ;
MOV t1,R1 ;
MOV R1,a ;
MOV R2,t1 ;
ADD R1,R2 ;
MOV t2,R1 ;
MOV R1,t2 ;
MOV d,R1 ;
Find the correct expression which is equivalent to the above code.

  • 416 attempts
  • 0 upvotes
  • 4 comments
Apr 12GATE & PSU CS