Time Left - 15:00 mins
GATE CS 2022 : Compiler design Quiz -6
Attempt now to get your rank among 171 students!
Question 1
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
T1=a+b
T2=T1+c
T3=T1*T2
T4=2*T3
T5=T4+d
T6=T5+T4
Question 2
In control flow analysis, control flow graph contain basis blocks for the code.
A basic block is a segment of the code that a program must enter at the beginning and it can exit only at the end. A basic block ends in which of the following ways?
A basic block is a segment of the code that a program must enter at the beginning and it can exit only at the end. A basic block ends in which of the following ways?
Question 3
Consider the following C code
main()
{
int c =0, z=1;
char *p;
for(z=1;z<100;z++)
{
printf(“%d”,z);
}
c=c+20;
}
Find an induction variable in the above code?
main()
{
int c =0, z=1;
char *p;
for(z=1;z<100;z++)
{
printf(“%d”,z);
}
c=c+20;
}
Find an induction variable in the above code?
Question 4
Consider the following quadruple notation table for the 3 address code given as -
Match the following S1,S2,S3 & S4 with the correct expression formed using the above table ?
LIST – I
i. S1=/, S2=c, S3=+, S4=x
ii. S1=+, S2=c, S3=/, S4=x
iii. S1=+, S2=x, S3=/, S4=c
LIST – II
a) c=a+b/x*a+b
b) x=a/b+c*a/b
c) x=a+b/c*a+b
Match the following S1,S2,S3 & S4 with the correct expression formed using the above table ?
LIST – I
i. S1=/, S2=c, S3=+, S4=x
ii. S1=+, S2=c, S3=/, S4=x
iii. S1=+, S2=x, S3=/, S4=c
LIST – II
a) c=a+b/x*a+b
b) x=a/b+c*a/b
c) x=a+b/c*a+b
Question 5
Which of the following is/are used for intermediate code generation?
(i) Syntax trees
(ii) DAG
(iii) Three address code
(iv) Postfix notation
Question 6
An intermediate code can be represented as:
- 171 attempts
- 0 upvotes
- 1 comment
Tags :
GATE & PSU CSGeneralOct 23GATE & PSU CS