Cs2303-Theory of Computation
Cs2303-Theory of Computation
QUESTION BANK
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
0 1
p {q,s} {q}
q {r} {q,r}
r {s} {p}
s - {p}
0 1
p {p,q} P
q r R
r s -
s s S
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.
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)
ε 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.
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.
11.
states ε a b C
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.
19.1+2+3+……….+n = n(n+1)/2
PART-A
PART-B
1. a)Construct an NFA equivalent to (0+1)*(00+11)
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 formula Rijk
(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}.
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).
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.
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 α.
δ(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)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.
b)Find the left most and right most derivation corresponding to the tree.
G=({S},{a,b},{S
->aSb, S->ab},S) (4)
b) Prove that if L is N(M1) for some PDA M1 then L is L(M2 ) for some PDA M2.
15.