Você está na página 1de 8

SEMESTER-V

CS 5101 FORMAL LANGUAGES AND AUTOMATA THEORY TUTORIAL SHEET


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, B. I. T. MESRA
Module-1
Q1. What is need for nondeterministic finite automata? What is the deference between NFA and DFA?
Q2. Proof the equivaence of NFA and DFA? Write an e!am"e, which "roof the conversion from NFA to
DFA?
Q#. $et %& 'Q, (, ), qo, F* be finite automation. $et + be the reation in Q. Defined b, q1+q2 if ) 'q1,a* &
)'q2,a* for some a - ( and equivaence reation.
Q.. /onstruct the non0deterministic finite automata that acce"ts 1ab, ba2, and use it finite a deterministic
automata acce"tin3 the same set.
Q4. /onstruct it the DFA equivaent to the NDFA 5
i*
1 1
6 7
6
ii*
a
a
b b
b
q
6
q
1
q
2
q. q
#
6
6,
1

1,
6
1
q
.
q
6
a
q
1
b
q2
q
2
iii*
6,1
6,1
Q8. /onstruct minimum state automata. 9quivaent to 3iven automata % whose transition tabe is 3iven.
S!e I"#u
a b
q6 q6 q#
q1 q2 q4 q80fina state
q2 q# q.
q# q6 q4
q. q6 q8
q4 q1 q:
q8 q1 q#
Q:. Proof the theorem5 if $ is acce"ted b, NFA with - transition then $ is acce"ted b, an NFA
without - transition. Proof it with e!am"e.
Q;. A an3ua3e $ is acce"ted b, some DFA if and on, if $ is acce"ted b, some NFA0"roof the theorem.
Q<. /onstruct a %oor machine for mod # for binar, an3ua3e.
Q16. 9quivaence between %oor and %ea, machine0"roof with e!am"e?

Q11. =ive DFA>s acce"tin3 the foowin3 an3ua3e over the A"habet 16,12
'a* A set of a strin3 such that each boc? of five consecutive s,mbos contains at east
two 6>s.
'b* @he set of a strin3 whose #
rd
s,mbo from the ri3ht end is 1.
Q12. =iven DFA>s acce"tin3 the foowin3 an3ua3e over the a"habet 1a, b2 5
A set of a strin3 whose eftmost two and ri3ht most two s,mbos are identica.
Q1#. DFA that acce"t the strin3, which is Divisibe b, ..
Q1.. Desi3n a mea, machine acce"tin3 the an3ua3e consistin3 a strin3 from (&16,12 endin3 with 2
cosecutive 6>s and 1>s.
Q14./onvert NFA with - move in fi3. 3iven beow to equivaent NFA without - move.
A A
q
1
q
1
q
2
1
6
q
6
q
1
q
2
6 1 2
Q18. /onvert the foowin3 - NFA to DFA.

a A
b
Q1:. Desi3n DFA which acce"t set of a strin3 which are divisibe b, 4 for binar, a"habet.
Q1;. Desi3n a DFA that acce"tin3 the foowin3 an3ua3es over a"habet 16,12
@he set of strin3s such that the number of 6>s is divisibe b, 4, and the number of 1>s divisibe b, #.

Q1<. =ive the NFA that acce"t the foowin3 an3ua3es0@he set of strin3s of 6>s and 1>s such that there are
two 6>s se"arated b, a number of "osition that is a muti"e of .. Note that 6 is an aowabe muti"e of ..
Q26. Desi3n B NFA for the foowin3 an3ua3e. @r, to use B transition to sim"if, ,our desi3n.
@he set of strin3s of 6>s and 1>s such that at east one of the ast . "ositions is 1.
Module $%
Q21. Cbtain a re3uar e!"ression to acce"t a an3ua3e consistin3 of strin3s of a>s and
b>s of odd en3th.
Q22.Cbtain a re3uar e!"ression to acce"t for foowin3 an3ua3e0the strin3s 6>s and 1>s with atmost one
"air of consecutive 1>s.
Q2#.Cbtain NFA for re3uar e!"ression a
D
Eb
D
Ec
D
.
Q2..Cbtain an NFA for the re3uar e!"ression 'aEb*
D
aa 'aEb*
D
.
Q24.=ive the 9n3ish descri"tion of the an3ua3e of the foowin3 re3uar e!"ression.
'a* '1E-* '66
D
1*
D
6
D
'b*'6E16*D1D
Q28. /onsider the transition s,stem of 3iven fi3. Prove that the strin3 reco3niFed are
'aEa'bEaa*Db*Da'bEaa*Da.GArden>s theormH.
a a
b a
q
6 q
1
q
2
a
q1
q2
q
#
b
a
Q2:. /onsider the F.A equivaent to the re3uar e!"ression
'6E1*D'66E11*'6E1*D.
Q2;. +e"resent the foowin3 set b, re3uar e!"ression0
1a
n
In is divisibe b, 2 or # or n & 42
Q2<.Jf $&$'A* for some DFA A, then there is re3uar e!"ression + such that $&$'+*.
Q#6. /onvert the re3uar e!"ression r&'11E6*D'66E1*D to - move.
Q#1. Derive the re3uar e!"ression from this F.A.

