• Tidak ada hasil yang ditemukan

Department of Computer Science and Engineering

N/A
N/A
Protected

Academic year: 2023

Membagikan "Department of Computer Science and Engineering"

Copied!
2
0
0

Teks penuh

(1)

Daffodil International University

Department of Computer Science and Engineering

Faculty of Science & Information Technology

Midterm Examination, Summer 2020 @ DIU Blended Learning Center Course Code: CSE331 (Evening), Course Title: Compiler Design

Level: 2 Term: 1 ,3 Section: PC-A(EVE) Instructor: SZ Modality: Open Book Exam Date: Sunday 12 July, 2020 Time: 05:00pm-09:00pm

Four hours (4:00) to support online open/case study based assessment Marks: 25 Directions:

Students need to go through the CASE STUDY shown in this exam paper.

Analyze and answer specific section based on your own thinking and work.

Do not share as this will be treated as plagiarism by Blended Learning Center.

1. In physics, equations of motions are equations that describe the behavior of a physical system in terms of its motion as a function of time. One of the equation of motion can be described by the following equation: s = u * t + (1/2) * a * t * t

Consider that you have written a code containing the equation given above. Now explain how the compiler will work on that equation in the following phases: 6

a. Lexical Analyzer

b. Intermediate Code Generator

c. Code Optimizer

d. Final Code Generator

2. Consider the following Finite Automata:

Figure: 1

(2)

a. Give the formal definition of the Finite Automata of Figure 1. 2 b. Is the Finite Automata of Figure 1 a NFA? Give reasons behind your decision. If it is a 7

NFA then write down the subset construction table for converting it to DFA.

3.

a. Consider the following statements and explain if the statements are example of CFG. Give reasons behind your decision. 2 ABCD

BAB D Dc cAc

b. Consider the following CFG: 4 XXYX|0|1|Z

Y ZX|0|1 ZƐ|0|1

Now derive the string “01010101010100” using LMD and RMD from the grammar. Is the grammar ambiguous?

4. Write down the regular expressions for the following languages: 1+2+1=4 a. All strings of a, b, and c, that starts with at least one a or b which is followed by the

appearance of exactly two c’s and then end by the appearance of even number of b’s

b. Assume that Σ={L,N,C}, where L is for English letters (A-Z|a-z), N is for numbers (0-9) and C is for characters excluding English Letters and numbers. Now write down the regular

expression of an email address.

c. All strings of a’s and b’s that has at least six consecutive a’s.

Referensi

Dokumen terkait

Organized by : National Cheng Kung University/ Department of Electrical Engineering/ Department of Computer Science and Information Engineering/ Computer Center The Association for'

STAMFORD UNIVERSITY BANGLADESH Department of Computer Science and Engineering Term-02 Examination, Spring 2022 Semester CSE 101 : Fundamentals of Computer Science CT: Raihan Tanvir