Skip to content

Compiler Design

CSE · Midterm · Spring 26

Paper 1 of 3Batch 66 · Md. Ferdous Foysal HridoySwitch

Batch 66

Paper 1 of 3

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 Midterm Examination, Spring 2026 Course Code: CSE313, Course Title: Compiler Design Level: 3 Term: 1 Batch: 66 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) Consider the following CFG: S -> if (E) then S | if (E) then S else S | x = E; E -> true | false Explain whether the grammar is ambiguous or not for the below input string: if (true) then if (false) then x = true; else x = false; Marks: [5] | CO1 2. a) int compute (float a, float b, float c, float d) { float result; result = a + 4 * (c - d) - ((a + c) - b) * d; //2nd statement return result; } Illustrate the phases of a compiler for the 2nd statement of the given function. Marks: [6] | CO1 2. b) int analyzeData(int x, int y) { int total; to@tal = x + y * 5; total = x + * y; int temp temp = unknown + 10; if (x > y && x < y) { total = x - y } retrun total; } Classify the errors in the above code, and explain how panic-mode error recovery would handle the errors in this program. Marks: [4] 3. a) Suppose the regular expression represents all strings over the alphabet {a, b} that contain an a, followed by either a or b, then followed by another a, with zero or more instances of a's or b's allowed at the beginning and ending of this pattern. Construct the FSM for the given RE and Identify the tuples from FSM. Marks: [4] | CO2 3. b) If the FSM is an NFA, convert it into a DFA. and make a decision if it accepts the string "aababb". Marks: [6]