0% found this document useful (0 votes)
13 views3 pages

q2 Answer

The document is an exam for a compiler design course. It contains two questions - the first asks students to choose the correct answers for multiple choice questions about compilers. The second question asks students to draw transition diagrams for non-deterministic finite automata and sketch automata based on regular expressions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

q2 Answer

The document is an exam for a compiler design course. It contains two questions - the first asks students to choose the correct answers for multiple choice questions about compilers. The second question asks students to draw transition diagrams for non-deterministic finite automata and sketch automata based on regular expressions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Misr University for Science and Technology Course Code: CS-352

College of Information Technology Title: Compiler


Date: 12 /12/2023 Instructor: Dr Maged Khafagy
Time: 12 - 12:30 AM Exam(2)
Marks: 25 Marks Semester: Fall 2023l24

Student Name: Student ID#:


Question 1: Choose the correct answer ( 7 Marks)
1- What is a compiler? ( 1 Marks)
a) system program that converts instructions to machine language
b) system program that converts machine language to high-level language
c) system program that writes instructions to perform
d) None of the mentioned

2- Which of the following is a stage of compiler design? ( 1 Marks)


a) Semantic analysis b) Intermediate code generator c) Code generator d) All of the mentioned

3- What is the use of a symbol table in compiler design? ( 1 Marks)


a) Finding name’s scope b) Type checking
c) Keeping all of the names of all entities in one place d) All of the mentioned

4- A programmer, writes a program to multiply two numbers instead of dividing them by mistake, how
can this error be detected? ( 1 Marks)
a) Compiler or interpreter b) Compiler only c) Interpreter only d) None of the mentioned

5- Who is responsible for the creation of the symbol table? ( 1 Marks)


a) Assembler b) Compiler c) Interpreter d) All of the mentioned

6. Which of the following is a definition of compiler? ( 1 Marks)


a) Acceptance of a program written in a high-level language and produces an object program
b) Program is put into memory and executes it
c) Translation of assembly language into machine language
d) None of the mentioned

7- Consider the following two statements. ( 1 Marks)


S1: { 02n |n >= l} is a regu1ar language
S2: { 0m 0n 0(m+n) l m >= 1 and n >= 2} is a regu1ar language
Which of the following is true?
a) Only S1 is correct b) Only S2 is correct
c) Both S1 and S2 are correct d) None of S1 and S2 is correct

Best wishes Maged khafagy


Question 2:
a) Draw the Transition Diagram for the NFA (a|b)*abb ( 6 Marks)

Solution

Another solution

Best wishes Maged khafagy


b) Sketch an automaton that accepts a string ending with 1 (6 Marks)

Solution

c) What is the RE string that satisfy the following diagram? ( 6 Marks)

Solution

a(bab)*∪a(ba)*

Best wishes Maged khafagy

You might also like