Skip to content

Compiler Design

CSE · Midterm · Spring 25

Paper 1 of 2Batch 61 · Abdullah Tawsif (CSE-232)Switch

Batch 61

Paper 1 of 2

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, Spring 2025 Course Code: CSE331, Course Title: Compiler Design Level: 4 Term: 1 Batch: 61 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 -> D M Y D -> NN M -> july Y -> NNNN N -> 3 | 6 | 2 | 0 | 4 [5] | CO1 For the input string: "36 july 2024", determine whether the CFG is ambiguous or not. 2. a) flaot Calc (float a, float b float c, int x) { flaot ans, char ch=c; ans = a*x+b*x+c -/* this is second statement*/ retunr ans; } Describe the phases of a compiler for the second statement of the given function. [5] | CO1 b) Find the errors in the above code 2(a) and explain how panic mode method can recover from the errors. [5] 3. a) A smart travel management system is being developed to track the journeys of three travelers: A, B, and C, as they travel towards Cox's Bazar. The system will use a Finite State Machine (FSM) to model their movement through various locations. Travel Routes & Constraints Traveler A starts from Dhaka and follows this route: Dhaka -> P -> Q -> R -> Cox's Bazar Traveler B also starts from Dhaka but takes a different route: Dhaka -> M -> N -> Q -> R -> Cox's Bazar Traveler C starts from Feni and follows this route: Feni -> R -> N -> Cox's Bazar -> Teknaf Design an FSM diagram that accurately models these travel paths. [5] | CO1 b) If the 3(a) FSM is an NFA, convert it into a DFA. [5]