We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 19
USN
TIME: 03 Hours
BCSS503
Paper with effect from 2024-25 (CBCS Scheme) a |
1 ae ,
Lee een
FE. Degree Examination
Theory of Computation
Filth Semester
Max. Marks: 100
Note: O1. Answer any FIVE. full questions, choosing at least ONE question from each MODULE.
Module BL] | Marks!
| Q0r Ja]. Design DFA to accept strings ofa’s and b's where language Ts | {10
=|: t Whol
iS Desi DEN fo Accept stings of O's and I's L={ starting with O1 or
starting with 10} 4 fis —
} Detine NFA ts | fio
Convert the followin
NFA to its equivalent DFA.
{ot p
+) ——_ jy —* |
Find E-Closure of all the states
Convert following NFA to DFA
T3 | | 10
a
(9: DSM
i
1
ii,
Define Alphabets Strings and Languages. r2 | | 10
Construct a DFA to accept strings of 0's and 1’s starting with at least
two 0's and ending with atleast two 1s.
‘Module-2
Qa
oo
Define Regular Expressions. 13 10
Obtain RE to accept strings of a's and b’s whose second symbol from]
the right end is a
Obtain RE to accept words with two or more letters but beginning an
ending with the same letter where {a, b} are inputs,
Obiain NFA which accepts strings of a’s and b's starting with the
string ab
Obtain NFA for the Regular Expression (atb)"aa(atb)*
b | Minimize the following DFA using Table filling Algorithm, 13] | 10
q
alo}a}ul>| a] >}
=] =] >| a]a] >]
Page 01 of 02BCS503
* aie G FG a
a0 D
ae OR - a
i State and prove pumping lemma Theorem tho]
i, Show that, L= {WW | WC fab) *}} is not regular
| |B [Show that re wages are closed und fis Pye}
| | i Union,concatenation and Kleens star
L ji__ Intersection and Differene
ae _Modute-
Ly 10)
‘Obtain the unambiguous grammar for the grammar shown and get the
derivation for the expression (a+b)"(a-b),—=
| ES E+E | E-E
E> E*E | B/E
| E> (E) {1
19 albie
ii Consider the following grammar
S> ADB
Aaa |e
| B> aB|bB/€
Give LMD and RMD and Parse tree forthe string
PDA for accepting a palindrome LOM) = {WCW] We(atb)*} = | L3 | | 10
1
\ hwhere Wis reverse of W and show ID for the string “aab™
OR
for the following languages _ 12 10
—— —
) L= {WW* | WE fab) *)}
ii) L= { w | w € {0,1 }* with atleast one occurance of “101” }
iv) L= { strings of a’s and b’s with equal number of a’s and b's )
) Obtain a grammar to generate a language of strings 0’s and 1s haing a
ubstring O00:
b | Define with example T3 |) 10
i Grammar
ii, Derivation
iii, _Leftmost and Rightmost derivation
iv. Ambiguous grammar
v.__ Parse tree
Module-4
Qa Sala |B
‘A — aBB|¢ caaes
B—Aa|b
_ {Convert the above grammar to CNF
b $= Sa Sbj aa|B
‘A—>Abj aBB | ab mrlgae
B— Bajbb
[Eliminate left recursion.
Page 02 of 02Q 1 a) ii] Design DFA to Accept stings of 0’s and 1’s
La{ starting with 01 or starting with 10} E=}0.\%
ol
Hite"
as S
Q 1 b) Define NFA. m=(@, 2, § fe, F)
Convert the following NFA to its equivalent DFA.
0,)
Be q>&)
Sk Stohirg Stele oh DPA
1755 eames)
ep b wpa symbuy oh DPA:
E213
ere Canider Steak A on input @ & |
Sp(a10)= Sy (A109)
= Sy (44,9)
ee
SICR 1)=Su(As!)
= £4,493 —B
feteComider Ste B en IMpur 0 81
Sr(B,0)= Su (8%, 43,0)
Sit Aaitcs Semen
SCR, 1) = Su C$ %,93, 1)
= 4, 4,
Consider State Con tnpet O 4 |
S(c,0)= Sy (4%, 453,0
= 143—A
80(c,1) = SoC F4,%3, 0
= 3%, 943—B
Coomides Stele B an Inpat 0 &)
§5(0,0)= Sy (?%,% %), 0)
— f Gate ye
$0(D, 1) = Sul £ %4,923,!)
=e iy Te ee
As £45 — Inhral lod
Bea tec
aa 2 %,9r) i
fe a bl i)Q 2 a) Find & -Closure of all the states Convert following NFA to DFA
—
E- Chose (4p) i ae In, Ty, 9,3
u (4) = f ty 4o,I3
"(t= {4,3
5 (4s) = § 4s, %, Qe, 4, 92, 94,3
j = $, a, 43, 2, Ie, Te)
(%) = £943
* Cs) = $41,%0, 94, %) %, 993
y (45) im 1%, 40, y % 973
" (4) = 1% 3
n (4%) = £%)
aay =? h)
4 (40) > ; Io}Ste! Steading Stub of DPD = £953
Cclusue (%) = = {% 4, 4 1%, Gg a hy
twp at eee
= fab)
_ Steed Connaler Sule A on inpaf a & b
Sy (ta) = €-cberae ($4(A,4))
= E-cbren(Sy(f %, 4, 2, %,493, a))
= Cdr (9s, 9e)
= P 4, 4a, 4%, 14,16, 94 45-8
SoA, b) = €-clerer (Sw, b))
= €-clud (5)
= 294, 96,%, 95,% 22) —C
Conder B onmpt a & b
So (B,a) = eel (Siy(%, %,%, &, 4,%,%),4)
= ew (%,4e)— B
S0( Bb) = ecto (54(B, 6)
= Cum (4%, 7)
= 44, 96,94, 9, Is, 14 J —P
Comjdur Slee Cm Akb
So (¢, 4) BAC, %, Fa, I, 4%%)14)= Eel (%,9s)—p
Camidy 8 tel
Cera o S(4,») = can (s)
= $4, 10, 14, 95% BRC.
Consider tule D om upt a bb
S014) = E-cle (S144, % 44%, 4%) Y)
=> Cely 45, ')— B
$00 Dib) = Ect (4s 40)
= $4, %, 45%, % TW} —E
Consider Bo am Bh &b
(Ea) = ctx (& (2,4))
= én (45, 4e) Sea
So(£,b) > Cet Cin 64)
A= [%, Ve, a tracted shel
£%,%, %, % %% %3
£4, 4, 44, % ,% % 3
Dien ty, Ye 4a, Ws e, 4g % 3
B= f44, 9y Ve 5 4 Fo ,0) Rena) ete
8uey
oes
(GaDER Peo NEN
===Q2b)
i) Define Alphabets Strings and Languages.
ii) Construct a DFA to accept strings of 0’s and 1’s starting with at least two
Ss.
$14
Q3a)
i) Define Regular Expressions. Fy «
ii) Obtain RE to accept strings of a’s and b’s whose second symbol from the
right end is a a Yo
(bya (a+b) a
iii) Obtain RE to accept words with two or more letters but beginning and
ending with the same letter where {a, b} are inputs.
O.(atb¥g + b(arby b
a atb biv) Obtain NFA which accepts strings of a’s and b’s starting with the string,
yO”
v) Obtain NFA for the Regular Expression (a+b)*aa(atb)*
Q 5 9)1) Obtain the unambiguous grammar for the grammar shown and get
the derivation for the expression (a+b)*(a-b).
E> E+E|E-E
E> E*E| E/E B> ER
E>(®)|I S(E)*E
I>alble (B+ 2) 0B
BS ee ae Sine
T> Tae | T/e2 | é > (a+2)4 2
B ato) té
7 ae = (a+))9(£)
aia La => (a+b)¥(2-B)
> (a+ ee)
=) en on
mi ae (a-)'Q 5 a) ii) Consider the following grammar
S > AbB
ADadle
B> aB| bB|€
Give LMD and RMD and Parse tree for the string “aaabab”
LMD
RMP
eels g=> AbB
Feoe > Abad
=> Qa hbB => AbhabB
=> aaahbB > Abab
> Qaabe 2ahbab
> aag bab => aahbab
=> qaqg bab = aaqhbab
=> qaghab > qaq bab
b
A B
ye
be
‘ 1
Se
Ss
Sus'Q 5 b) Design a PDA for accepting a palindrome
L(M) = (WCW | We(atb)*} where w* is reverse of W and show ID
for the string “aab”
ae a ppad
bya | bg
a, b/ab
bb] bb
bw/be
a, 4/ 2H bbe
A, %/4 Bay aa/ea 6 a) Construct CFG for the following languages
i) L={0"1 | n>=0, m>=0} apa
ie c M=0 @
SAB ales Me \
A> COATS Nee oood |More 4)
Br Ble
ii) L= {WW® | WE {a, b) 3} Ww gz
ab bq
S>ash |bsb le
iii) L= {w| w € {0,1 }* with atleast one occurance of “101” }
S> Blok
_ 7 onli
iv) L= {strings of a’s and b’s with equal number of a’s and b’s }
ab, bg
S> ash |bsa) ss le a.
hie,
v) Obtain a grammar to generate a language of strings 0’s and 1’s haing a
substring 000/ a 6 b) Define with example
i, Grammar
ii, Derivation.—
iii. Leftmost and Rightmost derivation
iv. Ambiguous grammar
v. Parse tree
Q 7 a) Convert the above grammar to CNF Let Rear
SPaladA|[B bak
A> aBB|¢ C=
B> Aal|b ee
Newb veaehd Ve tA)
Resedbiiey Giorno
S>a |ah]p
A aB
B> Aa |alb
Lnrit Pooclucky 3-48
Ssa| a4|Aalalb
A> aBB
eo latb ee
Repl 4 wiih Bo
Bo>@
$2 0\Bd lap, [alb
383 a [RA AB, Ja |b A> Bo Dg
As Bopp B> ABo |alb
BS Ap lalb
By 4: Q7 b) Eliminate left recursion, ae &)
S— Sa a8 sy | aA| B
A) By Be A 4 |p
A Ab] aBB|al/b. A? BA)
SR, RL By A> Ah] e
B—Ba|bb
aa,
S>a&s' [as
S'5aa'\os'le
haa! |bnljasan
A> bale
B> bbs)
B> agi je'Q.9 b) Define Turing Machine (TM). Design a TM for language
L=@° 1" |n>=0 } Show that the string 0011 is accepted
(ye) Ye)
0.0L
(0,0,R)Q 10 a) Define Turing Machine (TM). Design a TM for language
L={I 3" [n>=1} Show that the string 111222333 is accepted
8 |x Pollet ¥|alalale
ny
(A%L)
Gye) Fe) Gh)
(4k) G@2R Ye)
@ a L)