You are on page 1of 4

Reg No

NEHRU INSTITUTE OF ENGINEERING AND TECHNOLOGY


An ISO 9001:2015 & ISO 14001:2015 Certified Institution, Affiliated to Anna University, Chennai
Approved by AICTE, New Delhi, Recognized by UGC with 2(f) & 12(B)
Re-accredited by NAAC “A+”, NBA Accredited (UG Courses): AERO | CSE
Nehru Gardens, Thirumalayampalayam, Coimbatore – 641 105.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


B.E./ B.Tech.(Full Time) –Internal Assessment Test-I, September 2023
REGULATION - 2021
SUB CODE & NAME: CS3501 & COMPILER DESIGN SET: II

Course Instructor : S. Priya Portion : 2.5 Units


Year / Semester : III/ V Date / Session : 21.09.2021/ FN
Duration : 180 minutes Max. Marks : 100

Knowledge Level K1: Remembering K2: Understanding K3: Applying K4: Analyzing K5: Evaluating K6: Creating
C302.1 Analyze the different phases of compiler.
Course
Outcomes
C302.2 Design a lexical analyzer for a sample language.
C302.3 Analyze the intermediate code.

PART –A (10×2 = 20 Marks)


Answer ALL questions
Knowledge Level /
Q.No Questions Marks Course Outcomes
1. Tell the general phases of a compiler 2 K1/C302.1
2. What is Lexical Analysis? 2 K1/C302.1
3. Construct Regular expression for the language L= {w ε{a,b}/w ends in abb} 2 K2/C302.1
4. Outline what are the Error-recovery actions in a lexical analyzer? 2 K2/C302.1
5. List the factors to be considered for top down parsing 2 K1/C302.2
6. Find the parse tree of (a+b)*c for the grammar E-> E+E/E*E/(E)/ id 2 K1/C302.2
7. Show the benefits of LR parsers. 2 K2/C302.2
8. Show about the precedence functions. 2 K2/C302.2
9. List the syntax directed definition 2 K1/C302.3
10. What is three address code? 2 K1/C302.3

PART-B (5×13 = 65 Marks)


Knowledge Level /
Q.No Questions Marks Course Outcomes
11 a. Recalle the various phases of compiler with suitable example. 13 K1/C302.1
(Or)
11 b. How a finite automaton is used to represent tokens and perform lexical analysis with
examples. Compare and Contrast NFA and DFA.
13 K1/C302.1
12 a. Outline about the Lexical errors. Divide the following C++ program : float limited
Square(x) float x; /* returns x-squared, but never more than 100 */ return (x<= –10.0||
x>=10.0)?100 : x*x into appropriate lexemes. Which lexemes should get associated 13 K2/C302.1
lexical values ? What should those values be ?

(Or)
12 b. Outline a transition diagrams. Explain briefly how the keywords and identifiers are 13 K2/C302.1
recognized using a running example.

13 a. (i)Make use of an ambiguous and un ambiguous grammar? Identify the following


grammar is ambiguous or not. E→E+E | E*E | (E)|-E |id for the sentence id+id*id

(ii) Prepare the following grammar is LL(1) but not SLR(1). S→AaAb | BbBa A→€
7+6 K3/C302.2
B→€

(Or)
13 b. Select the grammar S → ABD, A → a | Db | ε, B → gD |dA | ε , D → e | f i) Construct
FIRST and FOLLOW for each nonterminal of the above grammar. ii) Construct the
predictive parsing table for the grammar. iii) Show the parsing action on a valid string 13 K3/C302.2
and on an invalid string iv) Check whether the grammar is LL (1). Give justification.

14 a. Assume the following CFG E→E or T|T T→T and F|F F→not F|(E)|true |false Write
the semantic rules and explain the processes converting “not (true or false)” to
13 K4/C302.2
intermediate form using Parser tree method.

(Or)
14 b. Assume the following grammar and construct SLR parser. E → E + T/T, T → T * F|F,
F → (E) |id. 13 K4/C302.2

15 a. Explain the following in detail about the Syntax Directed Definitions.

(i)Inherited Atrributes and Synthesized attributes. (ii) Evaluate SDD of a parse tree.
13 K5/C302.3

(Or)
15 b. (i).Explain the common three address instruction forms.

(ii). Explain the two ways of assigning labels to the following three address statements 7+6 K5/C302.3
Do i=i+1; While (a[i]<v);

PART-C (1×15 = 15 Marks)


Knowledge Level /
Q.No Questions Marks Course Outcomes
16 a. i) Show the languages denoted by the following regular expressions
a) (a|b)*a(a|b)(a|b)
6 K1/ C302.1
b) a*ba*ba*ba*
c) !! (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)*
ii) show out the different error recovery strategies. Explain them. 6 K2/ C302.2
iii) Plan in detail about Dependency graph. 3 K3/ C302.3
(Or)

16 i) Relate the Minimize DFA using Thompson Construction ( a / b ) * a b b ( a / b ) *


6 K1/ C302.1
.
ii) Demonstrate the SLR (1) parser. Describe the Steps for the SLR parser. 6 K2/ C302.2
iii) Organize in detail about Ordering Evaluation of Attributes. 3 K3/ C302.3

Course Coordinator Exam cell HoD


Vision : To Produce highly competent and innovative computer professionals to meet the global demands
Mission :To impart quality education by creative teaching learning process
To be technically competent, ethical and socially responsible throughout the professional career
To inculcate leadership qualities and entrepreneurship culture to meet the global standards
CHECK LIST / DECLARATION TO BE FILLED BY THE QUESTION PAPER SETTER
NAME OF THE FACULTY MEMBER : Ms. S. Priya REGULATION : 2021
BRANCH : BE., CSE
COURSE CODE & TITLE : CS3501 Compiler Design MONTH & : Sept & 2023
YEAR
1 Particulars regarding Regulations, Programme, Branch, Semester, Subject Code & Subject Title, Duration and
Maximum Marks is clearly printed.
2 Marks for each question and / or sub – division is clearly indicated
3 Questions are evenly distributed over all the units, proportionate to the number of hours for each unit mentioned in
the syllabus
4 All the questions are within the prescribed syllabus
5 All the figures / tables are correctly numbered and the text associated with the figures / tables are readable
6 For each Question CO, K are clearly specified
7 The key for the question paper is enclosed
8 List of Tables / Charts permitted is clearly specified. (if yes, please indicate the list of tables / charts permitted in
the space given below)
Name of the Table Charts to be used :…………………….
Recommended Distribution of percentage of Marks:
Level of Questions Lower Oder Intermediate Order Higher Order
(K1 and K2) (K3 and K4) (K5 and K6)

Recommended Distribution
UG 50% - 60% 30% - 50% 10% - 15%
of Marks (%)
Checklist of Mark Distribution:

Q. No Marks / Course Outcome Marks / Blooms Taxonomy


C30X.1 C30X.2 C30X.3 C30X.4 C30X.5 K1 K2 K3 K4 K5 K6
1 2 2
2 2 2
3 2 2
4 2 2
5 2 2
6 2 2
7 2 2
8 2 2
9 2 2
10 2 2
11 a
13 13
11 b
12 a
13 13
12 b
13 a
13 13
13 b
14 a
13 13
14 b
15 a
13 13
15 b
16 a
6 6 3 6 3 6
16 b
Total 20 40 40 K1+K2= K3+K4= K5+K6=
Mark
Distribution in 40% 40% 20% -
(%)
I certify that the question paper is correct with respect to the aspects / parameters given above.

Date: Signature

Scrutiny and Evaluation Committee HOD

You might also like