You are on page 1of 2

TRIDENT GROUP OF INSTITUTIONS, BHUBANESWAR

2nd MIDTERM EXAMINATION 2022, 3RD SEMESTER, MCA


SUB-CD
TIME-1HR FULL MARKS-30
SEC-A(Compulsory) 5*2=10marks
1.a)Mention the TAC of the following code segment
int a=0; int b=40;
for(i=0; i<n; i++){
if i<10 then a=b+1; else a=a*a;
}x=a*b;
b) Differentiate between synthesized & inherited attribute
c)Mention the triples of the following expression - (x-y) -(x-y-z) *(x+y+z)
d)Construct the DAG of the following expression A= (B-C)/(B-C)*(A-B-C)
e)Test whether the following grammar is in LL(1) or not
S→ aSa | €
f) Define handle pruning.
g) What are the LR(0) items.
h) What is back patching ?Explain with an example.
i) Why LR parsing is prefer over other parsers ?
j) What is reduce- reduce (R-R) conflict in LR parser .
k) Differentiate between SDD & SDT

SEC-B(Answer any one) 6marks


1.. What are the different Code Optimization techniques used in compilation process to generate
optimized code.
2..What is an Activation Record. Explain all the parameters of an Activation Record.
3..Explain major issues in Code generator phase.
4..Construct a DAG for the following sequence of statements
X=Y/Z
W=P*Y
Y=Y*Z
P=W-X

SEC-C(Answer any one) 16 marks


1.Construct an LALR parsing table for the following grammar.
S → Aa | bAc | dc | bda
A→ d
2. .Construct an SLR parsing table for the following grammar.
S → ( ) | a | (A)
A → S | A,S
3. .Construct an LR(1) parsing table for the following grammar
E → (L) | a
L → L,E | E
TRIDENT GROUP OF INSTITUTIONS, BHUBANESWAR
2nd MIDTERM EXAMINATION 2022, 3RD SEMESTER, MCA
SUB-CD
TIME-1HR FULL MARKS-30
SEC-A(Compulsory) 4*2=8marks
1.a)Mention the TAC of the following code segment
int a=0; int b=40;
for(i=0; i<n; i++){
if i<10 then a=b+1; else a=a*a;
}x=a*b;
b)Mention the triples of the following expression - (x-y) -(x-y-z) *(x+y+z)
c) Define handle pruning
d) What is back patching ?Explain with an example

SEC-B(Answer any one) 1*6=6marks


1.. What are the different Code Optimization techniques used in compilation process to generate
optimized code.
2..Construct a DAG for the following sequence of statements
X=Y/Z
W=P*Y
Y=Y*Z
P=W-X

SEC-C(Answer any one) 1*16=16 marks


1.Construct an LALR parsing table for the following grammar.
S → Aa | bAc | dc | bda
A→ d

2. .Construct an LR(1) parsing table for the following grammar


E → (L) | a
L → L,E | E

You might also like