1
6 1
6
Q#2. Prove that an, set $ acce"ted b, a finite automata % is re"resented b, re3uar
e!"ression.
Q##.=ive the DFA for the +.9 i* aaDEabaDbD
ii* ab'aEab*D'aEaa*
Q#.. /onstruct the ri3ht inear 3rammar for the foowin3 +.9 'aabDab*D.
Q#4. Write a re3uar e!"ression for the foowin3 an3ua3esK
@he set of a strin3s with an equa number of 6>s and 1>s such that no "refi! has two more 6>s than 1>s, nor
two more 1>s than 6>s.
Module-&
Q#8.Prove that foowin3 are re3uar or not
'a* 16
n
1
n
I nL12
'b* 16
n
,1
2n
I nL12
'c* 16
i 2
I iL12
Q#:. Prove that foowin3 are not re3uar an3ua3e0
16
n
I n is a "erfect cube2.
Q#;. Prove that foowin3 are not re3uar an3ua3e0
@he set of strin3s of the form 6
i
1
M
such that 3reatest common divisor of i and M is 1.
Q#<. Nhow that the re3uar an3ua3es are cosed under the foowin3 o"eration0
ma! '$* & 1wI w is in $ for no ! other than B is w! is in $2.
Q.6. What is Pum"in3 emma and what is the cosure "ro"ert, of re3uar set. Prove that
re3uar sets are cosed under union, concatenation and Oeen cosure.
q
1
6
q2
q#
1
Q.1. Find out whether these two F.A>s are equivaent or not0
i*
6 1

1 6
1 1
ii*
6,1 1
Module-'(
Q.2. What is the conce"t of "arse tree in conte!t free 3rammar? What is "arser? Pow to
remove the ambi3uities from the 3rammar. What is inherent ambi3uit, e!"ain.
Q.#. Define deviation tree. Find deviation tree a D bE aDb 3iven that0
aDb EaD b is in $'=*, where = is 3iven b, N5NEN INN Ia Ib.
Q... /onstrued the conte!t free 3rammar to 3enerate the corres"ondin3 an3ua3e0
'a* 1 6
m
1
m
I 1Q m Qn2
'b* 1a

b
m
c
n
I E m &n2.
Q.4. /onsider the foowin3 "roductionK N0aR IbA.
A0aNIbAAIa
R0bN IaRRIb
For the strin3 aaabbabbba,find0
1* eftmost derivation
2* ri3htmost derivation
#* "arse tree.
Q.8. Nhow that i* N0aRIab, A0aARIa, R0ARbIb
ii*N0NENI NDNI aIb
iii* N0aNIS, S0aSIa is ambi3uous.
Q.:.@he foowin3 3rammar 3enerate re3uar e!"ression with o"erand S and T and binar, o"erator. E, 0,
And D.
95 E99I D99 I 099 I! I,.
'a* Find eftmost and ri3htmost deviation, and deviation tree for the strin3 ED 0 !,!,.
'b* Prove that this 3rammar is unambi3uous.
Q.;. Net of a strin3s of baanced "arenthesis i.e. each eft "arenthesis has a matterin3 ri3ht "arenthesis
and a "airs if matchin3 "arenthesis are "ro"er, nested.
Q.<. Proof Uit is an unambi3uous 3rammar0
N06AI6R
A01AIB

q6
q1
q
#

6,
1

q2
q
.

q4
6
6,
1

6
qV6 qV1

