HT TP: //qpa Pe R.W But .Ac .In: 2010 Language Processor

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Name : ……………………………………………………………

htt
Roll No. : ………………………………………………………..
Invigilator's Signature : ……………………………………….
CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010
p:/
2010
 ANGUAGE PROCESSOR
L
Time Allotted : 3 Hours Full Marks : 70
/q
The figures in the margin indicate full marks.
Candidates are required to give their answers in their own words
pap
as far as practicable.

GROUP – A
( Multiple Choice Type Questions )
er.

1. Choose the correct alternatives for the following :


10 × 1 = 10
wb

i) Does every grammar can be parsed by LL(1) grammar ?

a) Always
ut .

b) Never
a c.

c) Some grammar can be parsed by LL(1) grammar

d) None of these.
in

SE-46 [ Turn over


CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010

ii) Which of the following statements is true ?


htt
a) Every left recursive grammar can be LL(1)

b) No LL(1) grammar can be ambiguous


p:/
c) Both (a) and (b)
/q
d) None of these.

iii) Which of the following is false ?


pap

a) Every SLR(1) grammar is an LR(1) grammar

b) SLR parser may have more states than that of

canonical LR parser
er.

c) Every SLR parser is ambiguous


wb

d) None of these.

iv) In call-by-name

a) the procedure is treated as it were a macro


ut .

b) the local name of the called procedure is kept

distinct from the names of the calling procedure


a c.

c) both (a) and (b)

d) none of these.
in

SE-46 2
CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010

v) Synthesized attributes are calculated


htt
a) from the values of attributes of the children of the

node
p:/
b) from the values of attributes of the parent of the

node
/q
c) from the values of attributes of the siblings of the

node
pap
d) none of these.

vi) The expression wcw where w belongs to { a, b } * is

a) Regular
er.

b) Context free

c) Context sensitive
wb

d) None of these.

vii) In static allocation when the program is compiled


ut .

a) there is no need for a run time support

b) there is need for a run time support


a c.

c) binding changes at run time

d) data structures can be created at run time.


in

SE-46 3 [ Turn over


CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010

viii) Quadruples is a record structure of


htt
a) three fields

b) four fields
p:/
c) one field

d) none of these.
/q

ix) At basis blocks


pap

a) flow of control can halt

b) flow of control can branch except at end


er.

c) both can happen

d) none of these.
wb

x) UD chains can be used to detect

a) loop invariant computation


ut .

b) loop variant computation


a c.

c) both (a) and (b)

d) none of these.
in

SE-46 4
CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010

GROUP – B
htt
( Short Answer Type Questions )
Answer any three of the following. 3 × 5 = 15

2. What is look-ahead operator ? Explain. Why generally


p:/
parsing action is not implemented by finite state machine ?
1 1
32 + 12

3. What do you mean by FIRST(X) and Follow(X) ?


/q
X belongs to ( T union V ) *
pap

T==set of terminaal
1 1
V==set of variable. 22 + 22

4. For the input expression ( 4* 7 + 1 ) *2 construct an


er.

annotated parse tree. 5

5. Describe left recursion and left factoring with suitable


1 1
example. 22 + 22
wb

6. Write short note on peephole optimization.

GROUP – C
ut .

( Long Answer Type Questions )


Answer any three of the following. 3 × 15 = 45
7. a) Describe the role of lexical analyzer.

b) Why generally lexical analyzer phase is separated from


a c.

parsing phase ?

c) What do you mean by Token, Pattern and Lexeme ?

d) Give suitable example. 5+3+5+2


in

SE-46 5 [ Turn over


CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010

8. a) What do you mean by input buffering ?


htt
b) How is input buffering implemented ?

c) What problem can arise implementing input buffering ?


p:/
Give a suitable example.

d) What is sentinel ?
/q
1 1
e) What is its use ? 3 + 4 + 32 + 22 + 2
pap

9. a) What are the roles of the parser ?

b) Suppose S ∅ * xAab. We say that "a" belongs to

FOLLOW(A). At some time during derivation, there have


er.

been symbols between "A" and "a". Then is it right to say

"a" belongs to FOLLOW(A) ?


wb

c) Consider the following grammar :

S ∅ (L)/a
ut .

L ∅ L, S/S

Determine FIRST(S), FIRST(L), FOLLOW(S), FOLLOW(L)


a c.

Is this a ambiguous grammar ?

1 1
d) Describe handle and viable prefix. 32 + 12 + 6 + 2 + 2
in

SE-46 6
CS/B.Tech(CSE)/SUPPLE/SEM-7/CS-701/2010

10. a) With suitable example describe (i) call by value and


htt
(ii) call by reference.

b) What is r-value and what is L-value ?


p:/
c) What is dangling reference ? Give a suitable example.

d) Where is heap allocation needed ? 3+3+3+4+2


/q
11. a) Translate the following expression :

( a + b ) * ( c + d ) + ( a + b + c ) into indirect triples.


pap

b) Construct the dag —

d:=b+c

e:=a+b
er.

b : = b* c

a : = e-d.
wb

c) What are the applications of dag ?

d) Define code optimization using dag representation.


ut .

5+4+2+4
a c.
in

SE-46 7 [ Turn over

You might also like