toc q
toc q
fr
33 TRIBHUVAN I.JNIVERSITY
INSTITUTE OF ENGINEERING
Examination Control Division lr"gr*ry
2075 Ashwin Part
Year /
t. a) Write a regular expression for the language in which strings start and end with
different symbol over alphabet I= {u,b}. t3]
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
,/ 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
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
!
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
.1
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'
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'
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
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
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. 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
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
*:i,l I
I
I
I
i
6 +u dRvcLdc
(, 4L
I h#
Ku
8r) _+L
<*u
-+U \w rLq -)
'v
s
r<
S ,
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
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
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
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