You are on page 1of 15

Rajalakshmi Institute of Technology

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 DFA equivalent to the NFA given below 0,1 q0

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

Compiled By B. Udaya, AP / CSE, RIT

Page No : 1

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
2. NFA. April / May 2008 1. 2. 3. Prove that for every integer n > 0 the number 4 divisible by 3. Construct a finite automata that accepts the set of all strings in { a, b, c }* such that the last symbol in input string appears earlier in the string. Nov / Dec 2008 1. Consider the following - NFA compute the - closure of each state and find its equivalent DFA p q r April / May 2009 1. 2. 3. 4. Construct a DFA equivalent for the given NFA with the transition diagram Construct an NFA accepting L given by L ={ x | {a, b }*| |x| > 3 and the third symbol of x from the right is b} Prove the following theorem If L is accepted by an NFA with transition, then L is accepted by an NFA without - transitions Draw state transition diagram for FA over { a, b } containing substring aabb Nov / Dec 2009 1. Prove that for any language L recognized by an NFA with transition, there exists 1. 3. 4. Prove that there exists a DFA for every NFA Show that the maximum edges in a graph ( with no self loops or parallel edges ) is given by ( n ( n 1 ) / 2 ) where n is the number of nodes Nov / Dec 2011 Prove the 2 is not rational r p q 2. { q, r } ----a --{p} --b {q} {r} --c {r} { p, q } {r} 2. 3. 1.
2n+1

Explain the extended transition function for NFA, DFA and 2. +3


n+2

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}

April / May 2010 is a multiple of 13 1.

Construct a DFA that will accept strings on { a, b } where the number of bs

Compiled By B. Udaya, AP / CSE, RIT

Page No : 2

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
2. Construct a DFA accepting all strings w over { 0, 1 } such that the Nov / Dec 2003 1. 2. Let r be a regular expression. Then prove that there exists an NFA with transition that accept L(r). Obtain the regular expression R for the following DFA A such that L (A ) = L ( R ) 3. UNIT II number of 1s in w is 3 mod 4 April / May 2012 1. 2. 3. Prove by induction on n that i = n ( n + 1 ) 2 Construct the transition diagram of a finite automata accepting all binary strings with even number of 0s and 1s Construct the finite automata without transition for the finite automata 4. Prove that it L be a language accepted by a NFA then there exists a DFA accepting L. Nov / Dec 2012 1. 2. 3. 4. Explain different forms of proof with examples Prove that, if L is accepted by an NFA with transition, then L is accepted by an NFA without transitions. Prove that if n is a positive integer such that n mod 4 is 2 or 3 then n is not perfect square. Construct a DFA that accept the following language { x e { a, b }: | x |a = odd and | x |b = even } April / May 2013 1. 2. 3. 4. Construct DFA to accept the language L = { w | w is of even length and begins with 11 } Write a note on NFA and compare with DFA Convert the following NFA to a DFA Discuss on the relation between DFA and minimal DFA p q r a {p} {r} --b { p, q } {r} --1. 2. 3. 3. 3. 1. 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

Compiled By B. Udaya, AP / CSE, RIT

Page No : 3

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
Nov / Dec 2005 1. 2. 3. Check whether the language L = { 0 1 | n > 1 } is regular or not? JYA. Construct an NFA equivalent to the regular expression ((0+1)(0+1) (0+1) )* Obtain the regular expression denoting the language accepted by the following DFA by using the formula Rijk April / May 2006 1. 2. 3. Construct an NFA equivalent to the following RE ( ( 10 )( 0 + 1 ))* 01 Check whether the language L = { 0 | n Z } is regular or not? Justify your answer. Prove that if L = L( A ) for some DFA A, then there is a regular expression R such that L = L( R ) Nov / Dec 2006 1. 2. Explain the construction of NFA with transition from any given regular expression. Fine the regular expression for the set of all strings denoted by R132 from the deterministic finite automata given below. 3. or not a. L = { w { a, b } | w = wR } c. L = { 1k | k = n2, n > 1 } April / May 2007 1. 2. verify whether the finite automata M1 and M2 given below are equivalent over { a, b } Construct transition diagram of a finite automata corresponding to the regular expression ( ab + c* )*b. 5. b. L = { 0n 1m 2n+m | n, m > 1 } d. L1 / L2 = { x | some y L2, x L1 } Nov / Dec 2007 1.
1
n2 + n n

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.

