0% found this document useful (0 votes)
28 views3 pages

QP CD Model Set1 Bsec

Uploaded by

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

QP CD Model Set1 Bsec

Uploaded by

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

SET I

Roll No.
ARASU ENGINEERING COLLEGE, KUMBAKONAM-612
501 DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING

MODEL EXAMINATION
Year/Sem./Branch : III / V / CSE-B Max. Marks : 100
Sub. Code & Name : CS3501 – COMPILER DESIGN Duration : 3 hours
Date & Session : 14.11.2024 & AN

The Model Examination is used to assess the course outcomes CO1 to CO5, Lower Order Thinking
(LOT) and Higher Order Thinking (HOT) of the course.

K1 – Remembering K2 – Understanding. K3 – Applying.


K4 – Analyzing. K5 – Evaluating. K6 – Creating

COURSE COURSE OUTCOMES (COs)


CODE
C302.1 Understand the techniques in different phases of a compiler.
C302.2 Design a lexical analyzer for a sample language and learn to use the LEX tool.

C302.3 Apply different parsing algorithms to develop a parser and learn to use YACC
tool
Understand semantics rules (SDT), intermediate code generation and run-time
C302.4
environment.
C302.5 Implement code generation and apply code optimization techniques.

Answer all the Question


PART – A (10X2=20 Marks)
1. State some software tools that manipulate source code. [CO1,LOT,K1]
2. Define Finite automata. [CO1,LOT,K1]
3. Define parser. [CO2,LOT,K1]
4. What does dangling reference mean? [CO2,LOT,K1]
5. Define symbol table. [CO3,LOT,K1]
6. List the three kinds of intermediate representation. [CO3,LOT,K1]
7. What is the use of run time storage? [CO4,LOT,K1]
8. What is an activation record? [CO4,LOT,K1]
9. List the advantages and applications of DAG. [CO5,LOT,K1]
10. List the properties of an ‘optimizing compiler’. [CO5,LOT,K1]
PART – B (5X13=65 Marks)
11. a. Describe the various phases of compiler with suitable [CO1,HOT,K6]
example.
(or)
b. i) Explain the role of lexical analyzer. (6) [CO1,HOT,K5]
ii) Write brief note on specification of tokens with (7) [CO1,HOT,K4]
suitable examples.

12. a. Discuss the LL(1) parsing algorithm with an example. [CO2,HOT,K6]


(or)
b. Construct SLR parser for the following ambiguous [CO2,HOT,K6]
grammar.
E→ E+E
E→ E*E
E→(E) | id
i/p: id*id+id

13. a. Discuss the following in detail about the Syntax


[CO3,HOT,K4]
Directed Definitions.
(i) Inherited attributes and synthesized attributes.
(ii) Evaluate SDD of a parse tree for the expression [CO3,HOT,K5]
(4+7.5*3)/2
(or)
b. Translate the following switch statement into [CO3,HOT,K6]
intermediate code.
switch E
begin
case V1 :S1
case V2 : S2
case Vn-1: Sn-1
default: Sn
end

14. a. Elaborate on the storage allocation strategies. [CO2,HOT,K6]


(or)
b. Illustrate the algorithm that generates code for a single [CO2,HOT,K4]
basic block with three address instructions.

15. a. Explain peephole optimization with suitable [CO5,HOT,K5]


examples.
(or)
b. Discuss the principle sources of optimization. [CO5,HOT,K6]
Part – C (1 X 15 = 15 Marks)
16.a. Consider the following basic block, in which all [CO5,HOT,K5]
variables are integers and ** denotes exponentiation.
a := x**2
b := 3
c := x
d := c*c
e := b*2
f := a+d
g :=e*f
Apply the following optimization techniques to this
basic block, in order to compute the results of each
transformation. (3)
i) Algebraic simplification. (3)
ii) Copy propagation. (3)
iii) Constant folding. (3)
iv) Dead code elimination. (3)
v) Common sub expression elimination.
(or)
b. Check whether the following grammar can be [CO2,HOT,K6]
implemented using predictive parser. Check whether
the string “(a,a)” is accepted or not using predictive
parsing.
S->(L)|a
L->L,S|S

You might also like