q1 Sol

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

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

College of Information Technology Title: compiler


Quiz1 Date: 4 /11/2023 Instructor: Dr Maged Khafagy
Quiz1 Time: 10 - 10:30 AM Exam(1)
Qiuz1 Marks: 25 Marks Semester: Fall 2023l24

Student Name: Student ID#:


Question 1: ( 12 Marks)
Choose the correct answer
1- Are (ab)* and a* b* equivalent.?
a) True b) False

2- Are (ab)*a and a(ba)* equivalent.


a) True b) False

3- Lexical analysis breaks a sequence of characters into--------


a) Tokens b) Groups c) Packets d) Lines

4- Grammar of the programming is checked at --------- phase of compiler.


a) Semantic analysis b) Syntax analysis c) Code optimization d) Code generation

5- ------------ is considered as a sequence of characters in a token.


a) Lexeme b) Texeme c) Pattern d) Mexeme

6- A -------- is a software utility that translates code written in higher language into a low-level language.
a) Compiler b) Code optimizer c) Converter d) Text editor

7- ----------checks the Grammar of the programming language


a) Semantic analysis b) Syntax analysis c) Code optimization d) Code generation

Question 2:
a) For the following assignment statement: ( 4 Marks)

Show the transactions diagram as it passes through Lexical analyzer.

b) What language is generated by the following grammars? ( 3 Marks)


1- S -> 0 S 1 | 0 1

2- S -> a S b S | b S a S | ε ( 3 Marks)

(a*b*|ba)* (a*b*|ab)*

C) ( 3 Marks)

You might also like