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

Cs2303-Theory of Computation

The document is a comprehensive question bank covering topics in Finite Automata, Regular Languages, and Context-Free Grammars. It includes various types of questions such as definitions, proofs, constructions of automata, and regular expressions, along with exercises related to languages accepted by different types of automata. The document is structured into units with parts A and B, focusing on theoretical concepts and practical applications in the field of automata theory and formal languages.

Uploaded by

danukrishnan003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Cs2303-Theory of Computation

The document is a comprehensive question bank covering topics in Finite Automata, Regular Languages, and Context-Free Grammars. It includes various types of questions such as definitions, proofs, constructions of automata, and regular expressions, along with exercises related to languages accepted by different types of automata. The document is structured into units with parts A and B, focusing on theoretical concepts and practical applications in the field of automata theory and formal languages.

Uploaded by

danukrishnan003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

QUESTION BANK

QUESTION BANK

UNIT-I FINITE AUTOMATA

PART-A(2-MARKS)
1 What is Computation? and Write short notes on TOC.
2 Define Automaton
3 Define Inductive and Deductive proof 4 Define hypothesis.
5 What is the principle of Mathematical Induction?
6 List any four ways of theorem proving.
7 What is structural Induction?
8 Write the central concepts of Automata Theory 9 Define Language and Give
example.
10 Define transition diagram.
11 What is Finite Automata and explain the applications of Finite automata.
12 Define the languages described by NFA and DFA.
13 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings beginning with 101.
14 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings containing 1101 as a substring.

15 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings ending in 00.
16 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings with three consecutive 0’s.
17. Give the DFA accepting the language over the alphabet 0,1 that have the set of all
strings with 011 as a substring.
18 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings whose 10th symbol from the right end is 1.
19 Construct a DFA for the following
a) All stings that contain exactly 4 zeros
b) All strings that don’t contain the substring 110.
20 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings that either begins or end(or both) with 01.
21 Give the DFA accepting the language over the alphabet 0,1 that have the set of
all strings such that the no of zero’s is divisible by 5 and the no of 1’s is
divisible by 3.
22 Difference between DFA and NFA 23 Define NFA.
24 Define the language of NFA.
25. Is it true that the language accepted by any NFA is different from the regular
language? Justify your Answer.
26. Define ε-NFA.
27. Define ε closure.
28. Find the εclosure for each state from the following automata.
Part B

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}

2. a)Show that the set L={a


n bn/n>=1} is not a regular. (6) b)Construct a DFA equivalent to the

NFA given below: (10)

0 1
p {p,q} P
q r R
r s -
s s S

3. a)Check whether the language=(0


L n 1n /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.

5. a) Construct a NDFA accepting all string in {a,b}+ with either two consecutive
a’s or two consecutive’s.
b

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.

6. Draw the NFA to accept the following languages.

(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. (10)

b)Construct DFA equivalent to the NFA given below: (6)

8.a) Prove that a language L is accepted by some


ε-NFA if and only if L is accepted by some
DFA. (8)

b) Consider the following


ε-NFA.Compute theε-closure of each state and find’sitequivalentDFA.
(8)

ε 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.

b) Convert the following NFA to


’s itequivalent DFA
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 if x is a non empty string in L(A),then for all k>0,x
k is also in L(A).

11.

12.Convert the followingε-NFA to DFA

states ε a b C

p Ф {p} {q} {r}

q {p} {q} {r} Ф

*r {q} {r} ф {p}


13.Prove that there exists a DFA for every
ε-NFA

14.
15.

2
16.Prove that for all n≥0 ∑ i = n(n+1)(2n+1) / 6 by the Mathematical induction.

17.Prove that all Natural numbers of the form n 3+2n are divisible by 3 using Prniciple of
Induction.

18.Show that 2n > n3 for n≥0 by mathematical induction

19.1+2+3+……….+n = n(n+1)/2

UNIT-II REGULAR LANGUAGES

PART-A

1 Define Regular expression. Give an example.