6,
1
6
qV
2
R06RI1
Q46. +9 '661E1*D'61*Dobtain the conte! free 3rammar.
Q41. Cbtain the 3rammar to 3enerate an3ua3e U
$&1 wI na'w*&nb'w*2
Q42. Cbtain a 3rammar to 3enerate the an3ua3e0
$&1ww
+
Iw - 1a,b2D
Q4#. Cbtain a 3rammar to 3enerate the an3ua3e0
$& 16
i
1
M
Ii W M, iL6 and ML62.
Q4.. /onstruct 3rammar 3eneratin3 1!!I! - 1a,b2D2
Q44. /onstruct 3rammar 3eneratin3 16
n
1
2n
I nL 12.
Q48. /onstruct 3rammar 3eneratin3 1a
i
b
M
c
?
I i, M, ? L1, iWM&?2
Q4:. /onsider /F= = defines the "roductionsK
N0aNbNI bNaNIB
Prove that $'=* is the set of a strin3s with an equa number of a>s and b>s.
Module-)
Q4;. +educe the foowin3 3rammar = to /NF.
= is N0aAD
A5aRIbAR
R5b.
D5d.
Q4<. Find whether the foowin3 an3ua3e are conte!t free or not.
'i* $&1a
"
I" is "rime2.
'ii* 1a
m
b
m
c
n
Im Q n Q 2m2
Q86. Find whether the foowin3 an3ua3es are conte!t free or not
16
i
1
M
I M&i
2
2
Q81. /onvert the 3rammar N5AR, A0 RNIb
R5NAIa in to =NF.
Q82.Nhow that $& 1a
n
b
n
c
n
'nL1* is not conte!t free but conte!t sensitive.
Q8#. What do ,our mean b, reduce 3rammar? Find reduce 3rammar equivaent to the
foowin3. =rammar5
N5aAa.
A5NbIbccIDaA.
/5abbIDD
D5aDA.
R5ac.
Q8..Find the reduce 3rammar equivaent to the 3rammar N0aAa, A0bRR, R0ab, /0aR.
Q84.=iven the 3rammar N0AR, A0a, R0cIb, /0D,D09,90a, find the equivaent 3rammar which is reduced
and has no unit "roduction.
Q88.+educe the 3rammar into =NF
'a* 959E@ I@
@5@DF +
F '9* JD
'b* N5NN
N56N1
N561.
Q8:.Find the +e3uar 3rammar of the foowin3K
i* N0NNNIaIab
ii* N0AAN IabIaab
iii* A0abIbaIB
Q8;. 9eminate useess s,mbo for 3rammarK
i*N0aNIAI/
A0a
R0aa
/0a/b
ii*N0aNIbA
A0aAIB
iii*A06RI1DI6
R01/I6D
/06RI1DI6
D06DI1D
Q8<.Draw an NFA acce"tin3 the an3ua3e 3enerated b, 3rammarK
N0abAIbRIaba
A0bIaRIbA
R0aRIaA
Q:6. Re3in with the 3rammar
N0ANRIB
A0aANIa
R0NbNI AI bb
a* Are there an, useess "roduction? 9eminate them if so.
b* 9iminate B "roduction.
c* Put the 3rammar into /homs?, norma form.
Module-5K
Q:1./onvert the 3rammar
N56N1IA
A51A6INI -
to a PDA that acce"t the same an3ua3e b, em"t, stac?.
Q:2. 'i* Desi3n PDA that acce"ts.1wcw
+
Iw is in '6E1*D2 b, em"t, stac?
'ii* Desi3n PDA that acce"ts.16
n
1
2n
InL 12 b, em"t, stac?
iii*Desi3n PDA that acce"ts.1a
n
b
n
In L62 b, em"t, stac?.
iv* Desi3n PDA that acce"ts.1a
n
b
m
a
nEm
2
Q:#./onstrut the PDA that acce"t the an3ua3e 3enerated b, /F =5
N5NENIND

NIid.
Q:.. Desi3n PDA that acce"ts1a
n
b
m
a
n
I m,n L 12
Q:4. Desi3n PDA that acce"t $%?&1wIw - 'a,b*D and na'w*&n b'w*2.
Q:8.Prove that the set acce"ted b, are /F$>s
N0aA
N0aAR/IbRIa
R0b
/0c
Q::. /ostruct PDA from an3ua3eK a
!
b
,
c
FI
I !EF&,.
Module-*(
Q:;. Desi3n @% for the foowin3 an3ua3e0
'a* 1a
n
b
n
c
n
I nL12
'b* 1ww
+
Iw is an, strin3 of C>s and 1>s2.
Q:<. Desi3n @% for foowin30000000000
'a* @'!*& 1!!, ! - 'a,b*D2
'b* @'n*& nE1.
Q;6. 'a* Desi3n @% to obtain the reverse strin3 from the 3iven in"ut strin3 over
(& 1a,b2.
'b* Desi3n @% to add two inte3er number.
Q;1. Desi3n a @% to com"ute 1>s com"ement.
Q;2. Jf a an3ua3e $ is acce"ted b, @% then $ is acce"ted b, two stac? @%.
DDDDDDDDDDDDDDDDDDDDDDDD9NDDDDDDDDDDDDDDDDDDDDDDDDD

Você também pode gostar