Find whether the following languages are regular 3. 4.

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.

April / May 2008

Compiled By B. Udaya, AP / CSE, RIT

Page No : 4

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
1. 2. equivalent DFA. Nov / Dec 2008 1. 2. Convert the regular expression ( a + b )*abb into - NFA and find the equivalent DFA. Fine the regular expression for the set of all strings denoted by R132 from the deterministic finite automata given below. 3. 4. 1. 2. 3. Find whether the language { ww, w is in ( 1 + 0 )* and ( 1 | k = n , n > 1 } are regular or not. Show that the regular languages are closed under intersection and reversal. 2. 3. 4. 1. Construct an NFA for the regular expression r = 1 * 0 +0 Construct an NFA to accept the language indicated by the following regular expression ((01+001)*0*)* Prove the following theorem Let r be a regular expression and then there exists an NFA with - transition that accept L(r). Nov / Dec 2009 1. 2. 1. 2. For a given RE r, prove that there exists an NFA with transition that accept L( r ). Find the RE corresponding to the following automata Construct an NFA for the following RE ( a + b )* ab Consider the alphabet A = {a, b } and the language L = { bb, bab, baab, baaab, } over a a. Is A * finite or infinite? Give a brief reason for your answer. 3. *A B C 0 A C A 1 B B B 2. Construct a - NFA for the following regular expression (0+1)*(00+11)(0+1)* Construct a minimized automata for the following automata to define the same language States q0 q1 q2 a q1 q0 q3 b q0 q2 q1
k 2

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 * )

Construct a NFA for the regular expression

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

April / May 2009

April / May 2011

April / May 2010

Compiled By B. Udaya, AP / CSE, RIT

Page No : 5

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
*q3 q4 q5 q6 q7 4. then the states are equivalent Nov / Dec 2011 1. 2. 3. State and explain the conversion of DFA into regular expression using Ardens theorem. Illustrate with an example What are the closure property of regular sets Define regular expression. Show that 3. 2. q3 q3 q6 q5 q6 q0 q5 q4 q6 q3 UNIT III Nov / Dec 2003 1. 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. Let M = ( {q0, q1}, {0, 1 }, { X, Z0 }, , q0, Z0, ) where is given by ( q0,0,Z0 ) = { ( q0,XZ0 ) } ( q0,1,X ) = { ( q1, ) } ( q1,,X ) = { ( q1, ) } 4. ( q0,0,X ) = { ( q0,XX ) } ( q1,1,X ) = { ( q1, ) } ( q1,,Z0 ) = { ( q1, ) } 5. 3. 4. Discuss in detail about the closure properties of regular languages Prove that the following languages are not regular a. { 02n | n > 1 } b. { ambnam+n | m > 1 and n > 1 } Discuss on equivalence and minimization of automata

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.

Nov / Dec 2012

Compiled By B. Udaya, AP / CSE, RIT

