Time Left - 15:00 mins

GATE CS 2021 : Compiler Design Quiz 7

Attempt now to get your rank among 567 students!

Question 1

Consider the following syntax tree for the expression :
((a+b)-((b+a)*(a-b) ) )+((a-b)*(a+b) )

The letters A through I are used to name the nodes, and are not part of the expression tree. The operator labels of the interior nodes are the +, -, or * adjacent to the nodes. Assume that + and * are commutative operators, although - is not. Construct the expression DAG from this tree, treating + and * as commutative.
Which of the following statements is TRUE(T)/FALSE(F) about which nodes will be combined?
(i) B and C will be combined
(ii) D and H will be combined
(iii) E and C will not be combined
(iv) F and I will not be combined
(v) I and G will not be combined

Question 2

During intermediate code generation , we use 3 - address code in which we have 3 forms available : Quadruples , Triples and Indirect Triples. Now consider the below statements :

S1 : In Quadruples , statements can be moved around

S2 : In Triples , space is not wasted.

S3 : In Indirect Triples , space is not wasted but access time increases.

Which is correct ?

Question 3

Find the minimum number of temporary variable which is used to represent the following 3 address code in the optimized manner -
T1=a+b
T2=T1+c
T3=T1*T2
T4=2*T3
T5=T4+d
T6=T5+T4

Question 4

One of the purposes of using intermediate code in compilers is to

Question 5

Which of the following is the machine dependent phase of compiler?

Question 6

What is the equivalent 3-address code for the above DAG?
  • 567 attempts
  • 4 upvotes
  • 5 comments
Apr 10GATE & PSU CS