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

TOC QB

Uploaded by

Third Semester
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
123 views

TOC QB

Uploaded by

Third Semester
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
e TENET a INSTITUTE OF ENGINEERING Level BE | Full Marks | 80 Examination Control Division | Programme | BCT Pass Marks | 32 2071 Chaitra ' Year/Part_|I/T Time {3 hrs. ‘Subject: - Theory of Computation (C7502) Y Candidates are required to give their answers in their own words as far as practicable. ¥ Attempt All questions. Y -The figures in the margin indicate Full Marks, Y Assume suitable data if necessary. 1. Define countably infinite and uncountable sets with example. Use principle of mathematical induction to prove (5°-1) is divisible by 4 for all integers n> 0. BH] 2. Design a Deterministic Finite Automata (DFA) for the regular expression (a(ab)*b)*. Verify your design by taking one accepted and one rejected strings. [542] 3, State pumping lemma for regular language. Use this lemma to prove language, L= {a™ :n2>0} isnot regular, [245] 4. What are the differences between a DFA and a NFA? Convert the following NFA in to its equivaicut DFA. [245] 5. Construct CFG for language, L(G) = {a™b" :m,n >0,m2n}. Use this grammar to generate string "aaab". And also draw the parse tree. [4ele) 6. Convert following CFG to CNF 5] G=(V, 5, R, §), where ‘ V={S, A,B, a, b} E= {a,b} R= {S— eAb|BalA, A> SSle, Be} 7. Define the term ambiguity end inherent ambiguity in parse tree, For a CFG given by G=(V, 3,R, S) with V = {S}, = {a) and production mules R is defined as: 1 $3 SS, Sra Obtain the language L(G) generated by this grammar. 8. Design aPDA that accepts language, L={a"b™ :n >I}. Test your design for string "abbb".[5+1] 9, Write the differences between CFG and unrestricted grammar with example. Design a Turing machine that reads binary string and doubles the number represented by that string. A binary number is doubled if a '0' is added on the right end of the number. +5] 10, Define head shifting and symbol writing Turing Machines. Design a Turing Machine (TM) which computes following function f(w) = ww’, where w* is the reverse of string and w € {0,1}*. Ifyour input string is #01#then TM should give the output string as #0110# [3+6] 11. Define class-P and class-NP problems with example..How do they relate to NP-complete problems? (51 12. What is an "Algorithm" according to Church-Turing Thesis? Why is it called thesis and not a theorem?: Prove that if a language 'L' and its complement 'L' both are recursively enumerable, then L is recursive. [2+1+6] ood 43 TRIBHUVAN UNIVERSITY Exam. INSTITUTE OF ENGINEERING [Level ~ Examination Control Division | P: 2072 Kartik Lye tation (CTS02) Candidates are required to give their answers in their own words as far as practicable. Attempt Ail questions. The figures in the margin indicate Full Marks, Assume suitable data if necessary, SAKA - Explain what an equivalence relation is. Show by induction that for any n > 0, 142. n= (n'+n)/2. © BH3] 2, Let © = {a,b}. Write a regular expression for the language with all strings in Z* with no more than three a's, B) 3. Formally define a Deterministic Finite Automation (DFA) 153 4. Design a DFA accepting strings over the alphabet {0,1} defined by {0 0}* {11}*. (51 5. Convert the following non-deterministic finite automation to DFA. (5] 6. State the pumping lemma for regular language. Show that the Janguage L = {a": n is prime} is not regular using the pumping lemma. (5) 7. Define Context Free Grammar (CFG) along with an example. (5) 8. Convert the following CFG to Chomsky Normal Form (CNF) [5] G=(V,5,R, 8) where V= {S, A, B, a,b} Z= {ab} R= {S—aAbB, A>aA, Aa, B>bB} 9. Design a pushdown automation to accept L = {ww*; we {a,b}*}. Show how it accepts the string "abbbba”. (5] 10, Using the pumping theorem for context free languages show that L = {a°b"c": n> 0} is not context free. {5] 11, What is a Turing machine? Describe its operation. 6] 12. Construct a Turing machine to transform UWU into UUWU, where w is a string containing no blanks and U represents blank in 13. Construct a Grammar to accept the language L = {a"b"c" : n2 1} {5} 14, Explain the Church-Turing thesis. Show that the Halting problem is undecidable. B+] 15. Explain yyhat is the class P. Describe the Traveling Salesman Problem. (3+2] see P.3 43 ‘TRIBHUVAN UNIVERSITY INSTITUTE OF ENGINEERING v lates are required to give their answers in their own words as fer as practi v Attempt All questions. v v The figures in the margin indicate Full Marks, Assume suitable data if necessary. - 1, State and explain pigeon-hole principle with an example. 1-9 _ using mathematical Induction Principle: (atl) n+l 3, Design a DFA that accepts the language given by L = {we {0, 1}*: w begins with 0 and ends with 10}. Your design should accept strings like 010, 011110, 600010, 01011010 and should not accept strings like 1010, 0011, 01011. 4, Find the regular expression represented by NFA M= (K, 3, 4, s, F) where K= {4,41, 42, 43, 44, G5}, B= {a,b}, S=qo, F={ qs}_and A is given as follows, 6) s/e a b 1 « 40 e : a a a Qa : Ge : 93, 44 5 g3 93 ce qs co Go.de | = a #5 : - [ - 5. Show that L= {we {a, b}*: w has equal number of a's and bis} is not regular by using pumping lemma for regular language. You may use closure properties along with pumping temmg- . Explain about decision algorithms for regular language. a State end proof the pumping Jemma for regular language. Prove that language which contains set of strings of balanced parentheses is not regular. Lone Define a context-free Grammer. Convert the following productions into chomsky Nommal form. : (2+4] $ > abAB A+ dABEE B- BAa/A/E 10. Desoribe the trausition function of push-down Automata. [4] f .. Why computational complexity analysis is required? Define class NP end explain how . Design a Turing machine that reads binary strings and counts the sumbero* 1's in he sequence. If there is: oda number of | inthe input string, machine just alts with doing aothing, Otherwise machine should add I to the input binary number ifit is even number and subtract 1 from the input binary number if itis od¢ number. For example if input sting is#11104, it just halts after counting odd number of i's, For #1014, it subtracts | to get #100# and for #10104, it adds 1 to get #10112. fh . Let M1, M2 and M3 be three Turing machines, can you combine these three Turing machines to get new Turing machine M? If yes, elaborate your idea with required theory and iliystration. Explain unrestricted grammar with suitable example. co What is universal turning machine? Explain with example, how universal turing machine works? ip)} What do you mean by Church-Turing Thesis? Explain Turing recognizable languages and Turning decidable language with suitable examples. 247] Travelling Salesman Problem (TSP) is Class NP problem. [144] ate ‘TRIBRUVAN UNIVERSITY INSTITUTE OF ENGINEERING Examination Control Division 2070 Chaitva Candidates are required to give their answers in their ovin words as far as practicable, Aitempt All questions. ¥ ey . The figures in the margin indicate Full Mar! Assume suitable data if necessary. 1, Tustify that “The complement of diagonal set is different from each row sets.” with the help of diagonalization principle. Show that if 3n+2 is odd then n is odd by using proof by contradiction technique. v . Design a DFA that accepts the language L = (ce {1,1}: x has an even number of 0's and an even number of 1’s}. Verify your design for at least two strings that are accepted by this DFA and 2 strings thet are rejected. 3. Show that for any Regular expression R, there is a NFA that accepts the seme Ianguage represented by R. Construct a e-NFA for regular expression bb (a U b)*ab 4. Use pumping lemma to prove that L = {a"b™ : n 2 1} is not regular. 5. Consider the regular grammar G=( V, ,R, S) where S,A,B,a,b}, 5= {a,b} ‘S—> abA/B/baB/e A> bS/a Bas } Construct a finite automaton M such that L @M) = L (6) 6. Write context free grammars (CFG) for the languages L1={a™b"c":m21,n21} and L2={a"b"c™:m21,n21}. Do you think that L=(LIML2)is also context free? If not prove that the language thus obtained is not context free by using pumping lemma for context free language. 7. Convert following CFG into CNF with explanation of each step. G= (V,2,R.S), where v={S,X Y,Z, a,b,c}, Z= {a, b,c} ; R= {SOXYZIXY|aZ, XvabXle, YoY cZl ab, Z>2XZ} 8, Design a PDA that accepts all the palindromes defined over {2, b}*. Your design should accept strings like ¢, a, b, aba, bab, abba, babab etc, 9. Define the term configuration of Turing Machine. Desiga a Turing machine which accepts the set of all palindromes over alphabets {0,1} 10, Is Turing Machine a complete computer, support your answer in reference to different roles of Turing machines? Justify that unrestricted grammar can generate the language L= {a™b' oo": n> 1} 11, Define Multiple tapes Turing machine. With reference to language they accept, compare Multiple tapes Turing machine with single tape Turing machine. 12. “Turing machines is believed to be the ultimate caleuleting meclanism the help of Church-Turing thesis. How halting problems, suffer th procedures? Explain with suitable example. _ 13. With reference to Polynomial Time Redueibility, explain NP hard zad NP- Complete P7 jeborate with computational +4] (5+2] (3+3] 4] [4] [4+6] {9} 1 [2+5] (3+3] [4] [5+4] LDi Subject: - Theory of Computation zs as far 25 practic: ve thelr answers in thes own words fr 25 pe aes nmr end contest derendeat gramme? Explsi = propenits of regular exaressions. (a) “Woavis a'piskdown setomaton? J 7 finite state mach how pushdown automaton ig better than dete Bf Con bisas2 44 ‘TRIBHUVAN UNIVERSITY a INSTITUTE OF ENGINEERING evel E Examination Control Division | Programme | BCT 2069 Chaitra Year + — Subject: - Theory of Computation (CT502) ¥, Candidates are required to give their answers in their own words as far as practicable. Y Attempt All questions, Y The figures in the margin indicate Full Marks Y Assume suitable data if necessary. 1, Define the Cartesian product. What is the use of Pigeonhole principle? [42] 2. Use mathematical induction to prove the following: 14+2+. a=n(ntl)/2_ (4) 3. Design an NDFA for a language defined as (baUb)* U(bbUa") . Give two strings that are accepted by this NDFA and 2 that are rejected. [5+2] 4. Define configuration in reference to FA. Prove that regular language are closed under Kleene-star. [2+5] 5, What is pumping lemma for regular languages? Can you use this to assert a language is regular? Justify your answer with reference to the language L = {a"b"": m, n> 0} B+] 6. Formally define PDA. Design a PDA to accept a language L = {a" bo": n 2 0} [2+5] 7. Where is the main application of pumping lemma? State the pumping lemma for context } free languages and explain with suitable examples. Re 8, Write a C-F.G to generate a language L = {a“"| n> 1}. Convert this to CNF [3+4] 9. What is a turing machine? Define the term configuration in reference to a turing machine. [3+3] 10. Construct a Turing machine that replace every 0 and 1 with every 1 and 0 in binary string (ie. f(a) = 2, where "a" is a binary. string). 9 11. What is unrestricted grammar? Explain. ; 63] 12. What is universal turing machine? Explain. im 13, Prove that if L recurive then it is recursively ennumerable. [3] 14, What is class P? Explain. 3] ‘TRIBHUVAN UNIVERSITY “ENSTITUTE OF ENGINEERING Examination Control Division 2070 Ashad Programm ‘Subject: - Theory of Computation (CT502) Candidates are required to give their answers in their own words as fer as practicable. Attempt Al questions. The figures in the margin indicate Full Marks, Assume suitable data if necessary. KAKA] Explain the induction principle with suitable example. BI . Ina class of 49 students prove that there will be at least one month where 5 or more students have their birthday. (4) ifferentiate between DFA and NDFA. Define a DFA that accepts the eee L= {X £{0,1}*: 0110 occurs as a substring in X} [+4] 4. Design an NDFA for a language defined as (ab)*(ba)*U aa”. Give two strings that are accepted by this NDFA and two that are rejected. [5+2] 5. Show that if language is regular then it is accepted by finite automata. 7 6. State Chomsky Normal Form (CNF). Construetruct a Push Down Automata (PDA) that accepts the language L = {ab |n > 0} [245] . Writea C.F.G to generate a Tengnage a = {a" b™ c™ a’: m, n 2 1}. Show how this grammar can generate the strings a” b‘c' d?. v ~ [5+2] 8. Let G= (V, E.R, S) be a CFG, then prove thet any string W E T. (G) of length greater than 6 (G)'Y"*! can be rewritten as W = uvxyz in such a way that either v or y is non empty and uv" xy"z is in L(G) for every n>0 7 9. Define the symbol writing machine and head moving machine. How can these be combined to form complex Turing machines? Explain, BH] 10. Given the starting configuration (s, DUWU) design a Turing machine to compute (o, DUWUWY) where his a halting state and 'W' contains only non blank symbols but can be empty. 4 11. What is recursive function theory. my 12, What is church-turing thesis? Explain. 4) 13, Prove that if L is recursive then L is also recursive, i 14, What is class- NP? Explain, 6 44 ‘TRIBHUVAN UNIVERSITY - INSTITUTE OF ENGINEERING ». Examination Control Divisi Pr Jo. 2066 Bhadra f a ver Subject: - Theory of Computation ¥, Candidates are required to give their answers in their own words as far as practicable, _M Altempt All questions. % The figures in the margin indicate Full Marks. V Assime suitdble data Lif necessary, 1. a) | Write whether or not the following are . [L414] ) Ooo T° 1p BS 4uy ab) cfabed) E ©. iii) {a,b,{a,b}} - {a,b) = (ab) F iv) {ab} € (abd) & b) Let f£:S 18, R be arelationR © SxS then show that R is an equivalence relation onset S when Ws,t S, (5,t) R ifanid only if (5) = (0). _ @ + (6) cx: ©), Use the method of induction to show that n’ + 2n is divisible by 3, (ee 2. a) Write regular expression for the language L= (w © (a,b)": w contains more than two a). [4] b) Construct a Non Deterininistic Finite Automation, ‘N1, corresponding to the regular expression ((ab U aab)a’)’. : Be a ©) Construct ‘an equivalent Deterministic’ Finite’ Automation comesponding to Non- . Deterministic Finite Automation N1 above. (6) 3. a)+Show that the class of regular languages is closed under the operation of . concatenation, . Oo b) Use the Pumping lemma to show whether or not the lan guage L= {ww sw € {a}') is regular. @ (6) ©) Convert the following Context Free Grammar into Chomsky normal fom. @ 6) YS Ab AAA A>B,Boa . 4." a) Construct a Pustidown Automation that recognizes the language - [3s Le falblc!: ij, 2 0, and etheri=j orj=k). @ b) Use pumping lemma to show whether or not the Ianguage L = {a"b"o” : n 0} is context free, - @ ©) Show that the class of Context Free Languages i is not closed under the operation of - complementation. (4 5. a) Construct Turing machine thet computes the function that replaces symbol a with ‘symbol b arid symbol b with symbdl a for strings w {a,b}", Show the processing of this machine on the string w = ababa in terms of configuration transition and final , * output, . © b) Construct a Grammar that computes the function f(w) = w®, w € {a,b}*. Show how this grammar computes the function in terms of processing of string w = babba a-and ’ producing of the final output. @ [6] "c) What are recursive and recursively enumerable languages? What are class P and class NP languages? Based on these definitions what can you say about the definition of 1a algorithm? he Back 44 _-YRBHUVAN Univer: [eames INSTITUTE OF ENGINEERING Level BE Pass Marks d _ Examination Control Division Programme | BOT ___ Time 2066 Chaitra [Year 7Part [T/T ; =] Subject: - Theory of Computation . Candidates are required to give their answers in their own words as Attempt All questions, : All questions carry equal marks. , : : - Assume suitable data ifnecessary. 2 far a8 practicable, — a) Define symmetric relation. Prove using mathematical induction tat es ; 1.2.34+23.4 n(n+1)(1+2)= b) What is a regular expression? Give a regular expression representing the ‘ange defined as L = {w € {0, 1}* : w has two or three occurances of 1, the first andisecénd of which are not consecutive}. Also explain | in brief how. the given expression represents the stated language, wre 2. a) Prove that deterministic finite automata (DFA) ee the same class of dene as regular language, * \ b) Construct an NDFA to accept the language (ab U a) * a. Convert the same eis ‘ DFA. 3. a) _What is a pushdown automata? Design aPDA to accept the | language LS = fr nS », Verify that itindeed accepts, a’b* anda’b?, : b) Given a context free grammar’G = ivf 2, R, 8) couneaig as follovi, Convert i 40. oe form. i = {S, A, B, a, b} = {a,b} a {S > bA, S— aB, A>bAA, Aa, ans B5 Bb, Boos, Bob} 4, a) What is a turing machine? Prove that ifL < Z*ig recursive than L is also reoirsive b) Design a turing machine that accepts the string a"b”" for n= 0. Verify it for a’b’, 5. a) Define a k-+ -tape turirig machine? What j is meant b Explain with suitable example, * y Primptive recursive funtion? b) Define complexity theory? Distinguish b bounded versus exponentially bounded class, eK etween Ron- ee “polynomial Ea 44 ‘TRIBHUVAN UNIVERSITY. Regular’: ” 1 | --_—_Regular/Back INSTITUTE OF ENGINEERING Level BE Full Marks 180} : Subject: - oo cds as far as practicable, ir own WO . 2. . sewers in their ow? Candidates are required to give their answers in Attempt All questions. . AU questions carry equal marks. -Assume suitable data if necessary. NANN an? s . «auction to prove that n” — 4n? jg 8) Define transitive relation, Use mathematical induction £9 P divisible by 3 for alln>0. “b) Let © = {a,b,c} be an alphabet. wy and w2 ae ee two Languages i.e. Ly C D* and Ly E*. Defir Also give examples over given Z. 2. a) ‘What is an NDFA? Why is it éo named? Prove that -is regular, b) Convert the following NDFA to DFA. ny two strings on Zand Ly and Ly aye easily the terms w1.W2 and LL, 2 = {w*: we L) is regular if ho” 3. a) Defiie context free’ language. Is the language L defined over B= {a,b,c} — L={a"b" co": 20} coittext free? Give necessary arguments, b) Convert the context free grammier G = (V,2,R,S) define below to Chomsky nomial - form. . ‘ - V= {S,A,B,0,1} 2 = {0,1} R= {S 14,8 >OB, A+ IAA, A-08,A-+0,3 5 OBB, B51) 4, a) Distinguish between recursive and recursively enumerable languages. Prove that if ‘and I are both recursively enumerable than L is recursive: 0) Design a Turing machine M = (K, 5; 5,8,H) that starts at (s, ALT WILD), and compute (h, ALT W i.) ‘VLD) where h eH and We(E-{a,1h)* ey and D= {ab}. Machine? State and explain the halting problem. snthe Class-P and Class-NP with suitable examples, tena 5, a) What is an unevsal Turing b) Distinguish be 44/1-28 TRIBHUVAN UNIVERSITY INSTITUTE OF ENGINEERING Examination Control Division 72062 Baishakh ~~~ ~~ ve Subject: - Theory of Computation Y Candidates are required to give their answers in their own words as-far as practicable. Y Attempt All questions. The figures in the margin indicate Full Marks Y Assume suitable data if necessary. 1. (a) Explain the principle of mathematical induction and use it to show that 1:2-342-3-44 mtn (WEL) + (+2) = [n (ntl) - (+2) + (n43) ]/ 4 0+6) (b) Explain dovetailing and show that N x N is countably infinite. : es : area - 06) 2. (a) Differentiate between deterministic and hondeterministic finite state machine? Explain, with suitable state diagrams, . . ® (b) Design a deterministic finite automaton M that accepts the language LM)={wef{a ot: has neither aa nor bb as a substring } Discuss 3.() What is 2 regular expression? Explain the. properties of regular: ex vactical example 8) (b) Using the principle of context free graffimar, capture expression (x xs = Xy* Xy) * (Xp * XQ - 2 * x:). Also draw it’s parse tree. . (6+2) 4. (2) How pushdown automaton can be implemented? Explain the difference benveen pushdown automaton and Turing machine. : 3) (6) Construct pushdown automata that accept the language I, = { 2° b® }. “Check yourdesign using input aabbbbb. ° : , . (8) 5.(a) What is the computational complexity theory and how the computational complexity arises? Explain with suitable examples. © (b) What do you understand by Church's thesis? Design a Turing machine with finite set of states as 0, 41,42, and qs, alphabet ‘a and b’, blank, L and , R , initial state is qo and finally goes to q:. © ; : : : : a O 5) 8) 9) Here w* stands for the. reverse of the string w ‘Pushdown Automaton), = * ed as White a Context Free Grammer which generates the language L defin L(G) = {wow": we (0, 1}*}- and c is the masker used to separate w and w®. Generate the string 701011c110101 using the same grammar and also draw the parse tree for your derivation. Construct a Pushdown Automaton that accepts the language L defined as 2 . L={atb" : 120} ; ; Check your design using input aabbbb, (\'ou may construct the Context Bee Grammar to generate the required language and then construct its equivalent : i State the pumping lemma for regular language and show that the language L= {a"b": n20} is not segular. Z te “ ‘Change the following Context Free Gremiar_G, into an equivalent Chomsky’s Normel Form, ~ aR . ‘sao Baa /b~ “Spe aalaé Boab}: ‘What do-you mean by Turing-decidatile? Let 3.= be L = {we Do* : Cardinality of w, denoted by| machine M which decides the language L such for the language L. ha, is even}. Design a Turing Explain in brief the Church’s Thesis,’ Design the Copying Turing Machine c which transforms # w #, where w contains no blanks, into # ww #, Here # denotes the blank symbol, w denotes any sting which doesn't antain th blank symbol and _ indjeates the position of th eee 1 head, * diagram of C and explain it’s operation in brief. Only draw the block 10) "Write short notes on Dovetailing and Regular Expressions, {a} and let the langtiage~” [5+2+1=8] 8 that M isa decision procedute (8] (44+4=8] [4+4=8]

You might also like