Page No : 6

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
5. Construct a CFG G which accepts N(M) where M = ({q0, q1}, ( q0,b,Z ) = { ( q0,ZZ ) } ( q0,a,Z ) = { ( q1,Z ) } ( q1,a,Z0 ) = { ( q0,Z0 ) } 2. 3. 4. 5. 5. Prove that L is L(M2) for some PDA M2, then show that L is N(M1) for some PDA M1. Nov / Dec 2005 1. 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 Find a CFG with no useless symbols equivalent to S AB | CA, A a, B BC | AB, C aB | b Prove that L is L(M2) for some PDA M2, then show that L is N(M1) for some PDA M1. Define deterministic PDA. Is it true that DPDA and PDA are equivalent in the sense of language acceptance is concern? Justify your answer Construct a CFG G which accepts N(A) where A = ( {q0, q1}, {a, b }, { Z0, Z }, , q0, Z0, ) where is given by ( q0,b,Z0 ) = { ( q0,ZZ0 ) } ( q0,,Z0 ) = { ( q0, ) } ( q1,b,Z ) = { ( q1, ) } April / May 2006 1. 2. 3. Prove that If L is context free language then prove that there exists a PDA M such that L = N(M) Explain different types of acceptance of PDA. Are they equivalent in sense of language acceptance? Justify your answer. If L is L(M2) for some PDA M2, then show that L is N(M1) for some PDA M1. Nov / Dec 2006 1. 2. 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) Construct a PDA for { anbma2(m+n) | n,m > 0 } ( q0,b,Z ) = { ( q0,ZZ ) } ( q0,a,Z ) = { ( q1,Z ) } ( q1,a,Z0 ) = { ( q0,Z0 ) } {a, b }, {Z0, Z}, , q0, Z0, ) where is given by ( q0,b,Z0 ) = { ( q0,ZZ0 ) } ( q0,,Z0 ) = { ( q0, ) } ( q1,b,Z ) = { ( q1, ) } 6. = N(M) Nov / Dec 2004 1. 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 2. 3. 4. 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 } Construct a PDA accepting {anbman | m,n >1 } by empty stack. Also construct the corresponding context free grammar accepting the same set. If L is L(M2) for some PDA M2, then show that L is N(M1) for some PDA M1. April / May 2005 1. 2. 3. 4. 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 Show that E E + E | E * E | ( E ) | id is ambiguous If L is context free language then prove that there exists a PDA M such that L = N(M) Let M = ( {q0, q1}, {0, 1 }, { X, Z0 }, , q0, Z0, ) where is given by ( q0,0,Z0 ) = { ( q0,XZ0 ) } ( q0,1,X ) = { ( q1, ) } ( q1,,X ) = { ( q1, ) } ( q0,0,X ) = { ( q0,XX ) } ( q1,1,X ) = { ( q1, ) } ( q1,,Z0 ) = { ( q1, ) }

If L is context free language then prove that there exists a PDA M such that L

Construct a CFG G = ( V, T, P, S ) generating N(M)

Compiled By B. Udaya, AP / CSE, RIT

Page No : 7

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
3. 4. Show that the grammar S aSb | bSaS | is ambiguous and 3. 4. S aAA A aS | bS | a what is the language generated by this grammar? Write a grammar to recognize all prefix expressions involving all binary arithmetic operators. Construct parse tree for the sentence -*+abc/de, using your grammar April / May 2007 1. 2. 3. 4. 5. Find a derivation tree of a * b + a * b given that a * b + a * b is in L( G ) where G is given by S S + S | S * S | a | b Show that the grammar S a | abSb | aAb, A bS | aAAb is ambiguous Consider the production S bA | aB, A bAA | aS | a, B aBB | bS | b. For the string aaabbabbba find a leftmost derivation Construct a PDA accepting by empty stack the language { a b c | m,n > 1} Show that set of all strings over { a, b } consisting of equal number of as and bs is accepted by a DPDA Nov / Dec 2007 1. 2. 3. 4. 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) Construct a PDA for the language { anb2n | n > 0 } Show that the grammar S a | Sa | bSS | SSb | SbS is ambiguous Construct a PDA for the grammar S aB | bA April / May 2008 1. Construct a CFG accepting L { ambn | n < m } and construct a PDA accepting L by empty stack. Nov / Dec 2008 1. 2. Design a PDA for recognizing the language { a b c | m,n > 1}using empty stack. Construct an unrestricted PDA equivalent to the grammar given below 2.
m n m m m n

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

April / May 2010

A a | aS | bAA B b | bS | aBB

Compiled By B. Udaya, AP / CSE, RIT

Page No : 8

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
S cCD | dTC | T cDC | cST | a C aTD | D dC | d 4. 3. Convert the grammar S aSb | A, A bSa | S | to a PDA that accepts the same language by empty stack. Is S aSb | aAb, the context free language. April / May 2012 1. A a | aS | bAA B b | bS | aBB 2. 3. 4. Let the grammar S aB | bA A a | aS | bAA B b | bS | aBB for the string aabbbbaa find LMD, RMD and parse tree. Construct the push down automata for S aSb | ab Construct PDA for the language L = { wwR | w in ( a + b )* } Explain the difference between acceptance by final state and empty stack in PDA. Nov / Dec 2012 1. Consider the following grammar for the list structures : S a / ^ / (T) 2. 3. 4.
i j k

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,

