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

toc q

The document outlines examination questions for the Theory of Computation course at Tribhuvan University, covering topics such as regular expressions, finite automata, context-free grammars, Turing machines, and computational complexity. Candidates are instructed to provide answers in their own words and are required to attempt all questions, with marks indicated for each. Various theoretical concepts and practical design tasks are included, such as designing DFAs, proving properties of languages, and discussing the Church-Turing thesis.

Uploaded by

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

toc q

The document outlines examination questions for the Theory of Computation course at Tribhuvan University, covering topics such as regular expressions, finite automata, context-free grammars, Turing machines, and computational complexity. Candidates are instructed to provide answers in their own words and are required to attempt all questions, with marks indicated for each. Various theoretical concepts and practical design tasks are included, such as designing DFAs, proving properties of languages, and discussing the Church-Turing thesis.

Uploaded by

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

\

fr
33 TRIBHUVAN I.JNIVERSITY
INSTITUTE OF ENGINEERING
Examination Control Division lr"gr*ry
2075 Ashwin Part
Year /

Subject: - Theory of Computation (C!50Q


Candidates are required to give their answers in their own words as far as practicable.
Attempt All questions.
Thefigures in the margin indicate Fall Markg
Assume suitable data if necessary.

t. a) Write a regular expression for the language in which strings start and end with
different symbol over alphabet I= {u,b}. t3]

b) Define Diagonalization Principle. Explain Principle of mathematical induction with


