0% found this document useful (0 votes)
48 views

Viden Io Toc Akash B Tech Computer Science 4th Semester Ip University Toc 2018 PDF

Uploaded by

kalsidipen
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
0% found this document useful (0 votes)
48 views

Viden Io Toc Akash B Tech Computer Science 4th Semester Ip University Toc 2018 PDF

Uploaded by

kalsidipen
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/ 4
— TERM EXAMINATION IFEB. 2018] OUR H SEMESTER [B.TECH] HEORY oF COMPUTATION sime:1he (ETCS-206) Note: Q.No.1w hich is compuls TY. Attem Sttons Scompulsory. Aty pt an: ions fro ’ y tu s ae ‘Y "Wo questions from the rest. ite down th © regular expression for the following diagram. (2) o O4 a» Gy. % = ql+q By Applying Arden’s Theorem to nates we “ = A0* 208 So, % = Ql +a, =0"1 + q,1 Therefore, = ODI As the final states are q, and q,, we need Not solve for ag: +4, = OF + (O*1)I* = 0% A+ 114) = OFF, Q. 1. (b) Design a mealy machine to find 2s complement of given binary number which is processed from right to left instead of left to right, (2) Ans. Input alphabet: 5 = {0,4} Output alphabet: F = (0, 1) Read from LSB Xe in Keep the first from LSB as it is and toggle the remaining (®) a bits we will get 0101 40 Thus 2’ 's complement of 1011 is 0101. The required Mealy machine will be- Q 1. (c) Design a DFA accepting the binary equivalent of the elements of the set (2"In> 0} and describe, in English language, the following regular expression (a)*b(a)*b(a)*b(a)*. Q) Ans. DFA for Accepting binary equivalent of {2" In >=0) 22-2018 Fourth Semester, Theory of Computation 04 Q.1.(@) Find all strings of length 4 or less in the regular set represented h, the following regular expression (b a* + abt) and Design a DFA for the regulsy @) expression (00)*(11)*. 4 or less in regular set represented by the following regular Ans. String of lengtl expression (ba* + ab*)*- baaa, abbb, ab,abab,ba,ba,ba,b ,a, abb,baa DFA for (00)*(11)*- 0,1 Q.1. (e) Define regular grammar for the following DFA. @) 1 Os-O> 0 Fig. 2. Ans, Regular grammar :- . Let G=((S Al, (0,1),,S ), Where Pis given by s — 08, s — 1, s —-L A — 1A A 1 imize the following DFAM = ({4gs y» Ia» Ig» La 3; {a, bl, 8, dy [4 8) = dy, 5d b) = dy) (dy &) = Gy» B(4y b) = ds 5(dy®) (dg) 8) = ia Q.2.(a) Min qs]) where 5 is given as: 8(dy | 2g 3(dyyb) = Gy 5(dgA) = gy Bb) = ds» 3(qy A) = Ay» 8(dyb) = dg» 8(dg b) = 44. | Ans. nS are given below | Ty = Ud £4» Gy» Gas a» Gr a= lah fq» 4» Go» Sr 9s, 494! 0 — a LP. University-[B.Tech|-Akash Books 2018-3 T= Mel, (ay), (49, 44, Gghs (dys Gg % = Ugh (ads (ag) fay), Cag Udy Uag!s (44), fag, ta), fa), £4), (4g tion is simply the given automation. expression Corresponding for the Figure 1 using (5) Refer Q. 1. (a) of First Term Exam 2018. Q. 3. (a) Design a DFA for Here = Q. The minimum Bt Q. 2. (b) Find the regular Arden’s Theorem, Ans. Q.3. (b) Prove that L = (oma) y > Oi it . Ans. If Ais a Regular | haca Pumnine (5) © ‘anguage, then Ahas a Pumpii Length P’ such that any string moa ne pS! 2 Pmay be divided into 3 partes xy zsuch thatthe following conditions () xyz © A foreveryi>9 (2) lyl>0 (3) Ixyl

P ~ Now find a string‘S’ in A such that ISI >P — Divide Sintoxyz — Show that x yiz ¢ A for somei ~ Then consider all ways that S can be divided into x yz — Show that none of these can satisfy all the 3 Pumping conditions at the same time. ~ S cannot be pumped == Contradiction Assume that A is Regular Pumping length = P S=a’b” => S=aaaaaaabbbbbbb x Pe7, Casel: The y is in the ‘a’ part, xy'z = xyz 42018 Fourth Semester, Theory of Computation ss aa gaa ebbbbbbs aa aanaaaaa a bbbb by, : +7 Case 2: The y is the ‘b’ part rytanya aanaaaa bb bbbh s aaaaaaa bb bbbb bbb} 5 ‘ T#ll Cage 3:'The y is in the ‘a’ and ‘b’ part xyz xy" eagag abl bbbbb aaaaa aabbaabb bbbbbh IXYI AAD, A_> aBIbAB,B > b,D >a Here, §,A, Band Dare the yay Sis the start variable; and a and b are the terminals. ables, Ans. As there are no null productions or unit productions, we can proceed to gt. 6) Step1 Let G, = (W'y lab. d). P, 8). where P, and V'y are constructed as yj. (i) B+b,D dare included in P,. ome (ii) S + aAD gives rise to S > C,AD and C,>a. AaB gives rise to > C,B. A~ DAB gives rise to A >> CAB and C,> b. Vy=(S,A,B,D,C,,C,). Step 2 P, consists ofS > C, AD,A->C,BIC,AB,B > b,D 4, C, >a, 6, -54, A+C,B,B->b,D->d,C, >a, C, bare added to P, S + C,AD is replaced by S-> C,C, and C, + AD. ‘A-+ C,AB is replaced by A-> C,C, and C —> AB. Let G,=(1S,A, B, D, Cy, Cy, Cy, Cy), (2, b, dl, Py) where P, consists of S-> C,C,,A-> C,B 10,C,,C, > AD, C, ->AB, B->b, Dd, C, +a, C, >, G, isin CNF and equivalent to G. @.4.(b) Remove the Null production from the given grammar-(S— |aS\4p, ‘A->1 lc, > b}. Here, S, A and B are the variables; Sis the start variables;a,5 and are the terminals and } is the Null symbol, 4 ‘Ans. Step 1 Construction of the set W of all nullable variables: W, = (A, ¢ Vy! Al->Ais a production in G} (A, B) (A, B) u [S} as S > AB is a production with ¢ W*, = (8,A,B) W, = W,U6=W, Thus, W = W,=(S,A,B) Step 2 Construction of P': @ B -> bis included in P’. (i) S > AB give rise to S > B,S + AB (iii) A = cis included in P’. ’ Hence the required grammar without null productions is G'= ((S,4, Bl, bP: 9 where P’ consists of S > aS |ABIBA>cBob

You might also like