Student Declaration: Theory of Automata and Formal Languages

You might also like

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

Student Declaration

I__Bakhat bhary___ Registration No 20-arid-251__, hereby declare that by attempting the

paper for the course _ Theory of Automata and Formal Languages ___, I will not be involved in

any kind of cheating/copying/plagiarizing in solving the short questions-based paper of Mid

Term Examination Spring 2021. I take full responsibility of my conduct. If I found involved

in any kind of such activity of cheating/copying/plagiarizing, then Institute reserves the right

to take any disciplinary action against me.

Student Signature
Mid Exam / Spring 2021 (Paper Duration 12 hours)
(Online Assignment Based Question Paper)
Course No.: ………CS-729…………Course Title:…Theory of Automata and Formal Languages….
Total Marks:………18…………………Date of Exam:……….…………………………….................
Degree: ………MCS….... Semester:……3rd……....Section:……A…………….
Marks
Q.No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtaine
d
Total Marks in Words:
Name of the teacher:Rana M. Amir Latif
Who taught the course: Signature of Teacher / Examiner:

To be filled by Student

Registration No.: 20-arid-251……… Name: BAKHAT BHARY……

(THEORETICAL EXAMINATION)

Answer the following questions.


Mid Exam / Spring 2021 (Paper Duration 12 hours)
(Online Assignment Based Question Paper)
Course No.: ………CS-729 …………Course Title: …Theory of Automata and Formal Languages….
Total Marks: ………18…………………Date of Exam: ……….…………………………….................
Degree: ………MCS………………….... Semester: ………….......………3rd………………………....
Section: ………………………………….
Marks
Q. No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtaine
d
Total Marks in Words:
Name of the teacher: Rana M. Amir Latif

Who taught the course: Signature of Teacher / Examiner:

To be filled by Student

Registration No.:20-arid-251………… Name: …BAKHAT BHARY………

(THEORETICAL EXAMINATION)

Answer the following questions.

Question 1: (4Marks)
What is the difference between formal Languages and informal languages? Give Examples:
Answer:

Between formal Languages and informal languages;

Formal Languages Informal languages

 Informal language not used as a basic


 Formal languages are used as a basic for
language for computer language..
defining computer languages.
 Concerned with rules and meaning.
 predefined set of symbols and strings.
 Informal language is symentic.
 concerned with just rules /syntax not with
meaning.  Not a predefined language.
 Formal language language is syntactic
language.
For example:
For example:
we defined language that starts with "a"and end If we talk about english and have two words
with e a)page
so we will have different combinations b)aegp
a)Admhe Both above words fllow English language rule
b)Amue that each word contains alphabets
c)page (i.e; a,b,c...x,y,z) but only first word hase
According to definition of formal language both meaning.
(a) and(b) above cases are true although According to defination of informal language
(c) has meaning but it don't follow the defined first word is correct
rule pf language.

---------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Question 2: (4 Marks)
 Write down the regular expression of the word ending in b
All words ending with b

(a+b)*b

 Write down the regular expression of the word starting in a

All words starting with a

a*(a+b)

 Given the regular expression (a+b)*, write down few strings generated from the given RE
Answer Given a Language L defined over ∑ (a,b) , starting and Ending with different letters with
different letters.
Answer:
={ ^,ab,aa,ab,ba,bb,aaa,aba ,baa,abb,bab,,bba,bbb}

Question 3:
Given a Language L defined over ∑ (a,b) , starting and Ending with different letters with different
letters.
 Write RE of the above Language
Answer:
RE = a(a+b) *b+b (a+b)*a

(4Marks)
 Draw FA the above Language

Answer;
a,b

2 4+
b
a

1-

a, b

b 5+
3
a

:--------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
Question 4: (4Marks)
Consider a language L1 {containing aba) and Language L2 = {accepting only a}
 Write and draw down RE and FA of the given languages L1 and L2
Answer:
RE of L2:
L2 = {accepting only a}
Regular Expression={ ^,a,aa,aaa,aaaa,aaaaa,………}
= a*
FA of L2:
Finit automata FA =

q0

RE of L1:
Language L1={containing aba)
Language L1= { aaba, baba, aaaba, babaa}
(a+b) aba (a+b)*

FA of L1:
b b

Q0 A Q1 b Q2 a Q3

 Draw FA of FA1 U FA2 (by using method Union of FA’s)


Answer:

b
a ,b

A Q1 b Q3 a
Q0

Question 5: (2Marks)
Explain the concept of the Palindromes with examples?
Answer:---------

PALINDROME :
The language consisting of ˄ and the strings s defined over ∑ such that Rev(s)= s

It is to denoted that the words of PALINDROME are called palindeomes.


Palindrome={˄,and all strings x such that reverse (x)=x)
Example :
for ∑= { a,b},
PALINDROME={˄,a,b,ab,ba,aa,bb,aaa,bbb,aba,aab,bab,……..}

For string of length =1:


-Take rev(S) where s is string
-Example : if s=a then Rev (b)=b
-if s=b then Rev (b)=b
-Similarly ,if ∑={A,aA,bab,d} and s =aA thenrev(aA)=aA

---------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------

Note:
Understanding the question paper is part of examination.
Hand written paper will not be acceptable?
Pledger should be less than 10%

You might also like