Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Pir Mehr Ali Shah

Arid Agriculture University, Rawalpindi


Office of the controller of Examinations
Final Exam (Theory)/ Spring 2020 (Paper Duration 48 hours)
To be filled by Teacher

Course No.: CS-536 Course Title: Theory of automata


Total Marks: 30 Date of Exam: 04-08-2020
Degree: BSCS, BSIT Semester: 6th Section:
Marks
Q. No. 1 2 3 4 5 6 7 8 9 10 Obtained/
TotalMarks
Marks
Obtaine
d
Total Marks in Words:
Name of the teacher: Tayyaba Kalsoom
Who taught the course: Signature of teacher / Examiner:

To be filled by Student

Registration No.: ……17-Arid-6283………….……… Name:……Amber ghani…………………..

Answer the following questions.

Q.No.2 Answer the following long questions


Part (2) Construct a PDA that accept the Language L= {WXWR ) over alphabet
∑={a,b,c} Where W= (a+b)* Note: derive any two Valid string accepted by the language
L= {WXWR )
Hint: WR is the (reverse of W)
Answer:
L=WXWR
W=(a+b) *
W={null, a,b,aa,ab,bb,aba,bba,}
WR = {null, a, b,aa,ba,bb,aba,abb}
Q1. Give context free grammars that generate the following languages L =
0 n 1 2n Where n>=1 Note: Also derive any two valid strings accepted by
the following Regular Language
Answer:
L=0n12n
N=2
String={001111}
N=3
String={000111111}
Productions :
S AB|null(E)
A=0B
B=S1

Let drive the string 001111


S
AB
0B B
0 S1 B
0 AB 1B
0 0B B1B
00 S1 B1B
00 E 1B1B
00E1 S1 1B
001 E 11B
00111 S1
00111 E 1
001111

Lets drive the string 011


S
AB
0B B
0 S1 B
0 E 1B
01S1
01 E 1
011
Qno4 :Convert the following Mealy machine into Moore machine

Transition Table :

States Input a Input b Output

Q0 Q1,0 Q2,0 0

Q1 Q1`(complement),1 Q2,0 0

Q1`(complement ) Q1`(complement),1 Q2,0 1

Q2 Q1,0 Q2`(complement ),1 0

Q2`(not) Q1,0 Q2`(complement),1 1


Q5. Construct a NFA for the given R.E over ∑={0,1} (0+1)* 011 (1+0)*

Qno3: What language ‘L’ does the following grammar generate?

S=> cd | c S d L=_cndn_where n>=1____________

Is this grammar a regular language? (Yes/ No) ___NO_______

Any valid string for the L= _cd,ccdd,cccddd_____________


Qno2 :Construct a DFA for the given sample (valid strings below) over ∑={0,1}

A. . 1011

2. 1010

3. 101101

The following sample strings should not be the part of your DFA (Invalid for the above DFA) B.
{1, 0, 11, 00, 001, 110, 100, 1001}

DFA for 1011

R.E=10(1)

Qno1: Let’s we have a regular expression given below (2) Regular Expression= ( ( Rx1 ) * Rx2( Rx4 +
Rx3 ( Rx1 ) * Rx2 ) * How would the above expression change if the self-loop with Rx1 was absent?
)*
R.E=___Rx1Rx2(Rx4+Rx3Rx1Rx2 ________________________

You might also like