A ba is the CFG. Determine

April / May 2011

T T, S / S

Find the leftmost derivation,

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

Nov / Dec 2011

Compiled By B. Udaya, AP / CSE, RIT

Page No : 9

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
i) Multi tape Turing Machine ii) Multi dimensional Turing Machine UNIT IV Nov / Dec 2003 1. 2. 3. 4. 5. 1. 2. 3. 4. Is it possible that a Turing Machine could be considered as a computer of functions from inters? If yes, justify your answer. Design a Turing machine to compute proper subtraction m n Find a grammar in Chomsky Normal Form equivalent to S aAbB, A aA | a, B bB | b Construct a grammar in Greibach Normal Form equivalent to the grammar S AA | a, A SS | b Show that L = { a b c d | i > 1, j > 1 } is not a context free language Design a Turing Machine M to implement the function multiplication using the subroutine copy. Explain how a Turing Machine with the multiple tracks of the tape can be used to determine the given number is prime or not? Find a grammar in Chomsky Normal Form equivalent to S aAD, A aB | bAB, B b, D d Convert to Greibach Normal Form of the grammar G = ( {A1, A2, A3}, {a, b}, P , A1 ) where P consists of the following A1 A2A3 5. 1. 2. A2 A3A1 | b A3 A1A2 | a Show that the language { 0n 1n 2n | n > 1 } is not a context free language. Design a Turing Machine to compute f ( m + n ) = m + n m, n > 0 and simulate their action on the input 0100. Describe the following Turing Machine and their working. Are they more powerful than the basic Turing Machine? 3. 4. 5. 3. 2.
i j i j

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

Convert the grammar S AB, A BS | b, B SA | a into Greibach Normal

April / May 2004

Nov / Dec 2004

Compiled By B. Udaya, AP / CSE, RIT

Page No : 10

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
4. 5. Convert the grammar S AB, A BS | b, B SA | a into April / May 2007 1. 2. 3. 4. A3 A1A2 | a
n n

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

Nov / Dec 2007 1. 2. 3. 4.

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.

Nov / Dec 2008

Compiled By B. Udaya, AP / CSE, RIT

Page No : 11

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
3. 4. 1. 2. 3. 4. 5. 6. 7. 1. 2. Construct a TM M for a language L = { anbn | n > 1 } 3. 4. 1. Explain the closure properties of context free languages. Construct the Turing machine for the language L = { wwR | w is in ( 0 + 1 )* } Prove that every grammar with productions can be converted to an equivalent grammar without productions. 2.
i i i

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.

Nov / Dec 2009

April / May 2011

Reduce the following grammar to CNF A ab | aB | A a | BC B aba | Bb Cb


n n n

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.

Nov / Dec 2011

April / May 2010

April / May 2012 1. 2. 3. S AA | 0 A SS | 1


n n

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 }

Nov / Dec 2012 1.

Compiled By B. Udaya, AP / CSE, RIT

