Theory of Computation - Part - B - Question Bank
Theory of Computation - Part - B - Question Bank
Theory of Computation - Part - B - Question Bank
THEORY OF COMPUTATION
UNIT I 1. 2. 3. 4. Prove that there exists a DFA for every NFA Explain different forms of proof with examples Discuss on the relation between DFA and minimal DFA Prove that it L be a language accepted by a NFA then there exists a DFA accepting L. Is the converse true? Justify your answer. Or Prove that a language L is accepted by some DFA if L is accepted by some NFA. 5. If L is accepted by an NFA with - transition then show that L is accepted by an NFA without - transition 6. 7. Explain the extended transition function for NFA, DFA and - NFA. Describe the fundamental differences in the rules for forming DFA and NFA. Are these differences important in terms of the languages they can recognize? Give a reason for your answer? 8. 9. Distinguish NFA and DFA with examples. Construct a DFA equivalent to the NFA. M = ({ p, q, r, s}, {0, 1 }, , P, { q, s} ) where is defined in the following table p q r s p q r 0 { q, s } {r} {s} --1 {q} { q, r } {p} {p} 15. Construct a NFA accepting the same set of strings over { a, b } ending in aba. Use it to construct a DFA accepting the same set of strings. 16. Consider - NFA. Computer the - closure of each state and find its equivalent DFA 0, 1 q 0 p Compiled By B. Udaya, AP / CSE, RIT 1 q {q} 12. Convert the following NFA to its equivalent DFA p q r *s 0 { p, q } {r} {s} {s} 1 {p} {r} --{s} 11. Construct DFA equivalent to the NFA given below s {s} {s}
13. Construct a DFA equivalent for the given diagram 14. Convert the following NFA to a DFA p q r a {p} {r} --b { p, q } {r} --NFA with the transition
10. Construct DFA equivalent to the NFA given below 0 { p, q } {r} {s} 1 {p} {r} ---
a {p}
b ---
c ---
Page No : 1
Page No : 2
10. Discuss on regular expression 11. State and explain the conversion of DFA into regular expression using Ardens theorem. Illustrate with an example 12. What are the closure property of regular sets 13. Prove that if L is accepted by a DF then L is denoted by a regular expression 14. Explain the closure properties for regular languages 15. Prove that if two states are not distinguished by the table filling algorithm then the states are equivalent 16. Construct an NFA equivalent to ( 0 + 1 )* ( 00 + 11 ). 17. Construct an NFA equivalent to the regular expression (0+1)* (00+11)(0+1)* 18. Construct an NFA equivalent to the regular expression 10 + ( 0 + 11 ) 0*1 19. Construct an NFA equivalent to the regular expression ((0+1)(0+1) ( 0 + 1 ) )* 20. Construct an NFA equivalent to the following regular expression ((10)(0+1))*01
UNIT II
1. 2. 3. 4. 5. 6. Let r be a regular expression. Then prove that there exists an NFA with transition that accept L(r). For a given RE r, prove that there exists an NFA with transition that accept L( r ). Prove that if L = L( A ) for some DFA A, then there is a regular expression R such that L = L( R ) Explain the construction of NFA with transition from any given regular expression Show that the regular languages are closed under intersection and reversal. State and prove using an example, the properties of regular language
21. Construct an NFA for the regular expression r = 1 * 0 +0 22. Construct an NFA to accept the language indicated by the following regular expression ((01+001)*0*)* 23. Construct transition diagram of a finite automata corresponding to the regular expression ( ab + c* )*b. 24. Convert the regular expression a( a +b)* a into - NFA and find the minimal state DFA. 25. Construct a NFA for the regular expression ( a / b )*abb and draw its equivalent DFA. 26. Write a regular expression for binary strings beginning with 1 and not having two consecutive 0s
Page No : 3
1 1
0,1 2
42. Obtain the regular expression R for the following DFA A such that L (A ) = L ( R ) 43. Construct a Regular Expression corresponding to the state diagram given in the following figure.
31. State the algorithm for minimizing of a DFA. Construct a minimized DFA for the RE (a+b)(a+b)* and trace for the string baaab 32. Construct an NFA for the following RE ( a + b )* ab 33. Consider the alphabet A = {a, b } and the language L = { bb, bab, baab, baaab, } over a a. b. c. d. Is A * finite or infinite? Give a brief reason for your answer. Write down a RE that represents the above language L Write down a regular grammar which describes the above language Draw the DFA corresponding to the above language L.
i i n n n n
44. Obtain the regular expression that denotes the language accepted by q1 q2 q3
34. Show that the set L = { 0 1 | i > 1 } or L = { a b | n > 1 } or L = { 0 1 | n > 1 } is not regular 35. Show that the set L = { 0i2 | i is an integer, i > 1 } is not a regular 36. Show that the set L = { 0n2 | n is an integer, n > 1 } or L = { 0n2 | n Z+ }is not regular 37. Find whether the following languages are regular or not a. b. c. L = { w { a, b } | w = wR } L={0 1 2
n m n+m
45. Fine the regular expression for the set of all strings denoted by R132 from the deterministic finite automata given below.
1
1
| n, m > 1 }
0 0
Compiled By B. Udaya, AP / CSE, RIT
3 1 0, 1 Page No : 4
L = { 1k | k = n2, n > 1 }
d. L1 / L2 = { x | some y L2, x L1 }
52. Find the RE corresponding to the following automata States 47. Construct a minimum state automata equivalent to a given automata M whose transition table is given below. 48. Find the regular expression corresponding to the finite automata given below q0 q1 q2 q3 53. Construct a Regular Expression for the following DFA using Kleenes theorem 0 49. Fine the regular expression for the set of all strings denoted by R23
2
a q0 q2 q3 q0 q0 q1 q1
b q3 q5 q4 q5 q6 q4 q3
q4 q5 q6
1 B B B
*A B C
A C A
from the
54. Construct a minimized automata for the following automata to define the 50. Construct a regular expression to the transition diagram. same language States q0 q1 q2 51. Fine the regular expression for the set of all strings denoted by R132 from the deterministic finite automata given below. *q3 q4 a q1 q0 q3 q3 q3 b q0 q2 q1 q0 q5
Page No : 5
UNIT III
1. 2. 3. 4. 5. 6. 7. 8. 9. Let G = ( V, T, P, S ) be Context Free Grammar. Then prove that S * if and only if there is a derivation tree in grammar G with yield If L is N(M1) the language accepted by empty stack for some PDA M, then L is L(M2) language accepted by final state for some PDA M2. If L is L(M2) for some PDA M2, then show that L is N(M1) for some PDA M1. If L is context free language then prove that there exists a PDA M such that L = N(M) If L is context free language then prove that there exists a PDA M such that L = N(M) language accepted by empty stack Define deterministic PDA. Is it true that DPDA and PDA are equivalent in the sense of language acceptance is concern? Justify your answer Explain different types of acceptance of PDA. Are they equivalent in sense of language acceptance? Justify your answer. Prove that if L = N(PN) for some PDA PN = ( Q, , , N, q0, Z0 ) then there is a PDA PF such that L = L(PF) Explain in detail about equivalence of PDA and CFG 10. Prove that a CFL can be recognized by a PDA by empty stack. 11. Let G be a CFG snd let A*w in G. Then show that there is a leftmost derivation of w
w and also prove that if A=> w then it implies that w is a string of the language L defined by a CFG. 17. Let G be the grammar S 0B | 1A, A 0 | 0S | 1AA, B 1 | 1S | 0BB. For the string 00110101 find its leftmost derivation and derivation tree. 18. If G is the grammar S SbS | a, show that G is ambiguous. 19. Let G be the grammar S aS | aSbS | . Prove that L ( G ) = { x | each prefix of x has at least as many as as bs } 20. Show that E E + E | E * E | ( E ) | id is ambiguous 21. Find a CFG with no useless symbols equivalent to S AB | CA, A a, B BC | AB, C aB | b 22. Show that the grammar S a | Sa | bSS | SSb | SbS is ambiguous 23. Show that the grammar S aSb | bSaS | is ambiguous and what is the language generated by this grammar? 24. Write a grammar to recognize all prefix expressions involving all binary arithmetic operators. Construct parse tree for the sentence -*+abc/de, using your grammar 25. Is S aSb | aAb, the context free language. 26. Let the grammar S aB | bA A a | aS | bAA B b | bS | aBB for the string aabbbbaa find LMD, RMD and parse tree. 27. Explain about parse tree. For the following grammar Compiled By B. Udaya, AP / CSE, RIT A bAa, A ba is the CFG. Determine
Page No : 6
Construct a CFG G = ( V, T, P, S ) generating N(M) 47. Construct a PDA for the grammar S aB | bA S aAA A a | aS | bAA A aS | bS | a B b | bS | aBB 48. Construct an unrestricted PDA equivalent to the grammar given below 49. Construct a PDA that will accept the language generated by the grammar G = ({S,A}, {a,b}, S,P) with the production S AA | a, A SA | b 50. Construct an NPDA that accept the language generated by the grammar S aSbb | abb 51. Construct a PDA equivalent to the following grammar S aAA, A aS | bS | a 52. Consider the CFG = ( {S, T, C, D}, {a,b,c,d}, S, P) where P is S cCD | dTC | T cDC | cST | a C aTD | D dC | d
Present PDA that accepts the language generated by this grammar. Your PA must accept by empty store, it must start with S on its stack and it must be based on above grammar 53. Convert the grammar S aSb | A, A bSa | S | to a PDA that accepts the same language by empty stack.
Page No : 7
Unit IV
1. 2. Is it possible that a Turing Machine could be considered as a computer of functions from inters? If yes, justify your answer. Describe the following Turing Machine and their working. Are they more powerful than the basic Turing Machine? i) Multi tape Turing Machine ii) Multi dimensional Turing Machine iii) Non Deterministic Turing machine 3. 4. 5. 6. 7. 8. 9. Explain how the finite control of a Turing Machine can be used to hold a finite amount of information with an example. Explain how a multiple track in the TM can be used for testing given positive integer is a prime or not. Suppose G is a CFG and w of length l is in L(G). How long is a derivation of w in G if G is in CNF and if G is in GNF? Show that every CFL without can be generated by a CFG in CNF. Show that if L is accepted by a multitape Turing Machine, it is accepted by single tape Turing Machine also. Show that context free languages are closed under union operation but not under intersection Prove that the set of CFL is closed under union and kleene closure. 10. Write short notes on checking off symbol. 11. Prove that every non empty CFL is generated by a CFG with no useless symbols.
Page No : 8
S a | AAB
A ab | aB |
B aba |
42. Convert the following grammar into an equivalent one with no unit productions and no useless symbols. Convert to CNF S A | CB A C | D B 1B | 1 C 0C | 0 D 2D | 2 43. Construct a grammar in Greibach Normal Form equivalent to the grammar S AA | a, A SS | b 44. Convert to Greibach Normal Form of the grammar G = ( { A1, A2, A3}, {a, b}, P , A1 ) where P consists of the following A1 A2A3 Form 46. Find the GNF equivalent to the grammar S AA | 0, A1 A2A3 S a | AB A SS | 1 A2 A3A1 | a A3 A1A2 |b A a | BC
i j i j
A2 A3A1 | b
A3 A1A2 | a
47. Obtain Greibach Normal Form for the grammar 48. Convert the following grammar to GNF Bb Cb 49. Show that L = { a b c d | i > 1, j > 1 } is not a context free language 50. Show that the language {0n 1n 2n | n > 1} or {an bn cn | n > 1} or {aibici | i > 1 } is not a context free language. 51. Determine whether the language given by L = { an2 | n > 1 } is context free or not. 52. Construct a TM M for a language L = { anbn | n > 1 } 53. Define pumping lemma for context free language. Show that L={aibj ck|i<j<k} is not context free. 54. Is the language L = { anbncmdm | n, m > 1 } is context free? Justify with planning lemma
Page No : 9
Unit V
1. Define Universal language Lu. Show that Lu is recursively enumerable but not recursive or Define the language Lu. Check whether Lu is recursively enumerable? Or Lu is recursive? Justify your answer. 2. 3. 4. 5. 6. 7. 8. 9. Show that the complement of a recursive language is recursive. If a language L and its complement L are both recursively enumerable then show that L and hence L is recursive. Show that union of recursive language is recursive Define the language Ld and show that Ld is not recursively enumerable language. Explain the Halting Problem. Is it decidable or undecidable problem? Whether the problem of determining given recursively enumerable language is empty or not is decidable? Justify your answer. Describe how a Turing Machine can be encoded with 0 and 1 give an example. Find whether the following languages are recursive or recursively enumerable. a. b. c. d. Union of two recursive languages Union of two recursively enumerable languages If L and complement of L are recursively enumerable. Lu
10. Show that Finding whether the given CFG is ambiguous or not is undecidable by reduction technique. 11. Show that halting problem of TM is undecidable. Or a. b. c. Show that there exists a TM for which the halting problem is unsolvable. Discuss any two undecidable problems about the Turing machine. State the halting problem of TMs.
Page No : 10
Reduce the above problem to Posts Correspondence problem and find whether that PCP has a solution or not. 1. Let = { 0, 1 }. Let A and B be the list of three strings each defined as Does this PCP have a solution? i 1 2 3 List A wi 1 10111 10 List B xi 111 10 0
26. Obtain the code for < M, 1011 > where M = ({ q1, q2, q3 }, { 0, 1, B }, , q1, B, { q2 }) have moves ( q1, 1 ) = ( q3, 0, R ) ( q2, 1 ) = ( q2, 0, R ) ( q3, 0 ) = ( q1, 1, R ) ( q3, B ) = ( q3, 1, L )
Page No : 11