Time Left - 15:00 mins

GATE 2024 Compiler Design Foundation Quiz 47

Attempt now to get your rank among 44 students!

Question 1

The number of vertices (excluding starting and exit block) in control flow graph of the following code is:

1) a=b+c

2) if(a) goto 5

3) e =a+d

4) goto 6

5) f= a*g

6) h= m*n

Question 2

Which of the following is not a machine-independent code optimization technique?

Question 3

Which of the following are correct?

1) Control stack keeps track of live procedure activations

2) Activation records can be managed with the help of stack

3) Dangling reference is a reference to storage that has been deallocated.

Question 4

Consider the intermediate code given below :

K=1

L2:S=1

L1:R1=8*K

R2=R1 + S

R3= 8* R2

B[R3]= 3

S++

IF S<=2 GOTO L1

K++

IF K<7 GOTO L2

The number of nodes and leaders in the control flow graph for the above code(written without spaces and in order) is?

Question 5

How many times the activation record of the functions will be pushed – poped onto the stack for the execution of the following program?

int main()

{

int n , b;

printf("Enter the number");

scanf("%d",&n);

b= A(n);

printf("%d",b);

return 0;

}

A(int n)

{

if(n==1)

return 1;

else

return 1+A(n/2);

}

Where the value of n is entered as 512

  • 44 attempts
  • 0 upvotes
  • 0 comments
Apr 28GATE & PSU CS