Page No : 12

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
2. 3. 4. 1. 2. 3. 4. State and prove the pumping lemma for CFL. Design a Turing machine which reverse the given string { abb } Write briefly about the programming techniques for TM. Nov / Dec 2004 1. B Yc | d C gA | c D dB | a Yf 2. 3. 4. Obtain the code for the TM M = ({ q1, q2, q3 }, { 0, 1 }, , q1, B, { q2 }) with moves ( q1, 1 ) = ( q3, 0, R ) ( q2, 1 ) = ( q2, 0, R ) Show that Lu is recursively enumerable. Define Ld and show that Ld is nor recursively enumerable. Whether the problem of determining given recursively enumerable language is empty or not is decidable? Justify your answer. UNIT V Nov / Dec 2003 1. 2. 3. 4. Define Universal language Lu. Show that Lu is recursively enumerable but not recursive 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. 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 ) April / May 2004 1. 2. 3. 4. 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? Define Universal Language Lu. Show that Lu is recursively enumerable but not recursive. 3. 1. 2. ( q3, 0 ) = ( q1, 1, R ) ( q3, B ) = ( q3, 1, L ) 2. 3. 3. April / May 2005 1. 2. Define the language Ld. Show that Ld is not recursively enumerable. Show that if a language L and its complement L are both recursively enumerable then L is recursive. Define the language Lu. Show that Lu is recursively enumerable but not recursive. Nov / Dec 2005 1. Define the language Lu. Check whether Lu is recursively enumerable? Or Lu is recursive? Justify your answer. Show that the language Ld is neither recursive nor recursively enumerable. Describe how a Turing Machine can be encoded with 0 and 1 give an example. April / May 2006 Show that Lu is recursively enumerable but not recursive. Define the language Ld. Show that Ld is neither recursive nor recursively enumerable. Show that if a language L and its complement L are both recursively enumerable then L is recursive. ( q3, 0 ) = ( q1, 1, R ) ( q3, B ) = ( q3, 1, L )

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.

Compiled By B. Udaya, AP / CSE, RIT

Page No : 13

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
Nov / Dec 2006 1. Find whether the following languages are recursive or recursively enumerable. a. b. c. d. 2. 3. Union of two recursive languages Union of two recursively enumerable languages If L and complement of L are recursively enumerable. Lu 1. 2. 6. 3 10 0 Show that it is undecidable for arbitrary CFGs G1 and G2 whether L( G1 ) n L( G2 ) is a CFL. Nov / Dec 2007 Explain the Post correspondence problem with an example Find the language obtained from the following operation a. b. c. 1. 2. 1. 2. 3. Union of two recursive languages Union of two recursively enumerable languages If L and complement of L are recursively enumerable.

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

Nov / Dec 2008

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.

April / May 2009 1.

Nov / Dec 2009

Compiled By B. Udaya, AP / CSE, RIT

Page No : 14

Rajalakshmi Institute of Technology


Department of Computer Science and Engineering Theory of Computation Part B - Anna University previous Semesters Question Papers
1. 2. 1. Prove that the Universal language is recursively enumerable 3. 4. 1. 2. 3. 4. 1. 2. 3. 4. 1. 2. 3. 4. Write short notes on recursive and recursively enumerable language Write short notes on NP hard and NP complete problems Discuss any two undecidable problems about the Turing machine Explain the difference between P and NP problems Discuss the decidability of Posts correspondence problem Explain any two NP complete problems If L1 and L2 are recursive languages then L1 U L2 is a recursive language Prove that the halting problem is undecidable State and prove the Posts correspondence problem Write a note on NP problem Explain about A language that is not Recursively Enumerable Prove Lne is recursively enumerable Discuss on undecidable problem about Turing Machine Explain about the PCP but not recursive. State and prove Rices theorem for recursively enumerable index sets Consider the language of all TMs that gives no input eventually writes a non blank symbol on their tapes. Explain why this set is decidable. Why does this non conflict with the halting problem 2. 3. 4. 1. 2. 3. 4. 1. 2. 1. 2. Prove that the Post Correspondence Problem is decidable for strings over the alphabets Prove that the problem of determining if the language generated by two CFGs are equal id undecidable. Prove that the punch card puzzle is NP complete. Explain the difference between tractable and intractable problems with an example What is halting problem? Explain Explain the Post correspondence problem with an example Explain any four NP complete problem Prove that the universal language Lu is recursively enumerable but not recursive. Also prove that Ld is not recursive or recursively enumerable Prove that PCP problem is undecidable and explain with an example State the halting problem of TMs. Prove that the halting problem of Turing Machine over { 0, 1 }* as unsolvable. Let = { a, b }*. Let A and B be the lists of three strings as given below A = { b, bab3, ba } B = { b3, bc, a } Does this instance of PCP have a solution? Justify your answer

April / May 2012

April / May 2010

Nov / Dec 2012

Nov / Dec 2010

April / May 2013

April / May 2011

Nov / Dec 2011

Compiled By B. Udaya, AP / CSE, RIT

Page No : 15