Theory of Computation - Part - B - Anna University Questions
Theory of Computation - Part - B - Anna University Questions
Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
UNIT I Nov / Dec 2003 --April / May 2004 1. If L is accepted by an NFA with - transition then show that L is accepted by an NFA without - transition Nov / Dec 2004 1. 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 April / May 2005 1. Let L be a set accepted by an NFA. Then prove that there exists a deterministic finite automaton that accepts L. Is the converse true? Justify your answer. Nov / Dec 2005 1. Construct DFA equivalent to the NFA given below 2. p q r April / May 2006 1. s 0 { p, q } {r} {s} {s} 1 {p} {r} --{s} 0 { q, s } {r} {s} --1 {q} { q, r } {p} {p} April / May 2007 1. Prove the following by the principle of induction n K2 = n( n + 1 ) ( 2n + 1 ) K=1 6 For the finite state machine M given in the following table, test whether the strings 101101, 11111 are accepted by M States q0 q1 q2 q3 3. 0 substring 101. 0 q0 q3 q0 q1 1 q1 q0 q3 q2 4. 3. 2. Consider - NFA. Computer the - closure of each state and find its equivalent DFA p q *r {q} {r} a {p} b --{r} c -- {r}
Prove that a language L is accepted by some DFA if L is accepted by some NFA. Convert the following NFA to its equivalent DFA p q r *s 0 { p, q } {r} {s} {s} 1 {p} {r} --{s}
Construct a DFA that accepts all the strings on { 0, 1 } except those containing the Prove that there is no x in ( a, b )* such that ax = xb 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.
q1
q2
4. 5.
Nov / Dec 2006 1. Prove that a language L is accepted by some - NFA if and only if L is accepted by some DFA.
Nov / Dec 2007 1. Draw the transition diagram for recognizing the set of all operators in C language
Page No : 1
an NFA without - transitions to recognize L. Construct an NFA without transition for the following 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? Nov / Dec 2010 Construct the deterministic finite automata for accepting the set of all strings with three consecutive 0s. Distinguish NFA and DFA with examples. Consider the finite automata transition table shown below with States Inputs Find the language accepted by the finite automata. (10) (ii) What is -closure (q)? Explain with an example. April / May 2011 1. Show that a connected graph G with n vertices and n 1 edges (n>2) has at least one leaf. Convert the following NFA to a DFA using the subset construction algorithm --{p} {q} a {p} {q} {r} b {q} {r} --c {r} --{p}
Page No : 2
0 1 2
State the pumping lemma for the regular sets. Show that the set L = { 0i2 | i is an integer, i > 1 } is not a regular
April / May 2004 Construct an NFA equivalent to ( 0 + 1 )* ( 00 + 11 ). Construct a Regular Expression corresponding to the state diagram given in the following figure. Show that the set L = { 0i 1i | i > 1 } is not regular Nov / Dec 2004 1. 2. Show that the set L = { an bn | n > 1 } is not a regular. Construct an NFA equivalent to the regular expression ( 0 + 1 )* ( 00 + 11 ) ( 0 + 1 )* Obtain the regular expression that denotes the language accepted by the DFA April / May 2005 Show that the set L = { 0n2 | n is an integer, n > 1 } is not regular Construct an NFA equivalent to the regular expression 10 + ( 0 + 11 ) 0*1 Obtain the regular expression that denotes the language accepted by q1 q2 q3
0 1 2
Page No : 3
3.
Construct a minimum state automata equivalent to a given automata M whose transition table is given below. States q0 q1 q2 q3 q4 q5 q6 a q0 q2 q3 q0 q0 q1 q1 b q3 q5 q4 q5 q6 q4 q3
0 1 2
4.
Find the regular expression corresponding to the finite automata given below
Convert the regular expression a( a +b)* a into - NFA and find the minimal state DFA. Fine the regular expression for the set of all strings denoted by R232 from the deterministic finite automata given below.
2.
Show that the language { 0p, p is prime } is not regular. Find whether the language { ww, w is in ( 1 + 0 )* and ( 1k | k = n2, n > 1 } are regular or not. Show that the regular languages are closed under intersection and reversal.
Page No : 4
Construct a regular expression to the transition diagram. ( a / b )*abb and draw its 3.
b. c. d. a. c. 4. 5.
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. b + ab* + aa* b + aa*ab* b. a* ( b + ab * )
Find an equalities for the following RE and prove for the same a ( a + b )* + aa ( a + b )* + aa ( a + b )*
State and prove using an example, the properties of regular language 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
Nov / Dec 2010 1. Let r be a regular expression. Prove that there exists an NFA with -transitions that accepts L(r) Is the language L = { anbn | n > 1 } is regular? Justify Construct the minimal DFA for the regular expression (a/b)*baa Prove that regular sets are closed under substitution. Construct a Regular Expression for the following DFA using Kleenes theorem
Page No : 5
Prove that if two states are not distinguished by the table filling algorithm
( 1 + 00 * 1 ) + ( 1 + 00 * 1 ) * ( 0 + 10 * 1 ) = 0*1 ( 0 + 10 * 1 )* April / May 2012 1. 2. 3. 4. 1. 2. 3. Write a regular expression for binary strings beginning with 1 and not having two consecutive 0s Construct the NFA and DFA for the regular expression ( a* / b* )* Prove that L is accepted by a DF then L is denoted by a regular expression Explain the closure properties for regular languages Using pumping lemma for the regular sets, prove that the language L = {ambn | m > n } is not regular Prove any two closure properties of regular language Construct a minimzed DFA that can be derived from the following regular expression 0*(01)(0/111)* April / May 2013 1. 2. Discuss the relation between DFA and minimal DFA Discuss on regular expression 3. 4. 2.
Construct a CFG G = ( V, T, P, S ) generating 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 April / May 2004 1. Let G be a CFG snd let A*w in G. Then show that there is a leftmost derivation of w. 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. If G is the grammar S SbS | a, show that G is ambiguous. If L is L(M2) for some PDA M2, then show that L is N(M1) for some PDA M1.
Page No : 6
If L is context free language then prove that there exists a PDA M such that L
Page No : 7
Construct a PDA for the language { anb2n | n > 0 } Construct PDA for the grammar S aB | bA A a | aS | bAA B b | bS | aBB
April / May 2009 1. 2. 3. 4. 5. Construct the CFG for the language L(G) = { ambn | m# n, m , n > 0 } Construct the CFG for the language L(G) = { anban | n > 1 } Define ambiguity, leftmost derivation and rightmost derivation with an example. 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 Construct an NPDA that accept the language generated by the grammar S aSbb | abb Nov / Dec 2009 1. 2. 3. 4. 1. Prove that a CFL can be recognized by a PDA by empty stack. Construct a PDA equivalent to the following grammar S aAA, A aS | bS |a Prove that every language recognized by a PDA is context free. Construct a PA for the set of palindrome over the alphabet { a,b } Consider the grammar S iCtS | iCtSeS | a C b where i,t and e stand for if, then and else an C and S for Conditional and statement respectively. a. b. c. d. Construct a leftmost derivation for the sentence w = ibtibtaea Show the corresponding parse tree for the above sentence Is the above grammar ambiguous ? if so prove it. Remove the ambiguity if any and prove that both the grammar produces the same languages Consider the CFG = ( {S, T, C, D}, {a,b,c,d}, S, P) where P is
A a | aS | bAA B b | bS | aBB
Page No : 8
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 Nov / Dec 2010 1. Explain about parse tree. For the following grammar S aB | bA For the string aaabbabbba, find i) Left most derivation ii) Rightmost derivation iii)Parse tree 2. 3. 4. 1. What is deterministic PDA? Explain with an example Construct PDA for the language L = { wcw | w in ( 0 + 1 )* } Let L is a context free language. Prove that there exists a PDA that accepts L. Prove that if w is a string of a language then there is a parse tree with yield w and also prove that if A=> w then it implies that w is a string of the language L defined by a CFG. 2. 3. 4. 5. 1. 2. Prove that the expression grammar is ambiguous EE+E|E*E|(E)|a Construct a CFG for the set { a b c | i # j or j # k } Prove that if there exists a PDA that accepted by final state then there exists an equivalent PDA that accepts by Null state. Construct a PDA to accept the language 0 1 by empty stack. Id NPDA and DPDA equivalent? Illustrate with an example What are the different types of language acceptances by a PDA and define them. Is it true that the language accepted by a PDA by these different types provides different languages?
n 2n
A bAa,
T T, S / S
rightmost derivation and parse free fro (((a,a),^(a)),a) Construct a PDA accepting the language {(ab)n | n > 1 } by empty stack. Construct a transition table for PDA which accepts the language L = { anb2n | n > 1 }. Trace your PDA for the input with n = 3. Find the PDA equivalent to the given CFG with the following productions SA April / May 2013 5. Explain about parse tree. For the following grammar S aB | bA A a | aS | bAA B b | bS | aBB For the string aaabbabbba, find i) Left most derivation ii) Rightmost derivation iii)Parse tree 6. 7. Construct PDA for the language L = { wwR | w in ( a + b )* } Explain in detail about equivalence of PDA and CFG A BCB ba Cac
Page No : 9
iii) Non Deterministic Turing machine 3. Begin with the grammar S 0A0 | 1B1 | BB, B C, B S | A, C S | . And simplify using the safe order. i) iii) 4. 5. Form State pumping lemma for context free language. Show that { 0n 1n 2n | n > 1 } is not a context free language. April / May 2005 1. State pumping lemma for context free language. Show that { an bn cn | n is an integer n > 1 } is not context free language. Design a Turing Machine to accept the language L = { 0n 1n | n > 1 } and simulate its action on the input 00111. Explain how the finite control of a Turing Machine can be used to hold a finite amount of information with an example. Design a TM to compute f( m, n ) = m * n, m, n N. Explain how a multiple track in the TM can be used for testing given positive integer is a prime or not. Nov / Dec 2005 1. 2. Design a Turing machine to compute proper subtraction m n Explain how a multiple track in the TM can be used for testing given positive integer is a prime or not. Obtain the CNF equivalent to the grammar S bA | aB, A bAA | aS | a, B aBB | bS | b Eliminate production Eliminate useless production ii) iv) Eliminate unit production Put the grammar in CNF
Page No : 10
Greibach Normal Form. State the pumping lemma for the context free language. Show that language { a b c d | i > 1 and j > 1 } is not context free. April / May 2006 1. Construct the equivalent GNF for the CFG G = ( { A1, A2, A3}, { a, b }, P , A1 ) where P consists of the following A1 A2A3 2. 3. 4. 5. 6. A2 A3A1 | b
n n n i j i j
Find a grammar in CNF equivalent to S aAbB, A aA | a, B bB | b Show that the language { an bn cn | n > 1 } is not a context free language. Design a Turing machine to compute x + y where x and y are positive integers. What are the features of universal Turing Machine? Simplify the following grammar and find its equivalent in CNF S AB | CA, B BC | AB, A a, C aB | b Find the GNF equivalent of the grammar form 0x 1 0y 1 S AA | 0, A SS
Show that the language { 0 1 2 | n > 1 } is not a context free language. Design a Turing Machine to accept the language L = { 0 1 | n > 1 } Explain with an example how the finite control of a Turing Machine can be used to hold a finite amount of information. Explain how a Turing machine can be viewed as a computing device on functions involving integers. Design a TM to compute f( m, n ) = m * n, m, n Z by using the subroutine..
+
Design a TM M for f( x, y ) = x * y where x, y are stored in the tape in the Show that context free languages are closed under union operation but not under intersection
April / May 2008 1. 2. 3. 1. 2. 3. Convert the grammar with production into CNF A bAB | , B Baa | Design a deterministic Turing Machine to accept the language {ai bi ci | i > 0 } Determine whether the language given by L = {an2|n>1} is context free or not. Simplify the following grammar and find its equivalent in CNF A AB | CA, B BC | AB, A a, C aB | b Find the GNF equivalent to the grammar form 0x 1 0y 1 April / May 2009 1. 2. Convert the grammar S AB | aB, A aab |, B bbA into CNF Prove that the set of CFL is closed under union and kleene closure. S AA | 0, A SS | 1 Design a TM M for f( x, y ) = x * y where x, y are stored in the tape in the
Nov / Dec 2006 1. 2. 3. 4. 5. 6. 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. Simplify the following grammar and find its equivalent in CNF S bA | aB, A bAA | aS | a, B aBB | bS | b Find the GNF equivalent to the grammar S AA | 0, A SS | 1 Design a TM M fro f( x, y, z ) = 2( x + y ) z, z < 2( x + y ) and x, y, z are stored in the tape in the form 0x10y1oz1. Show that if L is accepted by a multitape Turing Machine, it is accepted by single tape Turing Machine also.
Page No : 11
Write short notes on checking off symbol. Prove that every non empty CFL is generated by a CFG with no useless symbols. State and prove CNF for CFL. State and prove pumping lemma for CFL. Using pumping lemma P.T the language {a b c | i > 1 } is not context free. Design a TM to recognize each of the following languages Prove that TM with one way infinite tape and two way infinite tape are equivalent. Design a TM to compute n2. Define pumping lemma for context free language. Show that L = { ai bj ck | i<j<k } is not context free. Construct a TM to move an input string over the alphabet A = {a} to the right one cell. Assume that the tape head starts some where on a blank cell to the left of the input string. All other cells are blank, labeled by ^. The machine must move the entire string to the right one cell, learning all remaining cells blank.
S a | AAB 3. 4. 5. 1. 2. 3. 4. S a | AB
Convert the following grammar to GNF Construct a Turing machine to accept the language a b c
Construct a Turing Machine to perform proper subtraction State the techniques for Turing machine construction? Illustrate with a simple language Explain the different models of Turing machines What are the closure properties of CFL? State the proof for any two properties. State the pumping lemma for CFLs. What is its main application? Give two examples.
3.
Convert the following grammar into an equivalent one with no unit productions and no useless symbols. Convert to S A | CB D 2D | 2 AC|D B 1B | 1 C 0C | 0
Is the language L = { anbncmdm | n, m > 1 } is context free? Justify with planning lemma Obtain Greibach Normal Form for the grammar A1 A2A3 A2 A3A1 | a A3 A1A2 |b Construct Turing Machine for the language L = { 1n0n1n | n > 1 } Convert the following grammar into CNF S cBA, S A, A cB, A AbbS, B aaa
Nov / Dec 2010 1. 2. Obtain a Greibach normal form grammar equivalent to the context free grammar Construct the Turing machine for the language L = { 0 1 | n > 1 }
Page No : 12
April / May 2013 Convert the following grammar in CNF A BCD | b Discuss about programming techniques for Turing Machine. Explain about the closure properties of CFL. Explain in detail about pumping for CFL.
Page No : 13
Show that Finding whether the given CFG is ambiguous or not is undecidable by reduction technique. Consider the TM M and w = 01 where M = ({ q1, q2, q3 }, { 0, 1 }, , q1, B, { q3 }) and is given by 0 1 B q1 q2, 1, R q2, 0, L q2, 1, L q2 q3, 0, L q1, 0, R q2, 0, R q3 ------Reduce the above problem to Posts Correspondence problem and find whether that PCP has a solution or not.
April / May 2008 Prove that the function fadd( x, y ) = x + y is primitive recursive. Show that there exists a TM for which the halting problem is unsolvable. Prove Ld is on recursively enumerable and Lu is recursively enumerable Show that Finding whether the given CFG is ambiguous or not is undecidable by reduction technique. Find the language obtained from the following operation a. b. 4. Union of two recursive languages Union of two recursively enumerable languages
April / May 2007 1. 2. 3. 4. 5. Show that If a language L and its complement L are both recursively enumerable then L is recursive. Show that halting problem of TM is undecidable. Does PCP with two lists x = (b, b, ab , ba ) and y = ( b , ba, a ) have a solution. S.T the characteristics function of the set of all even number is recursive. 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 List A wi 1 10111 List B xi 111 10 2. 3. 4.
3 3
Define the class P and NP Prove the theorem If L1 and L2 are two recursive languages then L1 U L2 is also recursive language. If L1 and L2 are two recursively enumerable languages then L1 U L2 is also recursively enumerable languages Prove the theorem The complement of recursive language is recursive Prove that Lu is recursively enumerable. Prove that Lu is not recursive.
Page No : 14
Page No : 15