Gujarat Technological UniversitySummer 2024 examination

GTU 2170701 Compiler Design (CD) Summer 2024 Question Paper & PDF

B.E. · Computer Engineering · Semester 7 · Subject code 2170701
Download official PDFView PDF here
Share with your class
Total
70 marks
To pass
23 marks (33%)
Duration
2.5 Hours 2:30 PM – 5:00 PM
Questions
5 with internal choice
No solutions on this paper yetNeed them for your exam? Ask once. Papers that students ask for are solved first, and we aim to add them within 24 hours.

12 of 25 questions on this paper were also asked in other years. 1 more is a type of question GTU sets again with new data. Each is marked below with the years it appeared.See all 28 repeated 2170701 questions, most asked first

Q.1

14 Marks
(a)
3 marks
Compare and contrast compilers and interpreters.
(b)
4 marks
Explain in detail LEX Specification.
(c)
7 marksAsked in 4 of 4 papers
Explain Phases of Compilers with suitable example.

Also asked in Summer 2026 Q1c, Winter 2025 Q1c, Summer 2025 Q1c

Q.2

14 Marks
(a)
3 marks
Describe language denoted by the following regular expression :
i)0 (0|1)*0
ii)((ε|0)1*)*
(b)
4 marksAsked in 2 of 4 papers
Draw transition diagram for following tokens.
i)Relop
ii)Identifier
iii)Unsigned number
iv)Whitespace

Also asked in Summer 2025 Q1b

(c)
7 marksAsked in 4 of 4 papers
Write the two methods used in lexical analyzer for buffering the input.

Which technique is used for speeding up the lexical analyzer?

Also asked in Summer 2026 Q5b OR, Winter 2025 Q2c OR, Summer 2025 Q2a

(c)
7 marksSame type asked in 2 of 4 papers

Construct nondeterministic finite automata for following regular expression using Thomson‟s Construction. Show the sequence of moves made by each in Processing the input string ababbab. (a|b)*

Also asked in Summer 2026 Q2c OR

Q.3

14 Marks
(a)
3 marks
Consider the grammar
S->aSbS|bSaS|ε
i)Show that this grammar is ambiguous by constructing two different leftmost derivations for the sentence abab.
ii)Construct the corresponding rightmost derivations for abab.
iii)Construct the corresponding parse trees for abab.
(b)
4 marks
Define: Left Recursive Grammar. Check Following grammar is left
recursive or not, if yes, Remove left recursive from it.
S→aBDh
B→Bb|c
D→EF
E→g| ε
F→f| ε
(c)
7 marks
Construct CLR Parsing table for the following grammar.
S→CC
C→cC|d
(a)
3 marks
Explain following terms:
i)Ambiguous grammar
ii)Left-Factoring grammar
(b)
4 marksAsked in 2 of 4 papers
Write a difference(s) between CLR, SLR and LALR methods.

Also asked in Summer 2025 Q3b OR

(c)
7 marksAsked in 3 of 4 papers
Explain operator precedence parsing method with example.

Also asked in Summer 2026 Q4c OR, Summer 2025 Q3c

Q.4

14 Marks
(a)
3 marks
Construct the dag for following arithmetic expression: a+a+(a+a+a)
(b)
4 marksAsked in 3 of 4 papers
Discuss synthesized and inherited attributes using a suitable grammar.

Also asked in Summer 2026 Q3b, Summer 2025 Q4b OR

(c)
7 marks
For the input expression (4*7+1)*2, construct on annotated Parse tree
according to the syntax directed definition of figure given below.
Production Semantic Rules
L->En Print(E.val)
E->E1+T E.val:=E.val+T.val
E->T E.val:=T.val
T->T1 *F T.val:= T1.val * F.val
T->(E) T.val:=E.val
F->digit F.val:=digit.lexval
T->F T.val:=F.val
(a)
3 marksAsked in 2 of 4 papers
Explain dynamic memory allocation strategy.

Also asked in Summer 2025 Q5b OR

(b)
4 marks
Explain performance for bottom up evaluation of an inherited attributes.
(c)
7 marksAsked in 3 of 4 papers
Explain various parameter passing methods.

Also asked in Summer 2026 Q4b, Summer 2025 Q4b

Q.5

14 Marks
(a)
3 marksAsked in 3 of 4 papers

Explain activation record. How is task divided between calling & called program for stack updating?

Also asked in Winter 2025 Q4b, Summer 2025 Q5b

(b)
4 marksAsked in 2 of 4 papers
Explain any two code optimization methods with examples.

Also asked in Summer 2026 Q5c OR

(c)
7 marks

What is Intermediate form of the code? What are the advantages of it? What are generally used intermediate forms? Write three address code for following expression. (a+b)*(c+d)

(a)
3 marks
How symbol table differs from other data structures?
(b)
4 marksAsked in 2 of 4 papers
Compare: Static v/s Dynamic Memory Allocation.

Also asked in Summer 2025 Q5a

(c)
7 marksAsked in 4 of 4 papers
Explain various issues in design of code generator.

Also asked in Summer 2026 Q5c, Winter 2025 Q5c OR, Summer 2025 Q4c OR

More Compiler Design papers

Questions repeat across sessions. Working through two or three papers shows you which topics GTU asks most.

Preparing with friends?

Send this paper to your class group. Every question has its own link.

About this paper

Official Gujarat Technological University (GTU) examination paper for Compiler Design (CD) (Summer 2024, B.E. · Computer Engineering, Sem 7). Features complete 70-mark regular & remedial examination pattern, official marking distribution across all 5 questions, and direct 1-click official PDF download.

Transcribed for student exam preparation from Gujarat Technological University official examination archives. Questions, syllabus guidelines, and curriculum marking schemes remain the intellectual property of Gujarat Technological University.

ViewDownload PDF