Final Spring 2022
Final Spring 2022
Marks: 40
Final Exam
Semester: Spring 2021/ 2022
INSTRUCTIONS:
1- Any kind of cheating from others will subject the student to the penalties specified by the University rules
2- Use of cell phone is strictly prohibited
3- One A4 Cheat Sheet ‘Handwritten’ Is Allowed
Signature: …………………………….……………….……………….…..….…….
Total 40
1/7
Question 1: Short Answer (6 points):
The diagram below represents the relationship among classes of languages, where the
outermost rectangle represents the class of all languages. (i.e. the universe is the set of
languages)
On this diagram, place the symbols representing the languages as below in their
“correct position” to indicate proper membership. (example: F is already placed
in its correct position).
2/7
Part C (0.5 pts each).
1. (ab)c* -------------------------------------------------------------------------
4. b*ab*ab*--------------------------------------------------------------------------
Part A. Show that the class of CFLs is not closed under intersection (2
pts)
Part B (4 pts). Consider the grammar G ( {S, T, U}, {0, #}, R, S) where the set
of rules R is:
S T T | U
T 0T | T 0 | #
U 0U 00 | #
Let L denote the language that this grammar generates. Let C denote the
language that is generated if T is the start symbol, and let D denote the
language generated if U is the start symbol.
--------------------------------------------------------------------------------
3/7
b) Give a simple description of the language C . Explain.
--------------------------------------------------------------------------------
----------------------------------------------------------------------------------
d) Give two leftmost derivations for the string 00#000#0 showing the
steps.
Question 3 (6 points).
-----------------------------------------------------------------------------------------
Question 4 (6 points).
5/7
c. Give a PDA that recognizes B. Give a brief description in English of your PDA.
Question 5 (5 points).
Language L1 = {0,1}*#{0,1}*
L1 is Regular.
Language L2 = ̅̅̅
𝐿1
L3 = {u#u | u ∈ {0,1}*}
L3 is NOT context free.
Question 6 (7 points).
We have used the convention that missing arrows are arrows that would have pointed
to qreject , which is also not shown in the diagram.
6/7
q1 U→R
1→ U, R
q8
q3
U→R 0→ U, R
U→R
0→ #, R 1→ #, R
q2 0→R q5 q4
1→L
0→R 1→ #, L 1→ #, L
0 → #, L
q6
0,1,x,# → L
U→R
0 → #, R 1 → #, R
q7
#→R
U→R
qaccept
011101 q1011101
1110 q11110
7/7