Imp theory of computation
Imp theory of computation
DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
om
QUESTION BANK
.c
ul
pa
jin
re
V SEMESTER
CS8501–THEORY OF COMPUTATION
w.
Regulation – 2017
Prepared by
Dr. L. Karthikeyan, Assistant Professor/ CSE
QUESTION BANK
SUBJECT : CS8501
om
Introduction to formal proof – Additional forms of Proof – Inductive Proofs –Finite Automata – Deterministic
Finite Automata – Non-deterministic Finite Automata – Finite Automata with Epsilon Transitions
.c
PART – A
17. Create a FA which accepts the only input 101 over the input set
Z={ 0,1} BTL-6 Create
18. Describe a Finite automata and give its types.
BTL-4 Analyze
19. Illustrate deductive proof.
BTL-3 Apply
20. Create a FA which checks whether the given binary number is
BTL-6 Create
even.
PART - B
1. (i)Explainif L is accepted by an NFA with ε-transition then show
om
that L is accepted by an NFA without ε-transition.(6)
.c
BTL-5 Evaluate
0 1
p {q,s} {q}
ul
q {r} {q,r}
r {s} {p}
s - {p}
pa
2. Prove for every n>=1 by mathematical induction Apply
∑ (i)={n(n+1)/2}. (13) BTL-3
3.
jin
4.
re
Give the NFA that accepts all strings that end in 01.Give its
transition table and the extended transition function for the input
BTL-2 Understand
string 00101.Also construct a DFA for the above NFA using
subset construction method.(13)
w.
5.
Construct DFA equivalent to the NFA given below: (13)
ww
BTL-2 Understand
om
accepted by some NFA(7)
(ii)Convert the following NFA to its equivalent DFA.(6)
0 1 BTL-3 Apply
p {p,q} {p}
.c
q {r} {r}
r {s} ф
*s {s} {s}
9. (i)Point out the steps in conversion of NFA to DFA and for the
jin
BTL-4 Analyze
(ii)Infer the following to a regular expression.(6)
w.
0 1
q q
ww
0 0,1
BTL-1 Remember
om
11. Tabulate the difference between the NFA and DFA .Convert the
following ε-NFA to DFA.(13)
.c
states ε a b c
BTL-1 Remember
p Ф {p} {q} {r}
q
*r
{p}
{q}
{q}
{r}
{r}
ф {p}
Ф
ul
pa
12. (i).Describe the extended transition function for NFA ,DFA and
– ε-NFA(6)
BTL-2 Understand
re
w.
ww
PART – C
1. (i) Draw and Explain the transition diagram for recognizing the set
of all operators in c Language.(8)
(ii)Evaluate a DFA from the given NFA(7)
M=({qo,q1},{a,b},δ,q0,{q1} with the state table diagram for δ given
BTL-5 Evaluation
below:
δ a b
qo {qo,q1} q1
q1 Ф {qo,q1}
2. Construct the following ε-NFA to DFA.(15)
om
states ε a b c
BTL-6 Create
p Ф {p} {q} {r}
q {p} {q} {r} {p,q}
.c
*r {q} {r} ф Ф
3. Infer the DFA which is accepting the following language over the
ul
alphabet{0,1}.The set of all the strings beginning with a1 that
wheninterrupted as a binary integer , is multiple of 5, For example BTL-4 Analyze
strings 101,1010 and 1111 are in the language 0,100 and 111 are
pa
not.(15)
Regular Expressions – FA and Regular Expressions – Proving Languages not to be regular – Closure Properties
of Regular Languages – Equivalence and Minimization of Automata.
w.
.
PART - A
Q.No Questions BT Level Competence
ww
5. Explaina finite automaton for the regular expression 0*1*. BTL-1 Remember
6. Illustrate a regular expression for the set of all the strings BTL-1 Remember
have odd number of 1’s R.E=1(0+11)*
8. Compose the difference between the + closure and * closure BTL-4 Analyze
9. Illustrate a regular expression for the set of all strings of 0’s BTL-2 Understand
and 1’sisnot
10. What thecontaining 101 as of
Closure property substring.
regular set S.? BTL-2 Understand
11. BTL-2 Understand
12. Find out the language generated by the regular
expression(0+1)*. BTL-5 Evaluate
om
BTL-1 Remember
14. Is it true the language accepted by any NFA is different from
the regular language? Justify your answer. BTL-4 Analyze
15. Show the complement of a regular language is also regular. BTL-3 Apply
16. Construct a DFA for the regular expression aa*bb*.
.c
BTL-3 Apply
17. State the precedence of RE operator. BTL-5 Evaluate
18. Construct RE for the language over the set z={a,b} in which
ul
BTL-6 Create
total number of a’s are divisible by 3.
19. Define RE.
BTL-1 Remember
pa
20. Create RE to describe an identifier and positive integer. BTL-6 Create
PART - B
1.
Demonstrate how the set L= {abn/n>=1} is not a
jin
BTL5 Evaluate
regular.(13)
2. Express that the regular languages are closed under:(13)
(a)union (b)intersection(c)Kleene Closure(d)Complement BTL-1 Remember
re
(e)Difference
3.
Examine whether the language L=(0n1n | n>=1) is regular or BTL-2 Understand
not? Justify your answer (13)
w.
(ii)Describe NFA with epsilon for the RE=(a/b)*ab and BTL1 Remember
convert it into DFA and further find the minimized
DFA.(7)
6.
Demonstrate how the set L= {anbn /n>=0} is not a
regular.(13) BTL-3 apply
om
10 Construct NDFA for given RE using Thomson rule. (13)
i) a.(a+b)* ab
ii) (a.b)* BTL-6 Create
iii) (a+b)
.c
11 Explain the DFA Minimization algorithm with an
BTL-1 Remember
example.(13)
12
Demonstrate how the set L= {anbm| m,n>=1} is not a
ul
regular.(13) BTL 2
Understand
pa
13 i) Prove the L1 and L2 are two languages then L1- L2 is
regular (7)
jin
ii) Prove the L1 and L2 are two languages then L1 . L2 is BTL 4 Analyze
regular (6)
is regular (7)
BTL-4 Analyze
ii) Prove the L1 and L2 are two languages then L1
intersection L2 is regular (6)
w.
PART – C
1. (i)Deduce into regular expression that denotes the language
accepted by following DFA.(7)
ww
1 0 0,1
1 2
BTL-5 Evaluate
(ii)Evaluate the equalities for the following RE and prove for
the same (8)
a. b+ab* +aa*b+aa*ab*
b. a*(b+ab*).
c. a(a+b)*+aa(a+b)*+aaa(a+b)*
om
Pushdown Automata – Equivalence of Pushdown Automata and CFG, Deterministic Pushdown Automata .
PART - A
Q.No Questions BT Level Competence
.c
1. Express the ways of languages accepted by PDA and define BTL 2 Understand
them?
2. Summarize PDA .Convert the following CFG to PDA
ul
S aAA , A aS|bS|a. BTL 2 Understand
B b|bS|aBB
9. Examine whether a pushdown automata has a memory? BTL 1 Remember
10. Designequivalence of PDA and CFG. BTL 6 Create
ww
11. Point out the languages generated by a PDA using final state
BTL 4 Analyze
of the PDA and empty stack of that PDA
12. Illustrate the rule for construction of CFG from given PDA BTL 3 Apply
13. Give a CFG forthe language of palindrome string over
BTL 5 Evaluate
{a,b}.Write the CFG for the language ,L=(anb n|≥n).
16. Infer the CFG for the set of strings that contains equal number
BTL 4 Analyze
of a’s and b’s over ∑ ={a,b}
17. Point out the various types of grammar with example BTL 1 Remember
19. Point out the additional features a PDA has when compared
om
BTL 4 Analyze
with NFA.
20. Convince your answer of acontext free grammar for the given
BTL6 Create
expression (a+b) (a+b+0+1)*
.c
PART - B
1. (i)Discuss about PDA and CFL Prove the equivalence of PDA
and CFL.(6) BTL 2 Understand
ul
(ii)If L is Context free language then prove that there exists
PDA M such that L=N(M). (7)
2.
pa
(i)Describe the different types of acceptance of a PDA. Are
they equivalent in sense of language acceptance? Justify your BTL 1
answer. (7) Remember
(ii)Design a PDA to accept {0 n1 n|n>1}.Draw the transition
jin
4. (i)Describe and draw the parse tree for the string 1+2*3
Given the grammar G=(V, ,R,E)where
V={E,D,1,2,3,4,5,6,7,9,0,+,-,*,/,9,)}
ww
om
6. (i)Define PDA. Give an Example for a language accepted
byPDA by empty stack.(7)
(ii)Convert the grammar
BTL 2 Understand
S ->0S1|A
A ->1A0|S| εinto PDA that accepts the same language by the
empty stack .Check whether 0101 belongs to N(M).(6)
.c
7. (i)Analyze the theorem: If L is Context free language then
prove that there exists PDA M such that L=N (M). (7) Analyze
ul
(ii) Prove that if there is PDA that accepts by the final state BTL 4
then there exists an equivalent PDA that accepts by Null
State.(6)
pa
8. Solve the following grammar
SaAa | bBb | BB
A C
B S | A
jin
iv) For the string abaabbba, find the right most derivation.(4)
9. (i)ExamineConstruct the grammar for the following PDAM.
M=({q0, q1},{0,1},{X,z0},δ,q0,Z0,Φ) and where δis given by
w.
δ(q0,0,z0)={(q0,XZ0)},
δ(q0,0,X)={(q0,XX)},
δ(q0,1,X)={(q1, ε)},
δ(q1,1,X)={(q1, ε)},
ww
BTL 3 Apply
δ(q1,ε,X)={(q1, ε)},
δ(q1, ε, Z0)=
{(q1, ε)}. (7)
(ii)Prove that if L is N(M1) for some PDA M1 then L is
L(M2 ) for some PDA M2. (6)
10. Construct a PDA that recognizes and analyzesthe language
{aibjck| i,j,k>0 and i=j or i=k}. BTL 4 Analyze
Explain about PDA acceptance
i) From empty Stack to final state. (6)
ii) From Final state to Empty Stack. (7)
om
12. (i) Describe the PDA that accept the given CFG (7)
S→xaax BTL-2 Understand
X→ax/bx/€
(ii) Express a PDA for the language anb man+m (6)
.c
13. (i) Illustratea PDA for the language {WCWR/W€{0,1}}.(7)
BTL-3 Apply
(ii) Illustrate a CFG for the constructed PDA. (6)
ul
14. (i)Identify CFG for the language L={0 i1j 0k | j>i+k} (7)
(ii)Define derivation tree. Explain its uses with an BTL-4 Analyze
example.(6)
pa
PART – C
1. (i)Design and Explaina PDA to accept each of the following
language BTL-5 Evaluation
jin
{aibjck|i=j or j=k}(7)
(ii) The set of all string with twice as many 0’s and 1’s. (8)
2. (i)Let P be a PDA with empty stack language L=N(P) and
suppose that ε is not in L. Designhow you would modify P so
re
BTL-6 Create
that it accepts L U { ε} by empty stack.(8).
(ii) Design a DPDA for even length palindrome.(7)
3.
w.
(i) Convert the following CFG to PDA and analyze the answer
(a+b) and a++. (8)
Ia|b|Ia|Ib|I0|I1 BTL-4 Analyze
EI|E+E|E*E|(E)
ww
4. (i)If L is a CFL then prove that there exists PDA M, such that
L=N(M) , language accepted by empty stack .(7) BTL-6 Create
(ii)Construct a PDA empty store , L= {am b n|n<m}.(8)
1. Conclude the procedure for converting CNF to GNF with an BTL 2 Understand
example
2. Illustrate the Basic Turing Machine model and explain in one
BTL 3 Apply
om
move. What are the actions take place in TM?
.c
5. Define the pumping Lemma for CFLs BTL1 Remember
6. Define Turing Machine. BTL1 Remember
7. Discuss the applications of Turing machine. BTL 2 Understand
8.
9.
Define Chomskian hierarchy of language.
What is the class of language for which the TM has both
ul BTL 1
BTL 2
Remember
Understand
pa
accepting and rejecting configuration? Can this be called a
Context free Language? Discuss.
10. Show the following grammar into an equivalent one with no
unit productions and no useless symbols
jin
SABA
BTL 3 Apply
AaAA|aBC|bB
BA|bB|Cb
CCC|cC
re
11. Explain the special features of TM? Define universal TM. BTL 5 Evaluate
Define Instantaneous description of TM
12. Define GNF. BTL 1 Remember
w.
13. Prepare the difference between finite automata and turing BTL 6 Create
machine.
14. List the three ways to simplify a context free grammar. What
BTL 5 Evaluate
ww
15. Draw a transition diagram for a Turing machine to identify BTL 1 Remember
n mod 2.
16. Express the techniques for TM construction. BTL 2 Understand
17. Develop the short notes on two-way infinite tape TM. BTL 6 Create
18. Differentiate TM and PDA. BTL 4 Analyze
19. Point outthe role of checking off symbols in a Turing Machine BTL 4 Analyze
PART - B
1. Express the following grammar G into Greibach Normal
Form(GNF) (13)
SXA|BB BTL 1 Remember
Bb|SB
Xb
Aa
2. Use the CFL pumping lemma to show how each of these
languages not to be context-free{aibjck| i<j<k} (13) BTL 2 Understand
om
3. (i)Discussa TM to accept the language LE={1 n 2 n 3n|n >= 1}
(6) BTL 2 Understand
(ii)Construct a turing machine that estimate unary
multiplication (Say 111 X 11 = 11111) (7)
4. (i)Illustrate the Turing machine for computing f(m, n)=m-n
( proper subtraction). (7)
.c
BTL 3 Apply
(ii)Demonstrate a Turing Machine to compute f(m+n)=m+n,
m,n>=0 and simulate their action on the input 0100. (6)
ul
5. (i)Examinethe role of checking off symbols in a Turing
Machine.(6) BTL 1 Remember
(ii)Describe a Turing Machine M to implement the function
pa
“multiplication” using the subroutine copy(7)
6. (i)Demonstrate the implications of halting problem.(7)
(ii)Show that if a language is accepted by a multitapeturing BTL 3 Apply
machine ,it is accepted by a single-tape TM .(6)
jin
om
0 languages.(7)
(ii) Consider two-tape Turing Machine (TM) and determine
BTL-6 Create
whether the TM always writes a nonblank symbol on its second
tape during the computation on any input string ‘w’. Formulate
this problem as a language and show it is undecidable.(8)
.c
2. (i) Define pumping lemma for CFL. Show that L={aibjck, i<j<k}
is not context free and Judge your answer.(6)
(ii) Construct a TM to move an input string over the alphabet A= BTL-5 Evaluate
ul
{a} to the right one cell. Consider that the tape head starts
somewhere on a blank cell to the left of the input string to the
right one cell , leaving all the remaining cell blank.(9)
pa
3. (i) Design and explain a TM to compute f(m,n) = m*n , for all
m,n€ N.(6) BTL-4 Analyze
(ii) Explain how a multi track in a TM can be used for testing
given positive integer is a prime or not(9).
jin
should halt. You may assume that there are no tape symbol other BTL-6 Create
than 0,1 and B(blank). Then , use this subroutine to design to
TM that accepts all strings of 0’s and 1’s that do not have two
1’s in a row.(8)
w.
UNIT V UNDECIDABILITY
Non Recursive Enumerable (RE) Language – Undecidable Problem with RE – Undecidable Problems about TM –
Post‘s Correspondence Problem, The Class P and NP
PART - A
Q.No Questions BT Level Competence
1. Distinguish between PCP and MPCP? What are the concepts BTL 2 Understand
used in UTMs?
om
2. List out the features of universal turing machine. BTL 1 Remember
3. When a recursively enumerable language is said to be
BTL 2 Understand
recursive? Discuss on it.
.c
languages
5. State when a problem is said to be decidable and give an
BTL 1 Remember
example of an undecidable problem.
6.
7.
Define NP hard and NP completeness problem.
Define a universal language Lu?
ul BTL 1
BTL 1
Remember
Remember
pa
8. Is it true that the language accepted by a non-deterministic
Turing Machine is different from recursively enumerable BTL 5 Evaluate
language? Judge your answer.
9. Formulate the two properties of recursively BTL 6 Create
jin
11. What is (a) recursively enumerable languages (b) recursive BTL 6 Create
sets? Generalize your answer.
12. Define the classes of P and NP. BTL 1 Remember
w.
BTL 4 Analyze
language.
16. Illustrate on Primitive Recursive Function. BTL 3 Apply
17. Show the Properties of Recursive Languages BTL 3 Apply
18. Explain about tractable problem. BTL 5 Evaluate
19. Describe post correspondence problem. BTL 2 Understand
20. Illustrate about Time and space complexity of TM. BTL 3 Apply
PART - B
om
B be the lists of three strings each ,defined as
List A List B
i wi xi
1 1 111 BTL 2 Understand
2 10111 10
.c
3 10 0
(i)Does the PCP have a solution?(7)
(ii)Prove that the universal language is recursively
5.
enumerable.(6)
(i)Explain computable functions with suitable example.(6)
(ii)Explain in detail notes on Unsolvable Problems.(7) ul BTL 4 Apply
pa
6. (i)Describe in detail notes on universal Turing machines with
example.(7) BTL 1 Remember
(ii)Collect and write the short notes on NP-complete
problems.(6)
jin
11. (i)Show that the characteristic function of the set of all even
number is recursive .(7) BTL-3 Apply
(ii)Illustrate in detail notes on primitive recursive functions
with examples.(6)
om
(ii)List out the short notes on NP-Hard Problems.(6)
PART – C
1. Consider and find the languages obtained from the following
operations:
(i)Union of two recursive languages.(5) BTL-5 Evaluate
.c
(ii)Union of two recursively enumerable languages.(5)
(iii)L if L and complement of L are recursively enumerable.(5)
2. Prove that the universal language is recursively enumerable but BTL-6 Create
ul
not recursive. Generalize your answer.(15)