You are on page 1of 1

Orange EG 6:09 AM @ 64%

< Back toc-f-spr23[1].pdf CQ @)

for Technology & Information Academic Year 2022/2023


Faculty of Computers & Artificial Intelligence Semester. Spring 2023
Course: (CS 212) Theory of Computation
Examiner: Prof. Mohamed Anwar Assal Time 2 hours
Number of Questions: 3 Questions for Final Written Exa Number of Pages: 1
Question 1: (20 Marks)
2) Write the formal definition for the followi

i. Graph

ii. Directed Graph

b) Draw the directed graph for the following relation {(a, b). (b. b). (b. c). (c.
a)} and calculate the in
and out degrees.

© Prove using Boolean Logic


PeQ=FP2QNP-0Q)
d) Show that \3 is irrational
n (20 Marks)

a) Write the formal Definition of the following NFA and Proof that whether the
following string accepted
or not by the NFA: abbbabaabab

Jb €

b) Find a regular expression to describe the following language:


{e,a,b, ca, be, cca, bec, . . . , €", be} wheren=o
©) Write the regular expression to recognize both integer and floating-point
constants in C++
d) Convert the following regular expressions to NFA or DFA
(au b*) a*b*
n (20 Marks)

2) Define the following:


i. Grammar Parsing
ii. Ambiguous Grammar

b) Consider the following Context Free Grammar


(EXPR) — (EXPR)+(TERM) | (TERM)
(TERM) — (TERM) x (FACTOR) | (FACTOR)
(FACTOR) — ( (EXPR)) |a
Modify this grammar so that it can recognize a mathematical expression such as
ab +c-d
Determine the number of terminals, non-terminals, rules and starting variable for
the
modified grammar
For the previous expression Draw the parse tree and derive it

GOOD LUCK

Page 1of 1

You might also like