2 What are the operators of RE.
3 Write short notes on precedence of RE operators.
Write Regular Expression for the language that have the set of strings over
{a,b,c} containing at least one a and at least one b.
4 Write Regular Expression for the language that have the set of all strings of ’0s
and 1’s whose 10th symbol from the right end is 1.
5 Write Regular Expression for the language that has the set of all strings of ’0s
and 1’s with at most one pair of consecutive 1’s.
6 Write Regular Expression for the language that have the set of all strings of’s 0
and 1’s such that every pair of adjacent 0’s appears before any pair of adjacent
1’s.
7 Write Regular Expression for the language that have the set of all strings of 0’s
and 1’s whose no of 0’s is divisible by 5.
8 Write Regular Expression for the language that has the set of all strings of 0’s
and 1’s not containing 101 as a substring.
9 Write Regular Expression for the language that have theset of all strings of 0’s
and 1’s such that no prefix has two more 0’s than 1’s, not two more 1’s than
0’s.
10. Write Regular Expression for the language that have the set of all strings of 0’s
and 1’s whose no of 0’s is divisible by 5 and no of 1’s is even.
11. Give English descriptions of the languages of the regular expression (1+ ε)
(00*1)*0*.
12. Give English descriptions of the languages of the regular
expression (0*1*)*000(0+1)*.
13. Give English descriptions of the languages of the regular expression
(0+10)*1*.
14. Convert the following RE to ε-NFA.01*.

15. State the pumping lemma for Regular languages.


16. What are the application of pumping language? And State the closure
properties of Regular language.
17 Prove that if L and M are regular languages then so is LUM.
18 What do you mean by Homomorphism?
19 Suppose H is the homomorphism from the alphabets {0,1,2} to the alphabets
{a,b} defined by h(0)=a h(1)=ab h(2)=ba. What is h(0120) and h(21120).
20. Suppose H is the homomorphism from the alphabets {0,1,2} to the alphabets
{a,b} defined by h(0)=a h(1)=ab h(2)=ba. If L is the language L(01*2) what is
h(L).

21. Let R be any set of regular languages is U Ri regular?Prove it.


22. Show that the compliment of regular language is also regular.
23 . What is meant by equivalent states in DFA.
24. Define ARDEN’S THEOREM

PART-B
1. a)Construct an NFA equivalent to (0+1)*(00+11)

2. a)Construct a Regular expression corresponding to the state diagram given in


the following figure.
b) Show that the set E={0
i 1i |i>=1} is not Regular. (6)

3.a)Construct an NFA equivalent to the regular expression (0+1)*(00+11)(0+1)*.

b)Obtain the regular expression that denotes the language accepted by the following DFA.

4.a)Construct an NFA equivalent to the regular expression ((0+1)(0+1)(0+1))*

b)Construct an NFA equivalent to 10+(0+11)0*1

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 formula Rijk

6. a)Show that every set accepted by a DFA is denoted by a regular Expression

b)Construct an NFA equivalent to the following regular expression01*+1.


7. a)Define a Regular set using pumping lemma Show that the language
0i2L={
/ i is an
integer,i>=1} is not regular

b)Construct an NFA equivalent to the regular expression 10+(0+11)0*1


n2/n
8. a) Show that the set L={O is an integer,n>=1} is not regular.
*
b)Construct an NFA equivalent to the following regular expression ((10)+(0+1)
01. (10) 9.a)Prove that if L=L(A) for some DFA A,then there is a regular
expression R such that L=L(R).

b) Show that the language p{0


,p is prime} is not regular.

10.Find whether the following languages are regular or not.

(i) L={wε{a,b}|w=wR}.
(ii) L={0 n 1m 2n+m,n,m>=1}
(iii) L={1k|k=n2,n>=1} . (4)
(iv) L1/L2={x | for someεL2,xy
y εL1},where L1 and L2 are any two languagesL1/L2
and
is the quotient of L1and L2.

11.a) Find the regular expression for the set of all strings denoted by213
R 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.
b)Find the regular expression for the set of all strings denoted by R 223 from the
deterministic finite automata given below.

14.a) Find whether the languages {ww,w is in (1+0)*} and{1k | k=n2 , n>=1} are regular or
not.

b) Show that the regular languages are closed under intersectionand reversal.

15. If L = L(A) for some DFA A,then there is a regular expression R such that L=L(R).

16.Every language defined by a regular expression is also defined by a Finite automaton.


(Or) Let r
be a regular expression is also defined by a finite automaton.

17. Convert the regular expression (0+1)* 1 (0+1) to ɛanNFA

18.Explain in detail of closure properties of Regular languages


2
19. Find the regular expressionfor the set of all strings denoted by R 13 from the deterministicfinite
automatagiven below:(16)
(OR)

b) i) Show that the regular languages are closed under intersectionandreversal. (8)
n2/n
ii) Show that the set L={O is an integer,n>=1}is not regular.(8)

20.
21.
22.

23.

UNIT-III CONTEXT FREE GRAMMARS

PART-A
1. Define CFG.2.Find L(G)where G=({S},{0,1},{S ->0S1,S->ε},S).
2. Define derivation tree for a CFG(or)Define parse tree.
3. Construct the context-free grammar representing the set of palindromes over
(0+1)*
*
4. construct a context free Grammar for the given expression (a+b) (a+b+0+1)
5. Consruct a CFG for the language L = { na / n is odd}
n n
6. Construct the CFG for generating the language L={a
b /n>=1}.
7. Let G be the grammar S->aB/bA,A->a/aS/bAA,B->b/bS/aBB.for the string
aaabbabbba find the left most derivation.
8. Let G be the grammar S->aB/bA,A->a/aS/bAA,B->b/bS/aBB.obtain parse tree
for the string aaabbabbba.
9. For the grammar S->aCa,C->aCa/b.Find L(G).
10. Show that id+id*id can be generated by two distinct leftmost derivation in the
grammar E->E+E | E*E | (E) | id .
11. For the grammar S->A1B,A->0A | ε, B-> 0B | 1B| ε,give leftmost and
rightmost derivations for the string 00101.
12. Find the language generated by the CFG G=({S},{0,1},{S->0/1/ ε, S-
>0S0/1S1},S).
13. obtain the derivation tree for the grammar G=({S,A},{a,b},P,S) where P
consist of S->aAS / a, A->SbA / SS / ba.
14.Consider the alphabet ∑={a,b,(,),+,*, ., ε} .Construct the context free grammar
that generates all strings in ∑* that are regular expression over the alphabet
{a,b}.
15 Write the CFG to generate the set {am bn cp | m + n=p and p>=1}.
16 Construct a derivation tree for the string 0011000 using the grammar S->A0S |0
| SS , A-> S1A | 10.
17 Give an example for a context free grammar.
18 Let the production of the grammar be S-> 0B | 1A, A-> 0 | 0S | 1AA, B-> 1|1S |
0BB.for the string 0110 find the right most derivation.
19 What is the disadvantages of unambiguous parse tree. Give an example.
20 Give an example of PDA.
21. Define the acceptance of a PDA by empty stack. Is it true that the language
accepted by a PDA by empty stack or by that of final state are different
languages.
22. What is additional featurePDA has when compared with NFA? Is PDA superior
over NFA in the sense of language acceptance? Justify your answer.
23. Explain what actions take place in the PDA by the transitions (moves)
δ(q,a,Z)={(p1,γ1),(p2, γ2),…..(pm, γm)} and δ(q, ε,Z)= {(p1,γ1),(p2, γ2),…..
(pm,γm)}.
19. What are the different ways in which a PDA accepts the language? Define
them. Is a true that non deterministic PDA is more powerful than that of
deterministic PDA? Justify your answer.
20. Explain acceptance of PDA with empty stack.
21. Is it true that deterministic push down automata and non deterministic push
down automata are equivalent in the sense of language of acceptances? Justify
your answer.
22. Define instantaneous description of a PDA.
23. Give the formal definition of a PDA.
24. Define the languages generated by a PDA using final state of the PDA and
empty stack of that PDA.
25. Define the language generated by a PDA using the two methods of accepting a
language.
26. Define the language recognized by the PDA using empty stack.
27. For the Grammar G defined by the productions S → A/ B
A→ 0A/ɛ
B → 0B/ 1B/ɛ
Find the parse tree for the yields (i) 1001 (ii) 00101
28. Construct the Grammar with the productions
E → E+E
E→id Check whether the yield id + id + id is having the parse tree with root E or not.
29. What is ambiguous and un ambiguous Grammar?
30. Show that E→E+E/E*E/( E ) / id is ambiguous.
31. S→aS/ aSbS/ɛ is ambiguous and find the un ambiguous grammar. 32. Define
the Instantaneous Descriptions ( ID )