suitable example. [1+3]
2. What are the components of finite automata? Design a DFA that accepts the strings given
:
by L {we {q b}*: w has number of a divisible by 3 and number of b by [1+6J 2}.
3. List closure properties of regular language. If M and N are any two regular languages
then show that L: (Mt-rN) is also regular language. [2+5]
4. Write the statement of Pumping lemma for regular languages. Show that L = {u"b",n t 0}
is not a regular language by using pumping lemma. [3+4]

5. Write Context Free Grammar for the Language L={u'Uirt:i,j>0} over the alphabet
f={a,b,c}. Use Leftmost, rightmost derivation to generate sffings "aabbbcc''. Also
draw parse tree for the same. t7l
6. Convert following CFG into CNF with explanation of each steps. G: (V, t, R, S), where
V: {S, X, Y, a, b, c},
I: {a, b, c}, .
= {S-+aXbX, X+aYlbYlXYle , Y+aXlc}.
R. L7l
7. What is additional feature PDA has when compared with finite automata? Explain.
Design a Pushdown Automata (PDA) which accepts all the strings of language
L : {anb'c'n;n,m > 0}. [2+5]

8. Design a Turing machine that increments any binary strings by one with f = {0,t,*}.
Hence test your design for ##11# to #100# t71
q

9. How multi-tape Turing machine is different from multi-track Turing Machine? Does any
variation of Turing machine have more computational power than standard Turing
machine? Explain. 12+51

10. example.
Descibe in detail about on universal Turing machines with t5]
11. Explain the Church Turing thesis. Show that the "halting problem" is undecidable. [3+41
12. Explain NP hard and NP-Complete Problems with reference to polynomial time
reduction. t5l
:1. {. i.
33 TzuBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING
Examination Control Division
2074 Chaitra

: ThSgry glCge_ey- tation


Sy_bi"n="j, (CT502)

,/ Candidates are required to give their answers in their own *'ords as far as practicable.
,/ Auempt All questions.
'/ Thefigures in the margin indicate Fall Marks.
y' Assume suitable data if necessary.

1. What are regular expressions? Find the equivalence classes for the set
N : { 1,2,3,4, 5 ....} corresponding to the equivalence relation R : {(a, b): (a+b) is even
number). [2+5]
Explain finite automata with their application. Design a DFA that accepts the language
L: {w e {a, b} : w must have either aaaor bbb as a substring}' [2+s]
3. Convert the following NFA into it's equivalent DFA. 171

4. State the pumping lemma for the regular languages. Show that the Language
L: {Ont l .t >
: 1} not regular e.g.
ifn= 1, w: 0o f,:2,w : 0000,n : 3, w: 000000000 [2+5]
5. Define context free Grammar (CFG). Show that L : {anb2nc3n : n > 0} is not context free
language by using Pumping lemrna for CFL. 12+sJ

6. Convertthe following CFG into CNF. G: {V, T, P, S} t71


Where, V: {S, A, B, C,4 b, c}
T: ia b, c)
P: {S +ABAI abAl BC,A + aAl a, B -+baBl c, C -+ aC}

7. Design a push down automaton (PDA) for L: {un btn : n > 1}. Hence test for "aaabbb"
and "aabbbb". ls+21
s
8. Define Turing Machine. Design a single tape detemrinistic Turing Machine which
reverses the given string w, over alphabet I: {a, b}. [2+s]
9. Explain how unrestricted grammar can be used to generate the language
;={anbncn:n>0}.
Is there any difference betrveen CFG and Unrestricted grammar? Explain L4+21

10. Explain encoding technique of universal Turing machine. Show that complement of
recursive language is recursive. [s+4]
ll.What do you mean by Church-Turing Thesis? State when a problem is said to be
decidable and give an example of anundecidable problem. [2+21
43 TRIBHUVAN T'NIVERSITY
INSTITUTE OF ENGINEERING
Examination Control Division
2074 Ashwin

Candidates are required to give their answers


in their own words as far as practicable'
Attempt All questions-
fhe Jigltres in the margin indicate Full Marks'
Assume suitable data if necessory'

!
I State the diagonalizable principle. Use principle
of mathematical induction principle to
fron"
0'
,ro -+Jt l, divisible by 3 for n 2
[3+4J

that accepts the strings over an


2. what is the significance of finite automata? Design a DFA
test your design for any
that either start with 01 or end with 01. Hence
"fofr"U"t i=jO;) [l+6]
two strings.
the following NDFA to its DFA' [2+5)
a
.f. Differentiate between DFA and NDFA. Convert

.1

Prove that regular Language are closed


4. Define Closure properties of Regular Language'
operation' [1+6]
under Union, Intersection and Complementation

5. Define pumping ,lemma for context free language' Prove that language
I t r rrl [2+sl
I = {wwlW € tl,0}-} is not context free'

Convert following CFG into CNF with explanation


of each steps' G=(V'E'R"S)' where t7l
6.
V = {S,A,B,a,b},
E: {a,b}
a= {S-+ASBle , A+aASla, B+ABlble }'
7. Mention role of parse tree in context free grcmmar.
Design a PDA that accepts

;=j;;;;,; ;fu; check it for string aabbbbb' 12+51

which accepts all strings defined for


8. Design a single tape deterministic Turing machine
i5l
the language L = {ancbn : n 2 0} over alphabet l= {a'b'c}'
act as Copying machine over the alphabets
9. Design a rnulti-tape Turing machine which
string of the form "#10#' into "#10#10#"' t5l
{O,f } that transforms
I=
1*
brief.
10. Defrne unrestricted grammar. Explain possible extensions of Turing machine in [1+6]
I i. What is universal Turing machine? How Universal Turing machine works? Explain. t5]
12. Explain Halting problem. Is it solvable problem? Dscuss. t4l
13. What are two factors affecting the computational complexity of a problem? Explain class
NP with suitable example. u+41
'.*
43 TRIBHUVANUNTVERSITY
INSTITUTE OF ENGINEERING
Examination Control Division Programme
2073 Shrawan

Suhject: - Theory of Computation (CT502)

Candidates are required to give their answers in their own words as far as practicable.
Attempt All questions.
TheJigures in the margin indicate Full-Marlg;
Assume suitable data dnecessary'

l. State pigeonhole principle. Prove the following statement by using mathematical


induction: !xlt+)x2l+3x3!+............+nxn! : (n+1)!-1 where (e1). [2+5]
2. Define Configuration of DFA. Design a Deterministic Finite Automata (DFA) for
language L = {w e{0,1}:w has both 0l and 10 as substrings}. Verify your design by taking
one accepted and one rejected strings. [2+5]
3. Construct a NFA for the language (ab*a U b*aa). Provide any two accepted strings and
two rejected strings. I71
4. State pumping lemma for regular language and use this theorem to prove that
1 = {anb2n : n ) i} is not regular. 171

5. Construct a PDA which accepts the langUage L = {anbn*'c' : n,m 21} . Veriff your
desrgn by taking s string "abbbcc" as example. I71

6. What is Chomsky? Normal Form (CNFX {S,L,M,N,a,b,c} , I= {a,b,c},

R = {S -+ tvtaNlbflUVt , I- + ablcN[M{e , M + alcM,N + abN} and S is the start symbol. [2+5]

7. Construct a CFG for the language L = anb2n,n > 0 and use this granrmar to generate the
string aabbbb. Also construct the parse tree. [5+2]
8. Design a Turing Machine (IlW) which accepts the following language
L = {W e{x,y,z\*:w has equal no. of x's,y's and z's}. Veri$ your design for the sning
"ttxyxyzz#". t6l
g. Design a two tape Turing machine that acts as a binary adder. Assume both the strings are
kept at first tape and separated by a semicolon and output is desired at the same tape. t7]
10. Explain Recursive and Recursively Enumerable Languages with suitable examples of
each language.{ t4I
11. Define unrestricted grammar. Explain, how unrestricted grammar can be defined as super
set of CFG and Regular Grammar? Explain the church-turing thesis. [2+3+47
12. Explain class P and NP problems with example. What is NP-complete problem? t5l
tf *:f
TRIBHUVAN LINIVERSITY
INSTITUTE OF ENGINEERING
Examination Control Division
2072 Chaitrz

$Ri*l : : Tlggry_ o{ Cornp,ql_at ion (cr 5 a 2)

r' Candidates are required to give their answers in their own words as far as practicable.
{ Attempt All questions.
,/ Thefigures in the margin indicate Full MarkL.
{ Assume suitable data dnecessary.

L a) Define catesian Product. use Mathematical Induction to show [1+3]


1.1!+2.2t +.........+n.n! : (n+l )!-1 for n > I
b) Find the regular expression for the language L = {W e {0, I }*: has 0101 as substring.
t3l
2. Construct a DFA over {a,b} accepting strings having even number of 'a' and odd number
of 'b'.
t7l
3. Define DFA formally. State and prove closure properties of regular languages. L7l
4. Define pumping lemma for regular language. Use pumping lemma for regular language to
show L = {anban for n = 0,1,2......} is not regular.
[2+s]
5. Define the configuration of PDA. Design a PDA that accepts L = {a3nbn,n > 0} and
check the string aaaaaabb.
t71
6. Define context free grammer.Convert the given Context Free Grammar (CFG) into
equivalent CNF
[2+5]
S+AB
A-+aAA le
B-+bBB le, Here: e means emptysymbol '
7 . a) V/rite a CFG for the regular expression R : 0* l(OUD* 14l
b) Use concept of closure propertv to prove that intersection of Context Free Languages
is not Context Free.
t3l
8. Design a Turing machine to compute the functionf(n) = ri *1, where n be a binary string.
Show the processing for the string 10111. t6l
9.
!_e!ne {u{ipfe Turing Machine. With the help of suitable example, explain how
Universal Tiring machine works. [2+Sl
10. State church ruring thesis. what is a recursive language? 12+21
11. Show that if a language L and its complement both are recursively enumerable, then L
and its complement is recursive. Explain the halting problem.
[4+s]
12. Write short notes on:
t5l
a) Computational Complexity
b) NP hard and NP Complete Problems
""- -:-Z\

{3 IRIBHWAI{I.'NIVERSITY Exem. licg u I:r r


INSTITUTE OF ENGINEERING LeVel BE FulI lllarlls 80

Examination Control Ilivision Programme BCT Pass nrlarks 32


207I Chaitra YearlPart tltt Time 3 hrs.

Subject: - Theory of Computation (CT502)


/ Candidates are required to $ve their answers in their own words as far as practicable.
{ AttemptAll questions.
t 'fh"ip*es in the margin indicate Full Marks. 1

/ Assume sitable data if necessary.


t

l. Define countably infinite and uncountable sets with example. Use principle of mathernatical
induction to prove (5'-l) is divisiblp by 4 for all integers n > 0. 13+41

2. Design a Deterministic Finite Automata (DFA) for the regular expression (a(ab)*b)*. Verify
yourdesign bytakingone accepted and onerejected strings. 15+21
3. State pumping lernma for regular language. Use this lemma to prove language,
L = {uo' : n } 0} is not regular t2+51
4. What are the differences between a DFA ahd a NFA? Convert the foltowing NFA in 1o its

ti

5. Constnrct CFG for language, L(G) :


(a'bn : m,n ) 0,h ) n) . Use this grammar to gfierate
sting "aaab". And also draw the parse tree. [4+l+U
6. Convert following CFG to CNF t5I
G = (V, E, & S), where
V= {S, A,8,4 b}
E= {a, b}
R= {S -}aAb I Ba I A,A + SSI e, B + e}
7, Define the term ambiguity and inherent ambiguity in parse tree. For a CFG given by G = (V,
E, & S) with V:
{S}, E: {a} and production rules R is defined as: l4l
S+SS,
S+a.
Obtain the language L(G) generated by this grammar.

l
t

a
:

8. Design a PDA that accepts language, L - {a'b3o : n > l}. Test your design for string "abbb".[S+l]

9. Write the differences between CFG and unrestricted grammar with example- Design a Turing
l

machine that reads binary string and doubles the number represented by that string.A binary
number is doubled if a'0' is added on the right emd of the number. [3+5J l

10. Define head shifting and symbol writing Turing Machines. Desigr a Turing Machine (tM) i

which computas following funstion f(w) = unrf, where wR is the reverss of string and I

w e {0,1}*. If your input sting is #0!#then TM should give the output string as #0110#. t3+0I
I

Il.Define class-P and class-NP problems with example. How.,do they relate to NP-complete
problems? ' I I5I I

12. What is an-"Algorithm" according to Church-Turing Thesis? Why is it called thesis and not a
theonem? Prove that if a language 'L' and its complement 'f'
botlr are recursively I

enumerable, then L is recursive. 12+l+61


i
l-
i

*:i,l I
I
I

I
i

6 +u dRvcLdc
(, 4L

I h#
Ku

8r) _+L
<*u
-+U \w rLq -)
'v
s
r<
S ,

5. l<h g Ld''- L' +J) ^l


- -t
55 K -D +tl 5Q''-') +e^)
E Ltr
K--t +v +()
.+-
)
43 TRIBI{UVAN IJNIVERSITY Exam. lllt,trl:rr
INSTITUTE OF ENGINEERING Level BE Full Mrrle irf,
r/'{--
Examination Control Division Programme BCT PassMarks 32
; -..
2070 Chaitrt Year / Part illl Time 3 hrs.

Subject: - Theory of Computation (CT502)


{ Candidates are required to give their answers in their own words as far as practicable.
r' Attempt All questions.
{ Thefigures in the margin indicote Full Marks.
/ Assume suttable data ifnecessary.

1. Justifu that "The complement of diagonal set is different from each row sets." with the
help of diagonalization principle. Show that if 3n+2 is odd then n is odd by using proof by
contradiction technique [3+4]
2. Design a DFA that accepts the language L : {x r {1,1}*: x has an even number of 0's and
an even number bf I's). Verify your design for at least two strings that are accepted by
this DFA and2 strings that are rejected. [5+2]
3. Show that for any Regular expression R, there is a NFA that accepts the same language
represented by R. Construct a e-NFA for regular expression bb (a U b)*ab [3+3]
4. Use pumping lemma to prove that L = 1an b2n : n > 1) is not regular. t4I
5. Consider the regular grammar G : ( V, E, R, S ) where l4l
V : {S,A,B,a,b},E = {a,b}
R={S+abA/BlbaB/e
A-+bS/a
B+aS
)
Construct a finite automaton M such that L (M): L (G)
6. Write context free grammars (CFG) for the languages Ll={4*bncn:m}l,n)l} and
1l={anbnc*:m}l,n21}. Do you think that L=(L1nL2)is also context free? If not
prove that the language thus obtained is not context free by using pumping lemma for
context free language. [4+6]
7. Convert following CFG into CNF with explanation of each step. G = (V,X,R,S), where t6l
V = {S, X, Y, 2,4b, cl,
X={4b,c}
p = {S-+XYZ|XY|aZ, X+abxl e, Y+bYlcZlab,Z->aXZ\
8. Design a PDA that accepts all the palindromes defined over {a, b}*. Your design should
accept shings like e, a,b, aba, bab, abba, babab etc. tsI
9. Define the term configuration of Turing Machine. Design a Turing machine which
of all palindromes over alphabets {0,1}
accepts the set [2+s]
10. I#TrrringMachine a complete computer, support your answer in reference to different
roles of Ttring machines? Justifu that unrestricted grammar can generate the language
L:{anbncr:n>l} [3+3I
11. Define Multiple tapes Turing machine. With reference to language they accept comparc
Multiple tapes Turing machine with single tape Turing machine. t4t
12. "Turing machines is believed to be the ultimate calculating mechanism", elaborate with
the help of Chtrch-Turing thesis. How halting problems suffer the computational
I procedures? Explain with suitable example. [5-r-4]

ltalE'
13. with to Polynomial Time Reducibility, explain NP hard and NP' Complete
t5l
tf*d.

t
44 TRIBHUVAN UNIVERSITY Exam Regul:u'
INSTITUTE OF ENGINEERING Level BE Full Marks 80

Examination Control Division Programme BCT Pass Marks 32

2068 Chaitra Year / Part iln Time 3 hrs.

Subjeet: - Theory of Computation (cT s02)


{ Candidates are required to give their answers in their own words as far as practicable.
{ Attempt All questions.
{ Thefigures in the margin indicate Full Mgr-ks..
{ Assume suitable data if necessary. .

1. What are the differences between- reflexive relation and reflexive closure? Use
*u11re6alical induction to show that2" < n! for any positive integer n > 4. 12+sl
2. Design DFA that accepts the language L: { We {0, 1}*: W is the multiple of five.}
Check your design for 1010. 171

3. Convert the following NDFA into equivalent DFA. t7l

4. Show that L= {*" > i} is not regular by using Pumping Lemma for regular
ban : n
cases.
language. Test all possible L7l
5. What is CFG? Design CFG for the language L(G) : 1V/WR: We {0, I }s}. [2+5]
6. Convert following CFG into CNF. G = (V, I, R, S), where Ul
V: {S, A, B, C, a" b, c},
X: {u, b, c},
R: {S+ABAlabAlBC, A+aAle, B-+baBlc, C-+aC}.
7. Design a Nondeterministic PDA to accept the language L(G) : {W e{0, 1}*: W has equal
number of 0's and l's). Check your design for 001110. UI
8. Design a turning machine that scans to left to find at least two a's. Machine should print
"yes" if at least two a's are present otherwise it must print "no" and then halts. Hence test
. your design for A#,b#ab#ba{ to A#y9g#ab#ba#. Where A and # represent left end and
blank symbols respectively with I: { A, #, a, b}. t9l
9. Explain about Unrestricted Grammar. Design a Turing Machine that accepts the language
1 = {anbn:n>0}. Show all configuration of TM for aabb. L2+61
10. Define universal turning machine and explain its encudirrg-Technique in detail with
suitable example. List undecidable problems about turning machine and grammar. [5+4]
11. Explain class-P and class-NP, with examples. t5]
*{r*
44 TRIBHUVAN UNIVERSITY Exam. Reeular / Back
INSTITUTE OF ENGINEERING Level BE Full Marks 80

Examination Control Division Programme BCT PassMarks 32


2068 Baishakh Year / Part I[lr Time 3 hrs

Subject: - Theory of Computation


,/ Candidates are required to give their answers in their own words as far as practicable.
'/ Attempt All questions.
'/ Thefigures in the margin indicate Full Marks.
./ Assume suitable data if necessary.

1. Let N be a set of natural numbers and R be any relation defined as R: {(a, b): a < b}.
Now test whether R is an equivalence relation or not. Prove that the function
(x) : x5 + 5x3 + 16x + 5 cannqt have more than one real root by using proof by
contradiction technique. [3+4]
2. How finite automata are useful in various frelds? Design a DFA that accepts the language
given bV (M): {we{0, 1}*: w does not contain four consecutive 0's}. Hence test your
design for 01010001. [1+s]
- 3. Minimize the following DFA (Draw initial diagram first). Specify performed operations
in each step. t5l
6/X 0 1

)Qo 9r Qz
*qr Qr 0r
*qt Qt Qz
*qr Qs Qz
*qa Qa Qz
*qs Qa Qz
Or 0s Qe

Qt Qs Qe

4. 1:
Check whether {an!: n > 0} is regular or not by using Pumping Lemma for regular
language. . t5l
5. State closure properties of regular language and explain diagrams. t5l
6. What is ambigious grammar? Write Context Free Grammar for the language given by
L: {we{(,)}*}: each string in w has balanced parentheses}. Use same to derive leftmost
and rightmost derivations for O) 0. Hence also draw parse tree. [1+2+4+1]
7. What are the importance of CNF? Convert following CFG into CNF with explanation of
rr+61
;l i:3R, s), where
V:tS,A,B,a,b)
r: {a' b}
P: {S+bN B,alAaA,
A->S/e,
B+aBlab)
{l

I
8. Design a Non deterministic PDA for the language given by L(M) : {anbn : n > 0}. Henee
explain how it processes strings like aabb? l4+2) -
9. What is Turing-decidable language? Design a Turing machine that recognizes the
language given by L : #aabbcc.
{anbnc' : n > 0}. Hence test your design for I1+5+2] -
10. List three criteria that should be satisfied by a Turing machine. How unrestricted
grammar differ from context free grammar? Design a Turing machine that recognizes the
strings of matchedparenthesis 12+2+51
11. State and explain halting problem with suitable example. Why Church's Turing thesis can
not be a theorem? List unsolvable problems aboutgrammar? 15+2+2) {
12. State computational.complexity theory. Explain class NP with suitable example. [1+4]
**rk

il

EI

EI

You might also like