Gujarat Technological UniversitySummer 2025 Examination

GTU 3170701 Compiler Design (CD) Summer 2025 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 Hours2:30 PM – 5:00 PM
Paper Structure5 QuestionsWith internal OR choices
Jump toQ1Q2Q3Q4Q5

Question 1

14 MarksMedium
(a)
Compare and contrast compilers and interpreters.
3 Marks
(b)
Give the significance of left factoring and explain with an example.
4 Marks
(c)

Explain phases of compiler in context of front end and back end with example. Give the significance of both.

7 Marks

Question 2

14 MarksMedium
(a)
Define following terms.
1)Lexeme
2)Handle pruning
3)Viable prefixes
3 Marks
(b)

Write regular expression over {a,b}

1The set of all strings which starts and ends with different symbols
2The set of all strings having even number of “a”
3The set of all strings having odd number of “b”
4The set of all strings having at least two times “a”
4 Marks
(c)
Construct LL(1) parsing table for the following Grammar:
S -> aABb
A-> c | ε
B-> d | ε
7 Marks
OR OPTION
(c)

Construct NFA for following regular expression using Thompson’s construction and then convert it into DFA. ab(a|b)*ab*.

7 Marks

Question 3

14 MarksMedium
(a)
Differentiate between parse tree and syntax tree
3 Marks
(b)
What is inherited attribute? Explain with suitable example.
4 Marks
(c)
Check whether the following grammar is SLR or not
S -> AaAb | BbBa
A -> ε
B -> ε
7 Marks
OR OPTION
(a)
Compare and contrast SLR and LALR.
3 Marks
(b)
Write down the algorithm for partitioning of basic blocks.
4 Marks
(c)
Explain operator grammar. Generate precedence function table for the
following grammar.
E -> EAE | id
A -> + | *
7 Marks

Question 4

14 MarksMedium
(a)
What is sentinel? Explain with an example.
3 Marks
(b)
Explain Error Recovery Strategies in brief.
4 Marks
(c)

Explain quadruples, triple and indirect triple form of three address code with example.

7 Marks
OR OPTION
(a)
Draw a DAG for expression: a + a * (b – c) + (b – c) * d.
3 Marks
(b)
Explain various parameter passing methods.
4 Marks
(c)

Write syntax directed definition for simple desk calculator. Using this definition, draw annotated parse tree for 7*9+6 n.

7 Marks

Question 5

14 MarksMedium
(a)
What do you mean by dangling references?
3 Marks
(b)

Which are the different conflicts occurs during constructing LR parsing table? Explain in detail.

4 Marks
(c)
Implement the following grammar using Recursive Descent Parser.
S -> Aa | bAc | bBa
A -> d
B -> d
7 Marks
OR OPTION
(a)
Differentiate top down and bottom up parser.
3 Marks
(b)
Write a short note on symbol table.
4 Marks
(c)
What is peephole optimization? Explain with example.
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) (Summer 2025, 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