CS6503 Toc QB2 Rejinpaul
CS6503 Toc QB2 Rejinpaul
com
www.rejinpaul.com
Department of Computer Science and Engineering
QUESTION BANK
UNIT-I AUTOMATA
PART-A (2-MARKS)
1. a) If L is accepted by an NFA with ε-transition then show that L is accepted by an NFA without
ε-transition.
b) Construct a DFA equivalent to the NFA.
M=({p,q,r},{0,1}, δ,p,{q,s}) Where δis defined in the following table.
δ 0 1
p {q,s} {q}
q {r} {q,r}
r {s} {p}
s - {p}
n n
2. a) Show that the set L={a b /n>=1} is not a regular.
b)Construct a DFA equivalent to the NFA given below:
0 1
p {p,q} P
q r R
r s -
s s S
n n
3. a)Check whether the language L=(0 1 /n>=1) is regular or not? Justify your answer.
b) Let L be a set accepted by a NFA then show that there exists aDFA that accepts L.
4. Define NFA with ε-transition. Prove that if L is accepted by an NFA with ε-transition then L is also
accepted by a NFA without ε-transition.
+
5. a) Construct a NDFA accepting all string in {a,b} with either two consecutive a’s or two
consecutive b’s.
b) Give the DFA accepting the following language:set of all strings beginning with a 1 that when
interpretedas a binary integer is a multiple of 5.
(i) Set of Strings over alphabet {0,1,…….9} such that the final digit has
appeared before. (8)
(ii) Set of strings of 0’s and 1’s such that there are two 0’s separated by a number of positions that is a
multiple of 4.
7. a)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.
b) Consider the following ε–NFA.Compute the ε–closure of each state and find it’s equivalent DFA.
ε A b C
p {q} {p} Ф Ф
q {r} ф {q} Ф
*r Ф ф ф {r}
9.a) Prove that a language L is accepted by some DFA if L is accepted by some NFA.
0 1
p {p,q} {p}
q {r} {r}
r {s} ф
*s {s} {s}
10.a) Explain the construction of NFA with εtransition from any given regular expression.
b) Let A=(Q,∑, δ, q0 ,{qf ) be a DFA and suppose that for all a in ∑wehave δ(q0, a)= δ(qf ,a). Show that
k
if x is a non empty string in L(A),then for all k>0,x is also in L(A).
PART-A
2 .a)Construct a Regular expression corresponding to the state diagram given in the following figure.
i i
b) Show that the set E={0 1 |i>=1} is not Regular.
b) Obtain the regular expression that denotes the language accepted by the following DFA.
5. a)Obtain the regular expression denoting the language accepted by the following DFA (8)
b) Obtain the regular expression denoting the language accepted by the following DFA by using the
k
formula Rij
2
7. a) Define a Regular set using pumping lemma Show that the language L={0i / i is an integer,i>=1}
is not regular
b) Construct an NFA equivalent to the regular expression 10+(0+11)0*1
9. a) Prove that if L=L(A) for some DFA A,then there is a regular expression R such that L=L(R).
p
b) Show that the language {0 ,p is prime} is not regular.
10. Find whether the following languages are regular or not.
R
(i) L={w ε{a,b}|w=w }.
n m n+m
(ii) L={0 1 2 ,n,m>=1}
k 2
(iii) L={1 |k=n ,n>=1} . (4)
(iv) L1/L2={x | for some y εL2,xy εL1},where L1 and L2 are any two languages and L1/L2 is the
quotient of L1 and L2.
(v){ambnam+n|m>=1 and n>=1}
2
11.a) Find the regular expression for the set of all strings denoted by R 13 from the deterministic finite
automata given below:
b) Verify whether the finite automata M1 and M2 given below are equivalent over {a,b}.
12. a) Construct transition diagram of a finite automaton corresponding to the regular expression
* *
(ab+c ) b.
13.a) Find the regular expression corresponding to the finite automaton given below.
2
b)Find the regular expression for the set of all strings denoted by R 23 from the deterministic finite
automata given below.
k 2
14.a) Find whether the languages {ww,w is in (1+0)*} and {1 | k=n , n>=1} are regular or not.
b) Show that the regular languages are closed under intersectionand reversal.
c) Dicuss on equivalence and minimization of automata
1. a) Let G be a CFG and let a=>w in G. Then show that there is a leftmost derivation of w.
b) Let G=(V,T,P,S) be a Context free Grammar then prove that if S=> αthen there is a derivation tree
in G with yield α.
2. Let G be a grammar s->OB/1A, A->O/OS/1AA, B->1/1S/OBB. For the string 00110101 find its
leftmost derivation and derivation tree.
b) Find the left most and right most derivation corresponding to the tree.
b) Prove that if L is N(M1) for some PDA M1 then L is L(M2 ) for somePDA M2.
12. a) Construct a PDA that recognizes the language
i j k
{a b c | i,j,k>0 and i=j or i=k}.
b) Discuss about PDA acceptance
(1) From empty Stack to final state.
(2) From Final state to Empty Stack.
PART-A
PART-B
16. Prove that the language L is recognized by a Turing Machine with a two way infinite tape if and only if
it is recognized by a Turing Machine with a one way infinite tape. (16)
17. For each of the following Context free languages L, find the smallest pumping length that will satisfy
the statement of the Context free pumping lemma. In each case, Your answer should include a
number(the minimum pumping length), a detailed explanation of why that the number is indeed a valid
pumping length for the given language L, and a detailed explanation of why no smaller number
qualifies as a valid pumping length for that particular language L.
n n
(i) L={a b |n>=0} (6)
(ii) L={w in {a,b}*|w has the same number of a’s and b’s} (6) (iii)L={w in {a,b}*| w has twice as many
a’s as b’s.}
k n
18.Design a Turing Machine M that decides A={0 /n>0 and k=2 } the language consisting of all strings of
0’s whose length is a power of 2.
19.a) Give a High level implementation description with a neat sketch of a Turing Machine M that
performs the following computation.M=on input w: writes a copy of w on the tape immediately after
w,leaving the string w#w on the tape.Assume that the input string initially appears at the left most end
of the tape and that the input alphabet does not contain the blank character’ : The end of the input
string is therefore determined by the location of the first blank cell on the input tape. The symbol # is
assumed to be in the tape alphabet,and the input alphabet is {a,b}.
b)Demonstrate the working of your TM with an example.
n n n
20.a)Show that the language{0 1 2 /n>=1}is not context free.
b)Show that the context free languages are closed under union operation but not under intersection.
PART-A
PART-B
3.a) Obtain the code for the TM M=({q1,q2,q3},{0,1},{0,1,B}, δ,q1,B,{q2}) With the moves
δ(q1,1)=(q3,0,R) δ(q3,0)=(q1,1,R) δ(q3,1)=(q2,0,R) δ(q3,B)=(q3,1,L) δ(q3,B)=(q3,1,L)
b) Show that Ln is recursively enumerable.
11.a) Show that the following language is not decidable. L={<M>| M is a TM that accepts the string aaab}.
b) Discuss the properties of Recursive and Recursive enumerable languages.
12.a) Define Post correspondence problem with an example.
n
b) Prove that the function f(n)=2 does not grow at a polynomial rate, in other words, it does not satisfy
p
f(n)=O(n ) for any finite exponent p.
13.a) Define the language Ld.Show that Ld is neither recursive nor recursively enumerable.
b) Show that if a language L and its complement L are both recursively enumerable then L is recursive.
14.a) What are the features of a Universal Turing Machine?
b) Show that “If a language L and its compliment L are both recursively enumerable,then both
languages are recursive”.
c) Show that halting problem of Turing Machine is undecidable.
3 3
15.a) Does PCP with two lists x=(b,b ab ,ba) and y=(b ,ba , a)have a solution?. (6) b)Show that the
characteristic function of the set of all even numbers is recursive. (6) c)Let ∑={0,1}.Let A and
B be the lists of three strings each,defined as List A List B i Wi Xi1 1 1112 10111 10310 0
Does this PCP have a solution?
16.a) Show that it is undecidable for arbitrary CFG’s G1 and G2 whether L(G1)∩L(G2)Is a CFL.
b) Show that “finding whether the given CFG is ambiguous or not” is undecidable by reduction
technique.
17. Find whether the following languages are recursive or recursively enumerable.
i) Union of two recursive languages.
(ii) Union of two recursively enumerable languages.
(iii) L if L and complement of L are recursively enumerable.
(iv) Lu
18.Consider the Turing Machine M and w=01, where M=({q1,q2,q3},{0,1},{0,1,B},δ,q1,B,{q3}) and δis
given by Reduce the above problem to Post’s correspondence Problem and find whether that PCP has
a solution or not.
19.Explain the Post’s Correspondence Problem with an example
20.Find the languages obtained from the following operations: