Gujarat Technological UniversityWinter 2023 Examination

GTU 3170701 Compiler Design (CD) Winter 2023 Paper Solution & PDF

B.E. · Computer Engineering · Semester 7 · Subject Code: 3170701
Download Official GTU PDF
Share:
Total Marks70 MarksExternal theory exam
Passing Marks23 Marks33% minimum cutoff
Exam Duration2.5 Hours10:30 AM – 1:00 PM
Paper Structure5 QuestionsWith internal OR choices
Jump toQ1Q2Q3Q4Q5

Question 1

14 MarksMedium
(a)

Explain the role of linker, loader and preprocessor in the process of compilation.

3 Marks
(b)

Define lexeme, token and pattern. Identify the tokens from the following program segment void change (int c, int d) { int m; m = c; c= d; d = m; }

4 Marks
(c)
Explain the phases of compiler with an example.
7 Marks

Question 2

14 MarksMedium
(a)

Find the Regular Expression corresponding to given statement subset of {0,1}*

1)The Language of all strings containing exactly three 1’s
2)The Language of all strings begins or ends with 00
3)The Language of all strings that contain at least three 1’s
3 Marks
(b)
What is Left Recursion? Give an example for eliminating the same
4 Marks
(c)

Draw DFA for the following regular expression without construction of NFA. ( a | b) * a (a | b)#

7 Marks
OR OPTION
(c)
Explain recursive-descent parsing with suitable example.
7 Marks

Question 3

14 MarksMedium
(a)

Explain the stack implementation of shift reduce parser with the help of example.

3 Marks
(b)
What is inherited attribute? Explain with suitable example.
4 Marks
(c)
Check the following grammar is SLR(1) or not
S → Aa | bAc | Bc | bBa
A → d
B → d
7 Marks
OR OPTION
(a)
Define the following terms:
1)LL(1) Grammar
2)Ambiguous Grammar
3)Operator Grammar
3 Marks
(b)
Find out FIRST & FOLLOW set for all the Nonterminals
S-> 1AB | ϵ
A-> 1AC | 0C
B-> 0S
C->
4 Marks
(c)

Write a syntax directed definition for desk calculator. Using this definition draw annotated parse tree for 6*3+5n

7 Marks

Question 4

14 MarksMedium
(a)
Explain Activation Record
3 Marks
(b)
Explain panic mode and phrase level error recovery techniques.
4 Marks
(c)
Explain quadruple, triple and indirect triple with suitable example.
7 Marks
OR OPTION
(a)
Explain flow graph with suitable example.
3 Marks
(b)
Explain dynamic storage allocation techniques.
4 Marks
(c)

Explain syntax directed definition to produce three address codes for flow of control statements with suitable example.

7 Marks

Question 5

14 MarksMedium
(a)
Draw the parse tree and derive the left most derivation using the following
grammar for the input string: (a + a) * (a * a).
E → E + T | T
T → T * F | F
F → ( E ) | a
3 Marks
(b)
Write down the algorithm for partitioning of basic blocks.
4 Marks
(c)
Explain any four code optimization techniques with suitable example.
7 Marks
OR OPTION
(a)
Explain code scheduling constraints.
3 Marks
(b)
Write short note on LEX.
4 Marks
(c)
Explain the generic issues in the design of code generators.
7 Marks
College Exam Groups

Studying for Compiler Design?

Circulate this solved paper with KaTeX formulas and 1-click AI step solvers to your batchmates on WhatsApp or Telegram.

About this Examination Paper & Attribution

Official Gujarat Technological University (GTU) examination paper and step-by-step solutions for Compiler Design (CD) (Winter 2023, 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.

Download PDF