Skip to content

Compiler Design

CSE · Midterm · Fall 25

Paper 4 of 4Batch 65 · Md. Abdullah Hel BakiSwitch

Batch 65

Paper 4 of 4

This browser can’t show the PDF here

Open it, and your phone’s PDF viewer takes it, or download it.

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: CSE313, Course Title: Compiler Design Level: 3 Term: 1 Batch: 65 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. a) S -> WHP ADJ PUNCT | WH INTENS ADJ PUNCT [5] | CO1 WHP -> why so WH -> why INTENS -> so ADJ -> serious | angry | calm PUNCT -> ! | ? For the input command: "why so serious!", briefly explain whether the given CFG is ambiguous or unambiguous. 2. a) MoodMeter (float joy, float sarcasm, float caffeine) { [6] | CO1 float 1st_Score; Score = joy * Level - sarcasm / 2 + caffeine * 0.5 // target statement print("%f", 1st_Score); } Describe the phases of a compiler for the target statement of the given function. 2. b) Find the type of errors in the above code 2(a) and Why is Symbol Table Correction considered a better error recovery method in semantic analysis, and is there any strategy that works better in certain cases? Justify your answer. [4] | CO1 3. Consider an NFA with the following transition table: State | δ(q,a) | δ(q,b) [CO1] q0 | {q0, q1} | {q0} q1 | {q2} | ∅ q2 | ∅ | {q3} q3 | {q3} | {q3} 3. a) Apply the subset construction method to convert a given NFA into an equivalent DFA. Show the complete subset construction table with all reachable states and draw the state diagram of the resulting DFA. Identify and justify which states in the DFA are the final states. [5] 3. b) Write a regular expression that describes the language accepted by the resulting DFA. Furthermore, explain the relationship between the number of states in the original NFA and the constructed DFA (i.e., why the DFA has fewer, more, or the same number of states) and identify the three main cases of non-determinism that were eliminated during this conversion process. [5]