100% found this document useful (1 vote)
2K views121 pages

Sunstar Atc

vtu scanner

Uploaded by

Grusha Gs
Copyright
© © All Rights Reserved
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
100% found this document useful (1 vote)
2K views121 pages

Sunstar Atc

vtu scanner

Uploaded by

Grusha Gs
Copyright
© © All Rights Reserved
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/ 121
WY V VY VV YY. Automata Theory and Computability CBCS Model Question Paper - 1 CBCS Model Question Paper - 2 et CBCS Model Question Paper - 3 - a CBCS - December 2017 / January 2018 ed CBCS - June/July 2018 ia ‘ CBCS - December 2018 / January 2019 oat - CBCS - June/July 2019 CBCS - December 2019/ January 2020 - 7 ; 4 CBCS - January / Febraury 2021 61-76 ‘Scanned with Camscanner As Per Now VTU Syllabus w.e.f 2015-16 Choice Based Credit System(CBCS) SUNSTAR SEE AUTOMATA THEORY & COMPUTABILITY (V SEM.B.E. CSE / ISE) Scanned with CamScanner Note mower any FIVE full question, seeing ONE fal question from ench moda La Ans. Fifth Semester B.E. Degree Examination CBCS - Model Question Paper - 1 AUTOMATA THEORY AND COMPUTABILITY Max. Marks: 80 MODULE-1 Define the terms : i. Kleene closure and Kleene plus Language Alphabet Finite automata (08 Marks) Keene closure and kileene plu ‘The kleene closure D* is defined as follows: D=DUP UB... Titiet isthe set of words of any length. Each string is made up of symbols only from 3, 40,1), 2°= (00,01,10,11) .. (,0,1,00,01,10,11....) ‘ ‘The kleene plus is a variation of klene star operator. The kleene pls is denoted by is defined as follows E=PULULU ‘which i the set of words of any length except the nul string. Ex: B= (0,1,00,01,10,11...) fi, Language : A language can be defined as a set of strings obtained from Z* where set of alphabets of a particular language, Formally, a language ‘L’ over 5 is subset of E* which is denoted by Le Z* Ex:L= (€,01,0011,000111,....) Alphabet A language consist of various symbols from which the word statements can be ‘obtained, These symbols are called alphabets, iv. Finite automata aa Finite automata (FA) are computing devices that accep recognize regula language ‘The FA acts as mathematical models and are used to study the abstract machines or abstract computing devices. i L= (We B*| Wis the language accepted by FA} | Sanstar Exam Seanter ee 3) Scanned with CamScanner V Senv (CSE / Ise) b’sending with the st 's and, | Ss Construct the DEA to accept tring of a's am. b's ‘ni also write transition table and transition fi Ans, ‘is transition function, 2. a. Obtain the NFA to accept the language iL (w]w abab* or abat where n> 0} _. GL | we 0101 oF 101 or OL) (8: Ais. 1. Convert the following method, NPA 0 its equivalent DEA sing Ou© ‘Scanned with CamScaner GBCS - Model Question Paper «1 ‘Ans. Step 1:4, isthe startsure Step 2:2 fa, ni 93: 0 “thi ia Ne {a ys (e884) (44,83) step Fin an fe ee Fo= {ta (0.933, {q,¢ ena Slep 3 Ment transios fas Forstate Inputsymbol=a Input symbol =b 5, .a)= By (bb)=9 Forstateq Input symbol=6 5 (fa,}.0) = {q,) Input symbol=b 85 (Ka), 6)= (a) Input symbol= 6 Pt ByCtahb=> Forstate(q,9,): Tnputsymbol Inputsymnbol=b 85 =({9..91},8)=84 (fa..0)},8) 5. ({a,.a,},b)=8y ({4,.4,} 6) * =8u({a)-a)U8, ({a,},8) = 54 ((4,},) U5, ({a,},) = {aa} U6 ={a..0)) Tnpatomeei Intl Fo({a.r4:}s0)=8y(l4.045}-8), Bo ({a,.93}:6)=8y(f4,.4:}.6) ) U3, (a:}.8) w ({94},6)U8 x ({a},b) For state (4,4, jue =a.) U8 ) y: tate wleeh)-b(laata) — Sllvaltl-d(la)) ((a}) U8 (0) l(a) 08 a8) =6Ud a.) U8 7 ls) ‘Sunstar Exam Scanner ‘Scanned with CamScanner 5 V Sem (CSE / ISE) =b ornate a8" ta) 8) Ca i deow 5, (0) 2) Fall 5, ({40-91»4 = By (Ider 2b y ({4oe Oa lah) (eo) ) CH) Gout = f4,.q,} USUE {4092} = {aa} ves observing from the table that ‘AT is star . wwe have 8 stat ao TADEE rest ofthe states are not reachable hence states reachable from A are climinated, 3S ofA D E >|m|>]— Module - 2 3, a. Whatis regular expression? Obtaina regular expression toa language® of strings of 0's and I's with almost one point of consecutive O'S. Ans, seul exresion esse defined as lls: 1. is a regular expression denoting an empty | language. a 2.2 isa regular expression indicates the language containing an empty ‘Scanned with Camscanner (CS « Model Question Paper - 1 ee Ans. 3.s a regular expression which denotes the language containing only (2). 41fRisasepular expression denoting he language, and is 8 el expression denoting the language L, then a. R+ Sis aregularexptessoncomespondng tothe language, UL b. R Sis areolar expressioncomesponding tthe language Ly «.R* isa regular expression coresponing othe language L 5. The expression obtained by applying any of the rules from | to 4 are regular cxpresions. RE=1*4(1+01) (1401) 4401)" an(401)¢ State and prove pumping lemma for regular languages (08 Marks) Let M = (Q.,6, ,F) be an FA and has ‘n’ number of states. Let L be the regular language aceped by M, Let eqensy ting x an be broke int the substings tv and such hat X=ww Satisfying the following consns V#eie,|Vi21 isn Thea ww isin Lfori2 0 Let X= 4,48, «a, where m2 mand each, iin. Herm represent the stats of DFA. Since we bave mint yb, aural we should have mo tates in the sequence qq, where willbe the tat ate and, willbe the ial tate thom bn =O+O+O oO siete pigeon ne print posiblts avei wanstions Geof sae can iaves ple sting ide in tee stig Showa low Theis pou isthe stig pic om 0 Thesecondpoup ie opting fom Thethed group testing si fom 5 observe from above figure tay the prefix sting u taxes the machine om 9,9, te loop string takes the machin from 09, Note = q) and sux sting W Toches the machine from , 4, -The minimum string tat can be acepted by the above FA is uw with = 0 Sanstue Exam Seantor 7 ‘anneal wth Camscanner Bt, when = 1 the sing ww cepted bY DP ET om ito {> Othe machise goes fom qo oq on input sHMEN OE the machine wi the value of then goes to aezefing atom inp SNE ‘The machine wil by te tin Boa ince qi and qj are same we ean inp in state qi only. Finally, of times and the machine wil stay in 4, the machine'eaters int fina stat (08 Marts) Show that = (wt) we(@H} 6 m4 EBHBE, yee string Let Lis regular and n be the numberof states i ithe inputs X= [opal 00..0looal Whereis the sumber ofthe aes OFFA, w= [e100 and verse of wis given by w= 0. Ooad hoc plosn we can split the stringxnto wo such that a and|V|2 1 2 shown below 1 : ‘Where [o=net andy = sothatu =e] =n-l + =n whlch te aero, he ‘to pumping, lemma, vw e L fori=| Fee e oes ot appear and sot number of son the lft of wil be les han reac of son the right of x and so the string is nt of the form wow So mw aan. This a contradiction to the assumption that the language i egua So, the language L= {wii| w € (0*1)*) isnot regular. bb. What is table filling algorithm? Explain the procedure fo minimize DEA. (08 Marks) ‘Ans, The table fling slgrithm is used1o find the st of stats that are distinguishable and jpdistingishable states. The algorithm is recursively defined as shown below Step 1: Identity the inital markings for exch pai (pa) where p © Qand q € Qui pc and pe For vee vers the, the pir (79) i indstinguishable and mark Be paic (Pa) Btep 22 Identify the subsequent markings: For each air (p,q) and for each a € © nal (pa) = €and (qa) = a Ifthe par (cs) i already marked as distinguishable qh the pai (pa is also distinguishable and mark it as say x". Repent step 2 no previously unmarked pairs are marked ‘Algorithm to minimize the DFA s shown below Step: Find the distinguishable and indistinguishable pairs: using the table lie algorithm: jruinthestatesofmininzed DFA: These g sndistinguishatle hese groups consist ofindistingi ps uid evs Sey a inl ingle pain ol ets gos step an nvidal dinghies. The groups ote States of minimized DFA. stale. The, groups obtained He Step 3¢ Compute the transition table if [p,p..n isa group and i 8(Lp,Pe~® 8 ‘Sunstar Exam Sette Scanned vith Comscancer BCS « Motel Questiow-Pape ae ee 49° Ee tf a abel the eve with the symbol, Follow this pro gc obtain in step 2 and french at 3 ep 4 Ioatify the stat state: Fone of the component in the Up [PP consist oF a stat state of given DEA then Py, fd ithe bra Step: Mdemtify the final stat ifthe group [Py Pye Ale oF Ate the group [PP 94] 6 Final state of Module -3 a, Explain the clasiicaton of grammars with example (08 Marks) ins nfl state of given ized DPA, Typed grammar phrase strvetured grammer) Typesot — Beeicieiai Z Typet grammar (Context sensitive Yeti f ‘Iype3 grammar (Regular grammar G = (VTS) is said (0 be type O grammer or uneesticted grammer oF propose structured grammer ill the production are of the of the form a Bwhere ae(VUTY avs Be(V UT) Ex: Sa Able aA DAA basa grammer G= (VP) is said tobe type 1 grammar or context sensitive all the productions are ofthe form a —» basin type grammar But, there isa restrietion on length of. The length of must be atleast as much a the length of aie fl fal and @ and Be (V UTY'ie., ¢ ean not appear on the left hand or right, hhand side of any production, Ex: Saab aA DAA bA— aa ‘Type 2 : A grammer G = (V-T,PS) is said t be type 2 grammar or context free grammar if all the productions are ofthe form A+ a where aa(V U T)® and Ais ‘non-terminal 2 Ex: S—»aB|bAje A-aA|b B+ bB hale ‘Type : The grammer G=(V;T0S) is sid tobe type 3 grammar or egular grammar ifthe grammar is right linear or left linea. A grammer g is sd tobe right linear if all production are the form, A= wBorA>w Ifits lef linear, all production ofthe form A= BworA—w Ex: S—+aaB| bbAle ‘Sanstar Eaxam Scanner 9 ‘Scanned with Camscanner And Compt Asalb BbBlale ». Obtain grammar to generate the following mg4aBe (Nay L= for we (a6}4) ) ‘Ans. The language can be writen as . bb ab baab,. cn | Coane a te cs aig ia plone of eV" length, This ached y deleting the production Sab. Sothe fina grammar is given By Sa $10 Sa] bSb G= (WTS) canbe defined as Vets} T= {ab} . P={ Sasa] bab Soe ) Sis start symbol OR 1s the following grammar ambiguous? 08 a (08 Marks) Aas |bAAla B—bSjaBBIb i sm Echt an / a ; ON = aabsB oe Sn ANN > aabbaB v sb Sait aN Left most derivation s For string aabbab, more ambiguous. Manone parse te say 10 Scanned with CamScanner ; CBCS - Model Question Paper b, Obtain a PDA to necept the language Lm) = (wCw" |we(a+b)*). (08 Marks) ann, M=(QE.180,7.4) iuage L(m)= (wCw®| we(ath)*}. (08 Marks) 8(4,,0,2)= (qa) 8(a..618) =(q.8) (4:5) =(0.0) B(an2,)=(a2,) Module - 4 7. a, What is left recursion? Eliminate a left recursion from the following grammar. EE+T|T ToOTRE F+(@)|id (08 Marks) ‘Aus. A gramme Gis sid tobe left recursive if there is some non terminal A such that AD aa ‘The left recursion ina grammer G can be eliminated as shown below A> Aay [Acts] Acts eon IB, Lon By Wherep, donotstat with A A>BA',4'B,4' Aah fa,A'fa Sanctae Exam Scanner 11 Scanned with CamScanner Z| V Senv (CSE / IS) Automata Theory And Computeddity Vsenv(Cse (1st) Automata Theory A [A Aa,7B, | Sbstttion | Withoutet recursion jeseet/T ce an Blostel/e 7 i Tor [otter | a=" potrtie R=F F>(e)fid [Notepplicabid —F->(e)lid ETE! ; Esatele TFT Pr |e Fo(@)lid b. Eliminate all production from the grammer, (08 Marks) S—+-ABCa| bD A= BC|b Cee Daa ‘Ans. Step 1: Obtain set of mulabl variables from the grammer ov [av | Prodoeton Boe @ [ac] es Be [BGA] A>BC [CAT BGA B,C,A) are nullable variables ‘Step 2 Construction of production pt [Productions Resuiting productios(p) '5-> ABCa |5-> ABC, [BCs|ACalABalCe[AafBala $968 Sup |A->BC|b A-Bc|BIclb Bole Bob c-+Cle coe Dod Dow Sanat Exam Sete“ g Scanned with CamScanner pcs - Model Question Paper - 1 ea Gi=(V.T PhS) $+ ABCa)BCo|ACa]ABal Cal Aa|Balel60 ABciccp B4b.C-+6D54 Sisstartsymbol OR 5. 4, Explain two forms of normal forms, ‘ns There are two diferent types of noma forms, 1. Chomsky normal form (CN) 2.Greibach normal form (GNF) 1. Chomsky Normal Form (CNE) : Let G= (VTP) be a CFG. The grammar G is std tobe in CNF if all production ae of the form A= BCorA—a Where A,B and C € Vanda eT ‘Note that ia grammar sin CNP, the right hand side ofthe production should contain ‘wo symbols or one symbol If there are two symbols on the right hand side those ‘wo symbols must be non - terminals and if there is only one symbol, that symbol must be a terminal 2. Greibach normal form (GNF) : In CNF thére is retiction onthe number of Symbols on the right hand side of teh production. Note that in CNF not more than two symbols on RHS of the production are permitted. If there is only symbol that symbol must be a terminal and if there are two symbols, those symbols must be variables, In GNF there is no restriction the number of symbols onthe right hand side but there i restriction on the terminals and variables appear on the righthand side ofthe production. G=(VIE.PS). The 'G; is said to be in GNF ifall the productions ae ofthe form A a0. Where a eT and € V* ie, the first symbol on the right hand side ofthe production (08 Marks) b AM OAA|IS|1 B-+1BB| 050 Obtain the grammar in CNF (08 Marta) Sutstne Exam Seater 13 > Scanned with CamScanner 7” V Senv (CSE / ISE) automa, Theory Ande Compute a ™ Given production: “Action, Resulting production S=0A[ 1B Teplace 0 by B, and introduce acoA BB production By} ra Feplae 0 by B, and intoduoe |B, the production BL Teace 0 by B, ad anee| A> BAAAIBS B,—+0 Replace 1 by B, and introduce) BF Bol B= IBIS Replace 0 by B, and introduce Bees Bo > Replace 1 by B, and inode |B, — 0 Bot (VERS) Finally V,=(54,B.B.8) Gi =(V.T,P,S)in NF T={0) ¥,={5,A.B.B,,8,D.D3} (0.1) ‘A= OAATIS Ret S>BAIBB A-B,AAIBSII S>BAIBB, 3B >B,00)0,S10 ‘A BSIIIB,D, B90 B->B,S/01B,D, Bot B30 ' Bol Sisthestartsymbol DAA D, BB ) Sisthestartsymbol Module -5 tin aap mahinet cg enue (oars) Ans. M=(Q.5.05.4,,8,F) Where Q= {4.44205} Zefa} T=(0L%y.8} 4, €Qisthestatstateof machine 4 4 ‘Sanstar Exam Seat Scanned with CamScanner CBCS - Model Question Paper - 1 “BeTistheblanksymbol F(a) isthefinastate Bisshownbelow: 5(4,.0)=(4.XR) 8(4,.0)=(4,.0R) 8(.¥)=(4n¥.R) 8(aut)=(4,-¥,L) sg “Tape symbols States |_0 T sea] aa¥) B a [@xm| = (GR) 4, | (4.0.8) | (@.¥5L) (a,¥.R) a |@ob] = [aX] 6%) 4 (ay¥.L) | (agB.R) b, Explain, L turing machine as multistack machines IL semi-infinite tape (08 Mars) Turing machine as multi-stack machines:- Multiestack/track Turing machines, a specific type of Mult-tape Turing machine, contain multiple tracks but just one tape hhead reads and writes on all racks. Here «single tape head reads n symbols from tracks at one step. It accepts recursively enumerable languages like « normal single- igle-tape Turing Machine accep. ean be formally described as a 6-tuple Ans. QX5, © Qisa finite set of states «© Xisthe tape alphabet © ise input alphabet © Bisa relation on states and symbols where B(Qi, [0,89 8p ]) =, (b,By Byrds Leftshit or Rightshi) © quis the inital state (6 Fis the set of final states Satshar Exam Seanner 15 dy F) where ‘Scanned wth Camscanner V Sem (CSE / 1S) Automata Theory And Computability Vom (Cse/156) Automat Theory And COMPARING Note - For every dglewrack Turing MasineS, there is an equivalent malta Turing Machine M such that L(8)= LM). i a TL. Semi Inte ape-ATuring Machine with semi-infinite tape asa Tefen ur ‘0 right end. The left end is limited with an end marker. Itisa twostack tape ‘Upper track - It epresents tho cell to theeghtof the intial head posto Lower track It represents the cll tothe left ofthe inital head position onder. The infinite length input strings intally written on the tape in contiguous tape cel The machine stars from the intial state qo and the head scans from the eft end marker ‘End’ Ineach step, it reads the symbol onthe tape under its head. It writes new symbol on that tape cell and ten it moves the bead either into left or right one tape cel. A transition fancton determines the ation tobe take, Tehas two special states called accept state and reject stat. Ifat any point of inet enters into the accepted tate, the inputs accepted and fit enters int the reject sta, the inputs ejected by the TM, In some cases, it continues to run infinitely without boeing accepted or rejected for some certain input symbols. [Note - Turing machines with semi-infinite tape are equivalent to standard Turing machines. reverse OR 10, a Explain Halting Problem ‘Ans. Halting Problem: Input -A Turing machi Problem - Does the Tying machine finish computing of the string win a ite numberof steps? The answer must be eter yes or no. a Proof - At fist, we will assume that such a Turing machine exists to solve this problem and then we will sow i is contradicting itself: We ileal this Tung ‘machine asa Halting machine tht produces ayes’ no’ ina finite amount of ime If the hing machine risks ina rite amount of time, the output comes a ‘yes otherwise a ‘no’. Te folowing is the Block dag (08 marks) and an input string w. sofa nen Inpat [Yt pt string—>} : ee [>No Nd tat on put) 16 ‘Sunstar Exam Scanner Scanned with CamScanner BCS - Model Question Paper - 1 Now we will design an inverted halting machine (HM) as~ ‘© If returns YES, then loop forever, ¢¢ IF H returns NO, then halt, ‘The following is the block diagram ofa Halting Inverted halting machine’ - Further, a machine (HM), which input itself s constructed as follows - ‘¢ IGM), halts on input, loop forever. Else, halt, Here, we have got a contradiction, Hence, Explain Linear bounded automata. ‘a tape of some bounded finite length Length = function (Length of the ‘Memory inform: The computation is restricted to the cot the halting problem is undecidable. th respect to hiring machines (08 Marks) A linear bounded automaton is a multi-track non-deterministic Turing machine with ial input string, constant c) Here, ion <¢* Input information stant bounded area. The input alphabet contains two special symbols which serve as fet end markers and right end markers which mean the transitions neither move right of the right end marker ofthe tape. tothe left of the left end marker nor tothe ‘A linear bounded automaton can be defined as an 8-tuple (Q, X, X, Qo, ML, MR, 8, F) where - © Qisafinite set of states ‘© X is the tape alphabet © is the input alphabet 4, i the initial state ‘© M isthe left end marker ‘¢ Mr is the right end marker where M, °M, symbol, Constant ‘e" «¢ Fis the set of final states «© 5 isa transition function which maps each pair (slate, tape symbol) to (state, tape where e can be 0 oF + oF -1 i] Left End Marker Right End Marker ‘A deterministic linear bounded automaton is always context-sensitive and the linear bounded automaton with empty language is undecidable, 17 Sunstar Exam Scanner Scanned with CamScanner Fre Bxainaton 1estion Paper ~ 2 Fifth Semester B.E- CBCS - Model Qus Time: 3 hi ‘AUTOMATA ‘THEORY ‘AND ‘COMPUTABILITY ime: 3, fat oe ve eo ate NEA CASON a MODULE-1 1. wm. Construct a DEA which acepts strings of 's and 1°5 where the value of string ls represented a a binary number only the stings representing Inodulo Sve shoul be acepted- can ) Ans. 8(q.)=4, whee j=(otied)medkwithe=2andke=S So, j=(2i+d)mod5 [Remainder] 4 | (2*1+d)mod (0 | (2#0+ 0)mods T | (2*0+1)mod5=1 | (21+ 0)mods =2 1[ (21+ i)mods=3 |8(q.1)= 45 (0 | (2*2+0)mod5=4 [(a,,0)=a, T]@*24Dmods=0 [(as)= a 0 | (2#3+0)mod5=1 | 6(qs,0)=4, Tf @>ei)modS=2 [lq I)= a, 0 | (2*4+0)mods =3 | 8(q,,0)=4,| i 1] @*4+i)mods=4 [(q,l)=a, izo t EEE ls le |e |e belo. EFFFEE 18 Sunstar Exam Seat Scanned wth CamScanner Ans. Step 1: Ident (08 Marks) 5 O+© the state of DFA, os Step 2 : Identi ©, is the start state of NFA, [a] is ify the alphabets of DFA : The i input alphabets of NFA are the input phabets of DEA. So = {ab} eee Step 3 : Identify 2D which ret sates of DEA Str fom the stat sa gad find the transition as shown below “oes 7 Forstateq 2 Inputsymbol=b (0) 8) =fa,.0) Fo((0,}.)={a,} Forstate (q, Inputsymbal Inputsymbot=b Fo({4.-41}2)=3y((9,,4,},2) Fol(-4),0)=8, (fa,.0).6) ~5u((a,}.a) U5, ((a,},a) Fo({a,}.b)U5,(f4,).6) ={a,} Ufa} 14a} For state {4,.4,) : Inputsymbol=a Fo({a.043}.a)=8y ((a.,43},8) = Bo ({a,},a)U5y((4,}.0) Inputsymbot =b Bo((a.43},6)=8, ((9,.4,}.6) =5u({a,},)U8, ({q,},b) Since, no new state is generated the procedure is terminated, Step 4 : Identify the final states of DFA : Since above set, wherever 4, state of DFA so 4, isthe final state of NFA in the is present as an element, the corresponding set is the final For tga) — ~| ta) [aad | tay . -[aTe Tx (earl eadf ites] Byemnig FB ate * Toa) Ttaoa)T to) 19 Sanstar Exam Scanner ‘Scanned with Camscanner V Senv (CSE / ISE) oR below : cuisine ee penn tg TAH _B+©O ine regular expression. (08 ‘he above FA can be written; 0,1 What is the language corresponding t0 1 ad, = 2 by renaming the ats, o Basis: When k=0 RO cH Tnudution: The regular expression corespoding to the path rom sae through a stat which sot higher than ks given by Rant 4 REM RE] RE? = Wheak=t RY Rg +R [RPT RP (e+1)+(e+I)(e+I) (+l) RORY TRET RE =0+(e+!)(eriyo 0410 "0 ” ‘Sanstar, ‘Scanned with Camscanner CBCS - Model Question Paper - 2 Pensi[ne yee + (641) (esto RP =RY +R [RYT RY +ro(e+oriyg =v RR +RYLRYT RY =T0+10(e+041) (e+ 041) "0+1'0(041) (+041) =ro(o+iy RD =RY +RY[ROT RY =O(e+0+I)(e+o41)'4 =o RQ =RY+RYRET RY =(€+0+1)+(c+041)(e+041) (c+ 041) =(c+0+1)+(041)) =(0+1) SoR}, =1'0(041)" So,the regular expression forthe gven DFA 1001) whichis ngage consisting ‘of any numberof i followed by a zero and then followed by string of O's and I's b. List and explain applications of Regular Expressions, ‘Ans. 1) Regular expression in unix 2) Pattern Matching 3) Lexical Analysis 4) Unix editor Sunctar Exam Scanner (08 Maris) 2 “Scanned with Camcanner V Senv (CSE ( ISE) Ans. 22 - Show th oa ne exesively eda a Regula xe ged in UNIX lation 1 Regular expression nd no example, te symbol nein stem: eres rogue expression a+ b which complex el eS) stan pean “ZrO OF one Torany charter the #9 ie ope ‘ foray tare eh sul xeon Fre th oper pe inked ech fr a pate of of cmmand sion an eit) wel ne common prope S Parern Machin: Rel search ora tng int 2) ater Mai ial a edn the deen Spex Analyse: Regular PSI recognizer the tokens analanrhase Th pase sans tH SATE ex accepts regular exp cE aE A on rte ao odes th Xi er al tetas lo i = ne ey ea or nal ithe command specified is abet specif pte in ie ah stars with ab followed By Zero or more followed by the symbol C. Module - 2 ‘Show that L= (at | if} isnot regular 3) ‘Step 1: Let L is regularand be the number of states in FA. ‘Consider the string x= 26" Step Siep=2n 120, we cin splint we such hat nad as shown belo a ab" jan) =e andsothat ‘Step 3+ According to pumping lemma, wv w ¢ L fori>0 i.e() a*IL oreo Now ie coos = 0, unb roa fs inw wich sconalton ‘the number of b’s, eee So, the langage in ring w will bot be less than thea ‘ssumption that number of sare m0 0b | Pj) isnot regular Theory #1, and L, regula languages?" 86 then L, UL, Le “a Proof Is ten tht yy Ly* Ly and L,* also eno expression , and Kush ge Hy A regular ‘that ‘Saul languages , so there exist ‘Scanned with Camseanner CBCS - Model Question Paper eS ModeQuertiowPaper-2 L=L(R,) L,=L(R,) By the definition of regular expressions, we have | 1-R, +R, isa regular expression denoting the language L, U Ly 2R, Risa regular expression denoting the language Risa regular expression denoting the language L* So the regular languages are closed under union, concatenation and star operations. OR 4. Obtain the minimized DFA for the following, (10 Marks) ayo] =Al BDA 2 Tate clips “DL DLA E[D[F F [oe oF Te ulo[p ‘Ans, Vertical and horizontal marking B c + Dixixtx E x F x ¢ x H x a[elc[plelFle ‘Sunstar Exam Seanner 23 ‘Scanned with CamScanner 24 8 AD) (AB) (BD) (BD) (AP (BO) (AG) (GP) (BO) (AD) (8) (AG) (BG) (AD, (AD) (CE) (Ao) (DD) (0.0) (DP) (0.6) (0.9) Or (0.6) (FS), GF) (GG) 9) (BA) (BG) “lobe bebe] BIEIEIES (AG) BA) pele [=| = ele [ % (AG) op =|5]o[= (BF) A) (Ch) (DD) [el eal [ [> ERIE GA > le +o (A.GXB,F) & (C.E) are indistinguishable (DH) are distinguishable ‘Sunstar Exam Set Scanned wth CamScanner a % =49 [OH Tao @F | As) CH ce [DC 2 Das) Hao lp ' 4, What are the limitations of finite automation. (06 Marks) ‘Ans. I. An FA has finite number of states and soit does not have the capacity to remember «rbitrary long amount of information FA cannot remember a long string. For example, check whether the string isa palindrone or not ‘ete, are not possible using FA. 5. Finite autoyata or finite state machine have troube recognizing various types of languages involving counting, calculating, storing the sting. Module -3 Obtain a grammer to generate the language (oMtarts) iL={qb™In23} HLL, wher Ans iL= (atbe|n23) ' Itis clear from the above statement that the set of strings that canbe generated by this language canbe represented as L= (asa, saab, sasnabb,..} S— ama Asabble . So the final grammar that canbe generated is V= {SA} T= {ab} P={ [a°b* n20,m>n}t, S—aaA A—aAble } Sis start symbol ‘Sanchar Exam Scanner 25 "Scanned with GamSeanner a nd Compl V Sem (CSE / 15) Automator TROT) A aby perk, De (etet a2 gma) Ly={01|n>0) Ans. 6a Ans. 26 . Obtain the sti =8,—708,|bB 8,788, b| dB soslife BobB|b S, is stan symbol. axa rom the grammar shown below and verify whether (06 Mari) ‘the grammar is ambiguous or not Srna 2 Ses Nain 2s 2 iho 2iss = tases | ibtaeS o ! SHE odie crewing a For the grammer $—aABC | Anabla Bo bAsb Coa ‘Obtain the corresponding PDA cane) Stop: Posh the stat symbol on othe stack and change the state to 8 441) =(ay SZ) step 2+ ‘seat Sanchar Coan Scanned with CamScanner BCS - Model Question Paper -2 _—$——$——— rope 2 Production | Trams S= adBC |8(9,2.5)=(q, ABC) A> ab |8(9,.2.A)= (4,8) Axa [8(9,0A)=(q.2) Bo bA [8,63 Bab [aq r Cra 54.8.) =(q,, e) ‘Step 3 Finally in tate g,, without consuming any input change the state tog which is an accepting state ie., (4, ,€Z,) = ( +Z, O=(aara) a E={a,b} T={S,A,B,C,Z,} B:isshownbelow 8(q,a,A)=(4,e) 5(a,b,B)=(q,.A) 8(aisb,B)= (4,2) 8(aa,C)=(4,8) (48 2Z,)=(de02.) 4g, € Qisthestartstateof machine Z, ¢Vistheinitialsymboton thestock Fa(q,)isthefinalsate b. Obtain a CFG that generates the language accepted by PDA. (08 Marks) } {a,b} {A,2},8.4,.25(a7}) with the transitions Resulting production (g,Ag)= 27 Scanned with CamScanner The tansitions Basa «ae Bq. A)" AA Teeber tit) lon B( )=(9..A8) Resulting prot ae TeFanyralacha Hua dio (ash Z4.}a42a) Slender ezadlaranrn) (aza)=>b(a,A0, (a At)O(AG) 8.) S(a%A)=(-AA) | G79) -rb(quAan) (AAG) MAGI GLAL) Module - 4 2. a Eliminate the wes symbols the grammes Saran B Acaala poe Dosa Poach (08 Maris) Ans. Sra re | New vara [ ons ape | Ase Lar E-of ADE | ADES J San . Does ADES_[ADES ‘The result 28 irammar G, (51, P; 5) where Sisstart symbol Sunstar Exam Seay a Scanned with Camcanner acs - Model Question Paper - 2 cae, sad a SA aaaea |e | SA Sav.tP Ss) Saaa Asvalad } Sisstar symbol >. Eliminate all unit productions from the grammar. SAB : Asa BoCIb cop D-E|bC E-djab (08 Marks) ‘Ans. The non unit productions of the grammar G are shown below SAB Ava Bob p—ec Ed] Ab Unit productions ofthe grammar G are c= DoE tis eléa fom above graph D => E, so all non unit production generat 7 also be generated from D. La a “The non unit production from Eare Ed Ab ‘Also be obtained from D Ded] Ab “The resulting produciton ae Dc D—djAb Similarly ‘Sunstar Exam Scanner 29 ‘Scanned with Camscanner oe \ and Comput V Sem (CSE (188) eos cae Cmeas Bo Baas Ba V's (SABCDE} Ta iahe) _—. SHas Ane Body alae cae] slab Doe] aas E—ajab Siste sar symtet OR Sa Convert the following grammar G fo GNF (08 Marts G={(A.AnA,). (2.0). P.Ad where, poonsistsof the following Productions A GAA APA AID ASA ‘Ans. We observe A, — A.A, isthe only substitute A.A, for A, in production A, A, A, ‘The resulting set of production A PAA, A, AA LD AP ALAAs | ‘Similarly A, inthe production rulefor A, with A,A, and eeluction with A, on the hand side, Lets AAA, AALD AAA AAS DAYAL A, bASAB, A,B, B, > AAA: AAVASB, Resulting Seach Exam Sea Scanned with Camcanner 30 AAA ID (A, BA,A;B, 1B, [BAAs I BLO AAALAAAB: ‘Nowallthe production for A, arealln GNF AAAS SP BA,ALByA, [ ABSA, [BAYA [0A 1B ‘A, A,A,B, [2B [DAA 8 BLO AAAIAAYAB, ‘Anequivalent grammarinGNFthscanbe written as A, -3BA,A,B,A,A IaB,A,A,[DA,ALAVAST ALAS TDA, [Ay -PBAYA,B)A [ABA DALAL [2A IB 1A, > DA,A.B, [AB [bA,Az 18 B, >DA,A,B,A,A,A,A;1DA,A,B,A,A,A,A,B, BB,AVA,A,As I2ByA,A,AVA;B,IBA,A,A,A,A,A, [DAA2A,A,A, ABB | AA,A,A,A,|04,A,A,A,B, [DA,A,A; [DA,A,A,B, ‘Show that L= {we (abs}}* where ,(v)= n(n) = n,m} is not context free. (08 Marks) ‘The language L, = {a" bt c* | n20} is obtained by the intersection Land the regular language represented by the regular a*b*c* ie., {a"bre*[n2 0} =[a*b%e*n{w] we{a,b}}* wheren, (w)=ns(w)=n.()} ‘We know that intersection of context free language and regula language is also a context free. But its already known that mee = ve 1, ={a"b'c"|n20}isnotcontex fee Since, isnotcontext fee itimplesthatthe siven language . L={wlwe a,b,c} wheren,()=n,()=n,(w)pisnotcontext feandnot context fieegrammer. Module - 5 Explain the concept of turing machine in deta ‘A Turing Machine (TM) is a mathematical model which consists ofan: tape divided inta cells on which inputs given. consists of «head which ads input tape. A slate register stores the state ofthe Turing machine, After reading an input symbol, ii repaced with another sybase ichnged et move from one elt the vig re If the TM each the alsa ey sting is aceptd, otherwise rejected, ATM can be formally described asa -tple ‘Surshar Exam Scanner 31 ‘Scanned with Camscanner Ans. 32 .. Explain in detail language decidability in the context of theory of comps XE. 90.8, Deter finite set of states Shave’ alphabet isthe input alphabet 5 is a transition function; 8:Q x X + QXX* is the initia state Bis the blank symbol F isthe set of final sta ‘Turing mat a tesae machine that has an unlimited supply of paper tpg thot itcan write on and read back. There are many formulations ofa Turing rosin but essentially the machine ead a symbol fom the tape, which is used as Tate nate hn ask the input symbol on serding any current state does thee thins: 1 prints something onthe tape 2. Moves the tape right or left by one cell 3. Changes to anew state {uot shi Right_ shit) ‘A Turing machine can also perform a special action = it ean stop or halt = and surprisingly i is this behavior that attracts a great deal of attention. For example, a Turing machine i: to recognize a sequence of symbols wrt fon the tape if itis started on the tape and halts in a special state called final st. ‘What is interesting about this idea is that there are sequences that a Turing mache ‘can recognize that a finite state machine can't, on. (08 Maris) ‘language called Decidable or Recursive ithereis Turing machine which cep ‘and halts on every input string w. Every decidable language is Tuing-Accepabk. Norling pas gaps | ing sce el Scanned with CamScanner Model Question Paper - 2 {dein mblen Piast ngage ol yeinsanecsPisdesitabe, Fora decidable language, for each input sting, the TM halts either atthe accept the eect state as depicted in the following digram = Decision on Hae Je tejctes Inpu, J rccetes Example 1 Find out whether the following problem is decidable or nat = Isa number prime? Solution Prime numbers= (23,5,7,11,13, — Divide the name nya the numbers between "and “Vin stating from any ofthese numbers produce a remainder zero, then it goes to the “Rejected state otherwise = itgoes tothe “Aceepted state". So, hee the answer could be made by Yes" or No Hence, it isa decidable problem State and prove the Rice theorem (08 Marks) . Theorem Rice’s theorem: Any nontrivial property about the language recognized by a ‘Turing machine is undecidable, A property about Turing machines can be ‘machines, encoded as strings, represented as the language of all Turing that satisfy that property. The property P is about the language recognized by Turing machines if whenever L(M)=L(N) then P contain (the encoding of) M iff it contains (the encoding of) N. The property is non-trivial if there ist east one Turing machine that has the property, and at least one that has’ Proof: Without limit it does, just take lity of that complement would immediately imply the undecidability of P, In order to arrive at a contradiction, Turing machine B that recognizes th Using B we can construct a Turing is the desription of a Turing machin ‘i undecidable this wil show that B ‘Let MP be a Turing machine thats Now A operates as follows On input (M9), create a (description ofa) Turing machine C(M,W) as follows: On input x let the Turing machine M run on the string w until it accepts (o if it doesn't accept C(M,w) will run forever). Suppose P is decidable, ie, there is a halting 1 descriptions of Turing mact ‘machine A that accepts the language {(M,w) M that accepts the string w). As the latter probléan Cannot exists and P must be undecidable as wel satisfies P (as P is non-trivial there must be tar Exam Scanner 33 ‘Scanned with amscanner V Senv (CSE / Ise) Automata Theory And Computability ‘Next run MP on x. Aecept iff MP does, ‘Note that (Mt) accepts the same language as MP if M accepts ws CCM) accepts ‘the empty language if M does not siccept w. ‘Thus ifM accep w the Turing machine C(M,v) has the property P and otherwise it ‘doesn't Feed the description of C(M,wv) to B. IFB accep, accept the input (Mw); ITB rejects, reject. , Define ') Post Correspondence problem & ii) Quantum computation (08 Marks) ‘Post Correspondence problem ‘ ‘The Post Correspondence Problem (PCP), introduced by Emil Pst in 1946, is an Uundecidable decision problem, The PCP problem over an alphabets tated as follows Given the following two list, M and N of non-empty strings over £~ MAR) Xp X) N=O.0%~ 3D) . ‘We can say tha ther isa Post Correspondence Solution, if for some i ik, where get-nentsymbol if S~ end-offle then accept | Else ifs~a then goto S Else ifs= then gotoT T:8=] symbol if $= end-offile then accept, Eleeifs= a then goto T Else ifs= ben reject, End Sunstar Exam Scanner 35 Scanned with CamScanner V Senv (CSE / TSE) utomatw Theory and Computedbily VSem(CSE/ISE) Automatw Theory ha Ans, b ‘Ans. Ans 1 OR Define Canonical form for regular languages (04 Maris) A canonical form for some set of objects C assigns exactly one | representation 10 each class ‘of equvlent objet in C Further, ech sch repesenation is tinct so wo ober in share the same representation they ar “Equant in the sense for which we Sine the form : The ordered binary desision diagram (OBDD) isa cons for for Boolean expression that makes if posible for model checkers to ei the orcs of very ag consent syste and tare ccs Explain the Moore Machine with mathematical notion (04 Marks) ‘A Moore machine M isa sever -tuple(K,, 0,8, ,A) where: « Kisafint se of stats «Sis inpualphatet © Osan ouput alphabet # Se Kisthestanstte +A Kisthe set of accepting stats (although for some applications thieoe signaton i ‘etimporat) ‘Bis theranston function, Its the function fom (K) 1 (0*) AMoore machine M computes function ys) when it reads the input string wt pet sequences is) Construct a minimum state automaton equivalent fo a DFA whose transition table is show telaw (08 Mars) sae[ a] ® mala |e alafa afafa @) a] a a) a fa wpa fa olala fay). @ a4} oot suit -euvaentio,$,(0,5.} 65 quisnotl ~equivalenttog, 4,9, bla isl —equvsentog, Hencefay ay} €% isl ~eivalenttog butnott—egivaenttog,.q,0r4)- ‘Sanstar Evam Seanter ‘Scanned with CamScanner CBCS - Model Question Paper - 3 | BCS -ModebquertionPaper=2 So\lau.01}€%, 4ismott—equvalenttog, buttog, So, (4,95) ¢%, Hence, ={f4.44}s{42.44}-{9,.4:}.{4504:}} 4q,i82—equivalenttog, Sofq,,a] x, 4isnor2~equivalenttog, Sofas}, (ae) ©; 482 ~equivaentiog, Sof 4.93} € 5; 4gis2—equivalenttog, $0, {4,,4,) € {95,44} (te) fae} {aids} of45.43}} 4483 ~equivalenttog,:a,is3 equivalent tog, anda, is3~equivalentt0g, {8} f(a} Abs = emis szartonsons M!=(Q',{2.0). [ach {faa}) State a b Tal | teal | Gad Gaya | (oral | (4 ad : laa] | (aoa) | (a) (44) | (4,41 | fad fa _| ta) | ta) Module - 2 . Obtain the regular expression for the following language )L=(erbr|m>1az1,0m>3} iL=(ab™|n20,m20) (08 Marks) ‘Ans. I) L={atb=|m2> 1, n> J,nm>3} (Case 1: since nm> 3, ifm =1 hen n23 ie, RE is given by 2323" (Case: since ma 3, ifn = | then m 23 i, RE is given by abbbb* (Case 3: since nm 3, ifm 22 and n> 2 ie, RE is given by aaa* Bbb* So final regular expression is RE aaaa*b + abbbb* +aza® bbb* Ji) L= (a*b=| n20,m>0} For every n> 0, a results in even number of as and for every m > 0 b> results in even ‘numberof b's. The regular expression representing even numberof a's and b's is given by Hence RE=(a3)* RE =(bb)* so final regular expression is RE~ (aay 06)" ‘b, LetZ=(0,1)'= (0, 1,2} and b(0)~01, (1) 112, What is h(010)? ICL= (00,010) What {is homomorphism image of L? (os Marks) Ans, hw) = haba) Ma) (010) m0) AC) BO) = 0111201 ‘Surstar Exam Seanner 37 ‘Scanned with Camscanner V Semv (CSE / Ise) Automata Theory andl Computbiity CSE TSE) Automnater Theory and COMPU Pity Ans. Ans, 38 L= (00,010) = L¢s00, OID) = Lebo) (0), (OV) HCO) =Lotot,o1i200) MeO ay oo, 010) Loto, ont What are the varons imitations of finite automata? (04 Maris) 1) An FA has finite number of states and so it doesnot have the capacity to remember axbitrary long amount of information, Since it doesnot have memory, FA cannot emember a fong string, For example: Sting is palindrome ono. Finite automata or finite state machine have trouble recognizing various types of "anguages involving counting alulting string the sting, OR “Therefore D » - State and prove that regular grammars Define exactly the regular languages, (08 Marks) ‘Theorem :-The clas of languages that canbe defined with regula grammars is exactly the ‘epular languages ‘oof: We fist show that any language that canbe defined with a regular grammar cen te ‘ecepted by some FSM and sos regular. Then we must show that every regular language can be defined with regular grammar. Both proofs ae by construction ‘Regular grammar —» FSM : The flowing algorithm constructs an FSM M from aregue ‘grammar = (V, 2, R$) and assures that LIM) = L(O), Grammar to FSM (G regular grammar) 1. Create in M a separate state foreach non eral in V. 2. Make the stat corresponding to S he sat tate 3 there ae any rules in R ofthe form x» w, for some w e ¥ the crete an ational site labeled, 4. Foreac rule of the frm x —+ wy, 5. Fr each rue ofthe form x + w, 6.For each ule ofthe form xe, 7. Mark sate as accepting PM's incomplete, M requires den state, Ada ne stat for vey (pai for wich "o tasion has aed been defect aston from gta D aed Perce 3, eeate a transition rom D to label dda transtion from x toy labeled w. a transition frm xt labeled ve, mark tate X a accepting, 1b, Show that the set L (01> 1) isnot regular, (08 Marks) * Si Supe bral kinetin ante site auomaon Sen Sepa; Let =a" Then => n. By pumping Lema, we can wes ps tae ‘snand(y|>0. Step 3: Consider ay | yl ~ +2 +> + bias > 0. This means x IaL# bl lel < yl Ashe a, write Z= wv way, where [vx] Ie. at legs one of orx isnot A, Step 3 urway = abe. As | <|Val Sa. vor x cannot contain all the three symbol ab. So i) orxis ofthe form sb (or be) for some ij such tabt ej 10 when S08 + Ta+3 = 573 <108forn> 10, Sa?+70+3 (8) ConsderthestateB: When inpatisa 8(B.a) = ECLOSE(S, (B.a)) =ECLOSE(S; (1.2) => ‘Consider the state C : ‘When input isa 8(ca) = ECLOSE(S, (c.)) = BCLOSE(5,(2.3.4.6.9}.2) =ECLOSE(S) =(589,3.46) ={3.4.5,6.8,9} (D) Consider thestteD When inputs a 8{D.a)= ECLOSE(5,(0.)) =ECLOSE(6, (2.4 a “automata Theory E- COMPO en ingots a McLosel (a0) = BCLOSe(6¢ (046) =) inpatsb bent scLOse(5, (8:4) = BCLOSE(6,(1b)) =zc.ost({(2}) ={2,3:4,6.9} (6) ‘When input is b '3(A,b) = ECLOSE(8E(A,b)) =BCLOS(, (24,69},6) =BCLOSE({7}) =(089.346) ={3.46.7,89} >(B) Wheninputis 8(B.b) “ECLOSE(8,(8,0)) = BCLOSE (5E{3.46,8.5.9},8) =BCLOSE(7,8,9,3.4.6) 34,6} = {34,6,7.8.9} >(E) 4.6589} +(0) Consider thestte: When nati a: Wheninptisb i(€,2) =ECLOSE(6, (Esa) 5{E.t) = ECLOSE(5,(B,5)) CLOSE(5 {3.45.67.89}.) = ECLOSE(5,(3,4,6.7.859)4) = ECLOSE({S}) = ECLOSE({s}) =(589346) =(5:45,689} (0) 89,346) 46.189} +) Eee Ea ene . “ ‘Scanned with Camscanner CBCS - Dee 2017 / Fan 2018 Since no new state, will stop Since no new state. will stop 2. a, Drawa DFSM to accept the language, Oe {a, b}*: Vx, ye fa, b}* ((o= xabbaay) ¥ (=x babay))} (03 Marks) Ans. b, Define DFSM, Shorea A[BIA Byalc c}o]s vo [> [A e,o ve F[o|/e e[Frla ufo [oD ‘Sunstar Exam Scanner 3 ‘Scanned with Camscanner {Draw the table of dstingwis tc equivatent of aucomiat (i) Constract minimum Ans, Refer Q.n0d(a) of MQP-2 Man e. Write differences between DFA, NFA and €-NFA- (04 Maria) Ans. DFA NFA = NEA TINDER Supe [AnNaS-tuple [Ameo NIA tuple 5.05F) (2 Q,5.q,.F)=M M=0z5a5 where Q isfinite states | Where Qs firite states | where Q fi Se states is set of input is set of input gst of inp 5 5: Qx(ZUQ)t0Z" 5:QxEt0Q B:QxEt02" fquisthe star state” | isthe sturt state FCQ is set of final state _| FCQ is final state 2. There can be zero or | There can be zero, one OF fone transition froma | more transitions from a State onan input symbol_| state on input symbol quis th start state F< Qis final state "There ean be zero , one or more transition from state ‘with or without any input symbol J Mow numberof | Less numberof transition | Relatively more transition when compared transition swith NFA Easy to construct using regular expression, Difficult to construct | Easy to construct Module-2 Consider the DFA shown below: State os 4 : *q | ‘Obtain the regular expressions RR, and si as much 2s possible. Ans. Basic when k= 0 4 Sunshar Exam Seamer Scanned with CamScanner Reo Reh Ree Reel wet Reco Regrere rauetion: SY REE REM RES PRE Whenk = n= Re RO [RE] RSP (erpter nor eH) (er e(er Or (er) (oH =! a =n? ROR? 20+ (c4 (ert 0 =0410 =ro rier +R RET RE =oe(e+i) (e+e a en? RoR] RY rerl(es to esto Sunstar Exam Scanner nee ner ROL REY] RI? Sorel) > -0 wen? «a6 RS? + (eI) (et) nen ening] Re =l+(e+1) 0 aidans +Ro[ ROT RY 5 ‘Scanned with CamScanner = V Sem (CSE/ISE) Automate Theory & Compatibility OS 2 A capi ela uP ena np npeny ny [RT Re =Is1eo(e+itso)e11 Cae ae 119 0(110)*11 =H(iiea)ent® A? and [A] ng ery +RgiR 1*0+1*0(c+11%0)*(c+11*0) e+t*0)*(e+110) =H0s1*0(11¢0)*(e+11%0) ——=1+4(11°0)*(e-+11*0) [ee] Ra o(110)*0 RE ERY «ROL RYT RY RD =$+10(e+11%0)*0 ery) a1rra(esti*ojeetteajei surta(eetieoiieoyis AP =RY eng fR ony =(e+11%0)+(¢+11*0)(¢+11*0)*(e+11%0) =(e+U*0)e(es11*)1140(¢+1190) Final RE can beset as R= ]on =1*0(11"0)*0+1¢0(1140)¢0f(0+e)+1(11*0)+0}*(05.¢)+1(11*0)¢0 Give Regula exprein for (Gall atings coat eet Ubalaring conaaig no moe tha 3a, (ipallsving that contin st one cara fae ayia lowing languages on |= {a,b,c} (Mars) (b+e)salb+e)* (b+)M(o4aN(b+2)*(era(b+e)e arbre)? 6 Sunatar Bea Sette ate ——d Scanned with CamScanner CBCS - Dee 2017 / Jan 2018 ig. Q3 (cs Indicate foreach of the following regular expressions, whether it corretly desribes Lz {aU ba) bb* a {i (Ub) abd" {iba Uabta fis) aU bay (bb*ay* Aas. NO. ii YES ii. NO in YES OR 4a Prove that the following language fn not regular: orin> 0) (05 Marks) ‘ans, Step 1 Let Lie, regular and be the number of sates a "Since a] = 29 > we can split x into uvw such that fav and [V|> 1 as x-Gaaaag a Gobbbooe Gerany | eobo debs Step 3 : According to pumping lemma uvio € L for i= 01,2 When i= 0 *V" doesn't exist so L= {0° I*| n> 0 } is not regular . IFL, and L, are regular languages then prove that L,UL,, L,. L, and L,* are regular languages. (05 Marks) Ans. Refer Q.n0.3(b) of MQP - 2. Is the following grammar is ambiguous? (06 Marks) SiC tslict sesia cob (06 Marks) Ans. Refer Q.n0.5(b) of MQP - 2. Sanstar Exam Seanner 7 ‘Scanned with Camscanner a. Define Grammar, Derivation, Ans. A prammer G is 4 tuple or quadr Aerminal, Ps production and "Sis Stars) Ans. ‘/ISE) Ex: 816,88 A=> ai fbr the process of obtaining trina from the start syinbol by app! p->E+E,E=> La G= (VT w isealled sentence of ‘What is CNF? Obtain the fllo S—ASB|e A—aAS|a B+ SbS|A| bb Let G = (V.T,PS) be a CFG. ate of the form ABC or Ana Eliminate - production ) bea rammmar. The stin Automate TREO & Compatibilin, Module-3 Sentential fo iple G = (vrs) where “V" give one example for (3 Mars, is variable 4 yal inal sand / OF NOM = termi 1s of termi at vee eal productions is called derivation, id+E,E~ did i ge obtained from the grammar G Sk he ve. w is the string of terminals, grammar G. Her The gramme Ov [_av_| Production @ |s—e| Sas s[ $s = = TAB) are nullable variables Production Resulting production (p") SSASB [SAB A=AS [AmaAla ae SSS yrammar in CNF (09 Mars) G is said to be in CNF ifall produces Given Production ‘Action Sab Already in CNF SAB | A= aA Replacea by A, A>AA en oe ee B= S6SIOSISHA Replace bby B, B— SB, 5, SS8,8 Robe SB, SSB, Replace BoS wih B, - BSB, BBS ‘Scanned with Camscanner a -(vnr's) V=(SABB Pat SAB NOAA 'stisstatsymbol Appa Bons Aon . LetG bette grommes, Sosa ba Ana a8 [DAA B— bjbSaBB For the string qaabbabbba ida (Left os derivation Ci) Rght meet deat, Ci) Pare ice. Let met deviation Saab A Suna A Sino = aaaabbSB a4 Staak 7, => aaaabbabB - S cabins Stati /\ I , (04 Marks) Ans. Sane S pasa S mabe AG PS Seas ? P| = aaalsbaBbba an FSeibtin “\ ' | ‘ = aaaabbabbba ‘Seanned with CamScanner V Semv (cst/1se) Automate Theory & Compatibiliry Use (cse/ise) AutomainTreorooomneey OR 6. a, Explain the following terms {@) Pushdown automata (PDA). Gi) Languages ofa PDA, Tnstantaneous descrip Pushdown Automata (PDA): A PDA is a seven tuple M=(QEh5q,.Z,,7) Qis set of finite states is set of input alphabets Lis se of stack alphabets Bis transition Qx (Us) x|-Qx/* 4, Qisstart state Zs intial symbol on stack F'sQiisset of fina state anguage of PDA : The language LCM accepted by a final state is defined as WW GevZ |.) lescription + Let M = (Q2).8q, » Z, .F) be a PDA. An ID ipton) is defined as 3-tuple ora triple (Qa) b, Construct PDA to accept the language L= {wwhwe(a,b}*}-Draw the graphical representation of this PDA. Show the moves made by this PDA forthe st aabbaa, (03 Marks) Ans. (10 Maris) ‘Ans, L(M)= {ww|weta.b)*} M=(QEI64,.2,.F) Q= tay) (02) ; Bt (9.0.25) = (Gaza) (40»825)=(AesaZ) 5(durb.2Z_)= (Qasb2) 8(qosboa)={(a,,a).(a.e)} B(ao,a,b)=(qsba), 8(dor8.b) 5(qora.b) = B(qusbsb)={(44,0b).(a.2)} 5(q,.a,a)=(q.8) 8(q,,b.b)=(a,.£) 8(4.024)=(Moe2a) Sanchar Exam Sean ‘Scanned with Camscanner BCS - Deo 2017 / Jan2018 1g, © Qis stat state Z,€ Pis initial stack symbol F= {q,} is final state (a aabbaa, 29) + (q.-abbaa, az.) —+ (q,aabbaa, ,) —> (ay anbbaa, 2) (4p, boaa, aaz,) —s (q, bidaa,z,) —> (a Dba) (4 ba be) — (a Sbang) —e (gastos) (avah am) (q.0,0baa,) ¢ (qe nbbaaz) (ote) (4.8 2) © (G02) «Convert the following CRG to FDA S$ aABBjaAA ‘A-:aBBla B—bBB/A Coa Ans. Q= {4493} L={ab} T={SA.BC,25} at (03 Marks) 8(4o-8.20)=(41-SZ0) 8(q,.4,S)=(4,,ABB) (4,-8.8) =(4,-AA) (a8) =(4),8B) 8(a,a,A)=(44.8) 8(q,.b.B) =(4,,BB) 8(4,.2.8) =(q,88) 5(4,.8.8)=(q.e) 8(a4.0.0)=(4.2) 5(a,824)=(42) 4, € Qisstartstate 2, Tisstacksymbol fa, }isfinalstte Sanshar Exam Seanter ‘Scanned with GamSeanner a Ans. 12 autnatar T0ry COMPA Module-4 IF and Lae contest fe langues the prove ba LT Ta Ea 00 a conten fee lngungee ~ (i)G, =(V,,T.8,.8,) TPS) G, =(V,UY,US,.T,UT2,S)) 5 isastartsute G,andS,¢(V,UV:) P, =P,UP, U{S, +5,/S,} UL, (ii), =(V, UV,US,.T, UT, PS.) S. isastartsymbofr the grammar, andS, ¢(¥; UV:) P,=RUP,US, »SS,} Libs (V.US,.T,,P,-S,) S. isathestartsymbolof GrammarG, P=BULS, >SS.1¢} TLL a decision procedure to answer each ofthe following questions: (@) Given a regular expression a and a PDA M, the language accepted by Ma subset ofthe language generated by a Given a context-free Grammar G and two strings Siand S2, does G generate 55, i) Given a context free Grammar G, does G generate any even length string (Gv) Given a Regular Grammar G, i L(G) context-free? (12 Maris) {Observe tat this is true i (M) 9 L(a)= ¢ So the following procedure answers the question 1. From a, build a PDA M* so that L(M*) = L(a) 2. From M and MT, build a PDA M?* that accepts LM) 9 L(M*) 3. If L(M**) is emply , return true else return false. ii. 1. Convert G to chomsky normal forms2. Try all derivations in G of length up #? 25,8. any ofthem generates SS, retum True, else return false i "Use CFG to PDA tpolown (G) to build PDA P hia tacepts L(G 5. Use insert PDA and FSM(PE) to build a PDA P* that accepts 4, Retum decioleCFLempty(P*) accepts L(G) 0 LIE) ini Return True (Since every regular language is context fe) ‘Swrchar Exam Seantey dl Scanned with Camcanner acs - Dec 2017 / Jar2018 aa OR ‘ga. Explain with nea diagram the working ofa Turing Machine model. (05 Marks) tans, Refer Qo.9a) of MOP 2. >. Design a Turing machine to accept the language L= {a b*e* | >= 1}. Draw the transition diagram. Show the moves made by this turing machine for the string, anbbee. (11 Marks) Aas. (al) wy) (bb) gabbee fabbee xbovec xabpee xaybee i xayble et xxybze xxyyze xxyyzz Module-5 9 Write short notes on: a. Multistape turning machi . Non-deterministic turaing machine, Linear Bounded automata. (16 Marks) ‘Ans. a. Refer Q.no, (b) of MOP - | b. Non - deterministic turning machine : Ina non deterministic turning machine, for every tate and symbol, there are a group of actions theTM can have. So here the transitions are not deterministic. The computation of a non - deterministic turing machine is tre of configurations that canbe reached from the start configuration. ‘An input is accepted if there is at least one node of the tree which is an accept configuration, otherwise itis not accepted. If all branches of the computational tree Sanstar Bean Scatter 13 Scanned with CamScanner y Automata Theory & Compatibilay fet on al inp them termini ing Linear Cost/tst) T maching is called a decideg and i rejected, the input is also rejected. Refer Quo, (by of MOP = oR 10. Write sh 18, Undecidable tanga b. Maltin The post correspondence probl , Refer Q.n0.9(b) of MQP-2 b. Refer Q.no.10(a) of MOP = 1 ©. Refer Q.no.105(3 of MQP-2, (16 Marks) 14 ‘Sunstar Exam Scanner _ ‘Scanned with CamScanner ‘Time: 3 brs. Note Answer any FIVE full questions, selecting ON * Module-1 1. a, With a neat diagram, explain a hierarchy of language lasses in automa (eA) (04 Marks) Ans. . Diane Tomes, ‘Grammar Language ‘Automaton ‘Type-0 | Recursively euumerable [Turing machine ‘Type=7 _ | Context sensitive Linear bounded Non - deterministic Turing machine Type-2 | Content free Non determinstic pushdown automata ‘Type -3__| Regular finite state automaton b Define deterministic FSM. Draw a DFSM accept decimal strings which are Aivisible by 3. (06 Marks) dane, Step l= d= (0,1,2,3.4.5,6,7.8,91 K Step2 = After dividing by 3, posible reminder ae 0, 1,2 Step3 = Comput transition Biq,a)=4, where) =(e4 +A) mod K wine= tO and K=3 {0,3,6,9) leaves Oasreminter) {1,47} leaves | as reminder) {215 8) leaves2 0s reminder : ‘Sanctar Exam Scanner 45 Scanned with Camcanner V Senv (Cse/Ise) YY Automate Theory & Compatibiaiy, CP] Grd mMors =O | Ma OMG [lee (0:3. 6.9))= fo] t | Gorosnaars-1 | sae Deg [Bde Wd = 9, 2 | uoros2mods=2 | Sad [Qe 25.84, OP Woe Moss=1 | Sla,.0% 4, [BA (9.3.6, 9)=6, HULL] doers natad=2° | sq Dea [84 (A TD= 4," 2 | Wort +2 Mod 30 | 8g. 20-4 | MG 12.5.8)) =a, OP orzeomtars=2 | Bla, =a, [lay (0.3.6.9) =9, FD] UE] Gorr+naed3=1 | eq. Ded] (hag, 2 | aor2+2mod3=0 | s(g.2)°4 | (dn (2.5.8) "4, La 0369 16 san —+() ‘Also write transition table for DFSM. ‘Step 1: ~ Identify tart state Q, = { Step 3: Transitions Inpatmbol = 0 B= Utah. 7.1401 8,0) mt ad tah fa For state (a ut Sybal= 0 85m 9. 0=8, (14.0) For state (44 Input Syebol “0 By Ue Ge}. 0) "8 (444, 01.0) $8 (4,03 V8.0) 05640), = aed 16 = fae For ste (4 8" (14 ey cherie Forse (9 Iapr pt=0 Prete arc (06 Maris) lop symbol B= UQs 1B (lah DO tah SoU Gh DH Claas D 8, lay DU ae UP (G10 tam tay gh lnpat Symbol = 1 Be Ug he DB Clg D ry le ges D8 (aya 1 Alas Saae th Coe = talViqne tal My ds By Chay gb I) FR DUG St) = tad "a lap Syma Sgn 8, Cg a) Sanetar Exam Seante’ Scanned with CamScanner CBCS - June/July 2018 (06 Marks) 9 (a) @a) (aa) a) (aoa) (qa) 4 a. 4 Step 3 ‘Sunstar Exam Scanner 17 ‘Scanned with CamSeanner ™ Automata Theory &C ompatthiiy, on tad | Med rn tye) Le LM None fhe mah i ate inked we Step 4 (4) (4,4, 4), cane forthe following 1) Design a mealy machine fara nary input sequence, ct hat HF 1 us subarig 101, the machine outputs A, upat bs substring 110, Ce machine output, rise tt outputs C ) Design # mealy ‘complement of tht “Assume the sting Is read from LSB to MSHtand en earry I dsenrded, (6 Mark) ‘Ans. i) uw m G,A.0) 4,24) 14,4) 4, 24) (GANG, 24) AG), Za) GAG Z 4) H4,4q) (4,24) | WAWI.Z4)14,Aq)G,Z4) 4,24) @AG)G,Z4)14,A4) (4,24) WAWU.ZAN GAG), Za) ta,z: Sunstar Exam Seanser ‘Scanned with Camscanner

You might also like