Download as pdf
Download as pdf
You are on page 1of 14
(a) Design a Context Free Grammar for the language L={a"b" : n> 1} Sa aSbb | alob (b) Check whether the following grammar is ambiguous or not: S — alabSblaAb A— bSjaAAb Bo bA Yo, the Gren gramman is ambia nous Booz, Sos the on ‘adoads pee Can goers mnere than donivation tus. Dareivebion trea -t Denivotiontree - 2 (c) Design a Context Free Grammar for the following language: L={w: w e{0, 1}* and w isa palindrome string} So rlo[s| oso tsi (d) Distiriguiah between CNF and GNF. CNe | Gne > A OFG is incNe tt W paddy [o A ce is in Gate Th ol ant of Yo Sonn, produhons one oh te tenn, ees Ax>art ~ a wher A,B,C EV and abet aeT and LEV ae Ty CNF G@nF > The oo. & shops vequured 4 > The roa sles required +o derive a shiny of leno °° derive a sting af ange n ‘6 (an-\). es (Cn). (e) All linear grammars are not regular grammar but all regular grammars are linear. True or False, Justify. (ARvE) = B teaudan greens te ote, right \rrens o« \aPL Linea Ves almost one vanes at peans one RUS a produto, cod, resbackon on pasikion of He variable. > A Vinton Gromman if Oo ramon in hide amas one vad: abpeans on Ae RS & produdtios cto teshackon on positon of Hu variable. = Cran: a eee A 5 aBla (BAL yeoman: (f) State the Pumping Lemma for Regular Languages > Ws greener, ig & neon, Groeman. touk nok sequlay Lik \ be an valine cegder Lagange Ahan thane ews gone que integer gush eat ong stings OL with can be decomposed 247 w= aye wth \ry\ e & ond \y\ >t such thak [wis aye CL Soe old tz OnN2-- (g) Design a finite automata for the following language: L = {w: w e{a, b}* and length of w is a multiple of four} aro L = {a°b4: p +q is even} (h) Find a regular expression for the following language: Cans (oye + alaay, webby (i) Star closure of every regular language is infinite. State True or False with justification. (FALSE) We Kaw, 4 w a sequler | . (j) What is Chomsky’s Language Hierarchy? =) ghan- closure Rg ig X which io Hod. 2. (a) Design a NFA for the following language and also find a regular expression for the same language: L = {w: w e{a, b}* and either w starts with “ab” or ends with “ab”} (4) O—© a Ding othy pekbe NEA Can be ateebled- RE ab(arky + (as¥y ob (b) Design Context Free Grammars for the following [2+2] languages: i) L={0P192": where p, q, r>=0 and q = p +r} ii) L= {0'Pi<=j +4} 2 S > AB A> oat\ > B+ 162\> “ Ss A\elosi & > dol 00 \o00| cov B> \\1¢6 3. (a) Design a DFA or NFA for the following languages: [4] i) L=L ((aatbb+ab+ba)'bb’aa‘(bb+aa)’) ii) L=L(ab‘a‘atba’b’b) U L((a+b) baba) (b) Convert the following grammar into Greibach Normal [4] Form: S— ABjaB A — aabli B= bbAla Eliminade -Predackon: Nutloble varieble = 7 Al | Ss rel elacla i G5 AGl ebalal aera’ RO oob Bo bbAl ali, Gne > aabt| beaab lal bblabbala A> ab B, bbalal be ay So aViVa Bl bal bu TAMMATS AD avy, Bo bv, Alal ov, Waa Vib 4 @ Considering the set of strings on symbol {a, b}, construct a DFA for all string containing “aa” but not “aaa”. Then find out its corresponding regular expression. [2+2] OF fo © Rammove ay ——— tab Li . » fe a a (bl btab)aa) (n+ b( haha) ‘OsX% > 7) Racnove Ga* (b+ assy a a(vl bratfen) Ont b( ntah3a) ~~ © Ana tthe Ree can be pes - (b) Design an NFA which will accept all string generated [4] by the symbols present in your roll number. Convert the NEFA into its corresponding DFA. Fro ae$ Rah. SALosooil Sf 0)1;2,54 Nei DEA — —@) 01,26 @) 5) > —@ yee 7 CD 01, 1S OMUS OD ONUs 5. (a) Consider a language, L= {ww : we {a, b}*}. Show that [4] L is not a Context Free Language, using Pumping Lemma. Soludion’. Consider the language L= (ww iw € {a, by’), Although this language appears to be very similar to the context-free language of Example 5.1, it is not context free. Take the string anya”. ‘There are many ways in which the adversary can now pick exy, but for all of them we have a winning countermove. For example, for the choice in Figure 8.2, we can use i = 0 to get a string of the form tba", k=2 and q >=3}. €p ’ ~ a b b Ors Ssoror8 QL Ss aa — A> ab Bo aB\bC ~ An Robb —_ Dove E_> »\be c> Bb Bo=Balfhea A>Sa Sa 6. (a) Convert the following Context Free Grammar to Chomsky Normal Form. S— AABC A— aAbli B-aBla C= aBalbCh] A 65] Remove >— produdiony Nulbabe varide~ Larch S>nneclaec\ Anal e A> Nb \ale Bsar\e Cabal bcb\vb Romeve Urrk ~produudirnarr A> OAb \ale Bsop\a C>akal bcb\vb S>areclascl Are lasla Cue. | S> Vivo \ Ave vie | ve8| A> VaAVul 2% 8 V38\ a C+ V26Va\ Wut Yu\ Vay, Wa AR Vi7 Be N3Z98& Vuse VU S> YW \ Aral WB | vB a As Yevu\o% 8 V3e\a C5 VeVay | Vavu\Vavy Wo AR V20 BO V3Z90& Vuoe Ve -> v3 Pr Vo Va vz Vad (b) Prove that Context Free Languages are closed under B) Concatenation operation. Let us assume two CFLs L, and L, with their corresponding grammars G, = (Vy, T,, Py, Sand G, = (V2, To, P2, S.) respectively such that V, NV. = Let L be the new language generated by concatenation of L, and L, with its. corresponding grammar G = {V, T, P, S). Thus L generates the L,L; language as S — 8,S, ("" Concatenation) Grammar for the L can be derived from L, and L2 as follows:: G= (Vy UV2U{S}, Ts U Ta, PiU Pa {S — S; S2}, S}. Lis a CFL as the new production S —- S, S, does not violate the rule of being context free. ________________ Waa 7. (a) Construct a PDA or NPDA for the following language: [4] L={alblc’: where i=jori= k} a, e|Az (b) Construct a NPDA for the given CFG, G = ({S, M, N}, [4] {0,1}, S, P) where the production rules P are given below: S— MN10 M— 00MIN N-IM1 Remve Vat prodabivas® S2muilo M~> OvmM| iM N-> amb Gar. ~ SS 0M Yo S5 OV{MNV [6 M> Oom\im1 [7] Ms OME My ND IMI No IM, M20 N271 p nye? 3) 22 Gi) Mo] ©) 8. rms, 0,S[> OM] WM VM] V2 AN) Ay oi] > M1> ‘a) Design a Turing machine for the following language: (5) ie ie L={c™"a"b": n,m >1} (b) Write the Instantaneous Descriptions (IDs) for the input By) string “cccaab” to the above designed TM. eeeeK Ay cccoa b- Kaye col, x Cacaak |- * Cc 4 Aah y x04, CY ab x Cc Kal [- Ka, ceN ab Se &xCC yab XK @ycc Yob F x xa,C Yak L xX ce Yolo \- xx CY a ob \— X¥¥ OMY XX 4% Ye bE Xa2%¥ CYYD bk ¥X4CYVS I X¥ X WY \e ¥¥ KP US K ¥KY FA Lxx%tYay2 Ex ¥¥ a, YY We X¥¥UKYYZ LX GIS Lv XK Yat JE KX KY Ae LE XXX YYZ 428 Lb ¥RX* YY Z B48

You might also like