Compiler Design
CSE · Midterm · Fall 25
Paper 2 of 4Batch 63 · H@DY_222Switch
Batch 63
Paper 2 of 4
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Computer Science & Engineering
Mid Examination, Fall 2025
Course Code: CSE331, Course Title: Compiler Design
Level: 3 Term: 2 Batch: 63
Time: 01:30 Hrs
Marks: 25
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1. S -> NP VP
NP -> Det N | NP PP
VP -> V NP | V NP PP
PP -> P NP
Det -> the | a
N -> man | telescope
V -> saw
P -> with
For the input sting: "I saw the man with a telescope", justify whether the CFG is ambiguous or not. [5] CO1
2. #includ<stdio.h>
int main() {
in a=5, b=10, c=15, d=20;
result = a*10% + b*25% + c*25/100 +d*40/100; //target statement
printf("Result: %f" result);
return 0
}
a) Describe the phases of a compiler for the target statement of the given function. [6] CO1
b) Find the type of errors in the above code and explain how panic mode method can recover from the errors. [4] CO1
3. a) Three students from Daffodil International University are traveling home for vacation by airplane. Their smartwatches track their movements through various locations on the way to the airport. The travel routes are described below:
Student 1: Started from the University Campus (UC), walked to the Akran Bazar (AB), then took an auto-rickshaw to Birulia Bazar (BB), then a rickshaw to Metro Station (MS), passed through Kuril (KL) and reached the Airport (AP) by bus.
Student 2: Left University Campus (UC), took a pathao ride to Ashulia (AL), proceeded to Uttara (UT), then a rickshaw to Metro Station (MS), passed through the Kuril (KL) area and reached the Airport (AP) using a leguna service.
Student 3: Started from the University Campus (UC), took a cab to Kuril (KL) to meet a friend, then a rickshaw to Khilket (KK) area and finally went to the Airport (AP) and then took a flight to Rangpur (RP).
Design an FSM that models the travel paths of all three students. [5] CO1
b) If the 3(a) FSM is an NFA, convert it into a DFA. [5]