PART-B
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.
3) a) If G is the grammar S->Sbs/a, Show that G is ambiguous.

b) Give a detailed description of ambiguity in Context free grammar

4. a) Show that E->E+E/E*E/(E)/id is ambiguous. (6) b)Construct a Context free


grammar G which accepts N(M), where M=({q0, q1},{a,b},{z0,z},δ,q0,z0,Φ) and
where δis given by
δ(q0,b,z0)={(q0,zz0)}

δ(q0, ε,z0)={(q0, ε)}

δ(q0,b,z)={(q0,zz)}

δ(q0,a,z)={(q1,z)}

δ(q1,b,z)={(q1, ε)}

δ(q1,a,z0)={(q0,z0)}
5. a)If L is Context free language then prove that there exists PDA M such that L=N(M).

b)Explain different types of acceptance of a PDA.Are they equivalent in sense of


language acceptance? Justify your answer.

6. Construct a PDA accepting {a nbman/m,n>=1} by empty stack. Also construct the


corresponding context
-free grammar accepting the same set.
7. a) Prove that L is L(M2 ) for some PDA M2 if and only if L is N(M1) for some PDA
M1.

b)Define deterministic Push Down Automata DPDA. Is it true that DPDA and PDA are
equivalent in the sense
of language acceptance is concern? Justify Your answer.

8.a) Construct a equivalent grammar G in CNF for the grammar G1 where G1


=({S,A,B},{a,b},{S
->bA/aB,A->bAA/aS/a, B
->aBB/bS/b},S)

b)Find the left most and right most derivation corresponding to the tree.

9. a) Find the language generated by a grammar

G=({S},{a,b},{S
->aSb, S->ab},S) (4)

b) Given G=({S,A},{a,b},P,S) where P={S


->AaS|S|SS,A->SbA|ba}
S-Start symbol. Find the left most and right most derivation of the string
w=aabbaaa. Also construct the derivation tree for the string w.
c) Define a PDA. Give an Example for a language accepted byPDA by empty stack.
10. G denotes the context-free grammar defined by the
following rules. ` S->ASB/ab/SS A->aA/A ,B->bB/A
(i)Give a left most derivation of aaabb in G. Draw the associated parse
tree. (ii)Give a right most derivation of aaabb in G. Draw the associated
parse tree.
(iii) Show that G is ambiguous. Explain with steps.
(iv) Construct an unambiguous grammar equivalent to G. Explain.

11 a) Construct the grammar for the following PDA.

M=({q0, q1},{0,1},{X,z0},δ,q0,Z0,Φ) and where δis given by

δ(q0,0,z0)={(q0,XZ0)}, δ(q0,0,X)={(q0,XX)},δ(q0,1,X)={(q1, ε)},


δ(q1,1,X)={(q1, ε)},δ(q1, ε,X)={(q1, ε)}, δ(q1, ε, Z0 )={(q1, ε)}. (12)

b) Prove that if L is N(M1) for some PDA M1 then L is L(M2 ) for some PDA M2.

12.a) Construct a PDA that recognizes the language

{ai bj ck| 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.
13.

14.Explain in detail about equivalence of Push down automata and CFG

15.

You might also like