0% found this document useful (0 votes)
44 views4 pages

Compiler Design - Monowar Hussain

This is question paper of compiler design of ASTU. In case one needed can have a reference material for their semester preparation

Uploaded by

hajowary706
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

Compiler Design - Monowar Hussain

This is question paper of compiler design of ASTU. In case one needed can have a reference material for their semester preparation

Uploaded by

hajowary706
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Total No.

of printed pages = 4
CSE 181601

Roll No. of candidate

2022

B.Tech. 6th Semester End-Termn Examination

COMPILER DESIGN

(New Regulation & New Syllabus)


Full Marks - 70 Time -- Threc hours

The figures in the margin indicate full marks


for the questions.

Answer question No. 1and any four from the rest.


1 Answer the following (MCQ/ Fill in the blanks) : (10 x 1 = 10)

(i) Match the following according to input to the compiler phase that processes
it.
A Syntax Tree Code Generator

B Character Stream II Syntax Analyzer


C Intermediate Representation II SemanticAnalyzer
D Token Stream IV Lexical Analyzer

(a) A -’ II, B ’ III, C ’IV, D’I (b) A ’ II, B ’ I,C ’ III, D -’ IV


(9 A ’ III, B’ IV, C> I,D’II (d) A’I,B ’ IV,C--’ II, D- III
(ii) Which of the following is not an intermediate code form?
(a) Syntax tree (b) Three address code
(c) quadruples (d) Postfix Notation
(iii) Consider the following C program
int main ()

Integer X;
return 0;

[Turn over
Which of the following phases in a seven-phase C compiler will throw an
error?

(a) Lexical Analyzer


(b) Machine Dependent Optimizer
(c) Semantic Analyzer
(d) Syntax Analy zer
(iv) Which of the following errors can a compiler check?
(a) Syntax Error
(b) Both Logical and Syntax Error
(c) Logical Error
(d) Compiler cannot check errors
(v) What is/are the applications of regular expression?
(a) Designing compilers
(b) Simulating sequential circuits
(c) Developing text editors
( All of the above
(vi) The function is automatically generated by the flex when it is
provided with a / file
(a) flex () (r yylex ()
(c) lex () (d) nnlex ()
(vi) Consider the production of the grammar S’ AA A -’ aa A ’ bb Describe
the language specified by the production grammar.
(a) L= (aaaa, aabb, bbaa, bbbb}
(b) L= (abab, abaa, aaab, baaa}
(c) L={aaab, baba, bbaa, bbbb}
(d) L= (aaaa, abab, bbaa, aaab}
(viii)The number of tokens in the following C-code statements are
switch (inputValue)

case 1:a=b*c;
break;
default: a = a++;
break;

(a) 27 (b) 28

(c) 24 (d) 26
2
CSE 181601
(ix) Consider Lhe following grammar S plpqlpqr
Choosing the correct statement for the grammar is
(a) LL(2) (b) LL(4)
(c) LL1) (d) LL(3)
(x) Consider the augmented grammar given below:
S' ’S
S<l>|id
L’L,S|S
Let I, = CLOSURE (IS' ’ S]), the number of items in the, set GOTO(H,,<) is

2.,(9 Explain the basic task of a lexical analyzer in the analysis phase of(7)a
compiler.
Write the rules for computing FIRST(X) and FOLLOW(A). (4+2+2=8)

(ii) Eliminate the left recursion of the grammar E ’ E+ E|E*E\a|b

(iii) Eliminate the ambiguity concerning the dangling else grammar.

3/(a Discuss a Syntax-Directed Translation scheme with an example. (7)

Differentiate following (4+4=8)

(i) Inherited attributes and synthesized attributes

(i) Top down parsing and bottom up parsing


(9)
(a) Construct an SLR parsing table for the following grammar:
R’R|R
,R-’ RR|R*I(R) |a|b
with LALR. (6)
(b) Compare and contrast SLR
(9)
3. (a) Show the following grammar is LALR(1)
S ’ Aal bAcl dc |bda
A -’d

non-kernel items? Give examples. (6)


(b) What do you mean by kernel and
to
optimization technique is locally effective (9)
6. (a) Explain how a peephole
improve the target code.
(6)
(b-c) *d
(b) Constructa DAG for the expression: a+a *(b-c) + (Turn over
CSE 181601 3
7/ (a) Generate three-address code of the following Cassignment statements then
Convert your three-address code into machine code. You may use as many
registers as you need. x =al(b+ c) -d* (e +f; (9)
Lb) What is the role of the symbol table in the compilation process? Explain in
brief. (6)

CSE 181601 4

You might also like