T O C Combined
T O C Combined
org
B.E. (Computer Science Engineering) Fourth Semester (C.B.S.)
Theoretical Foundation of Computer Science
P. Pages : 3 NRJ/KW/17/4436
Time : Three Hours *0204*
Max. Marks : 80
_____________________________________________________________________
Notes : 1. All questions carry marks as indicated.
2. Solve Question 1 OR Questions No. 2.
3. Solve Question 3 OR Questions No. 4.
rg
4. Solve Question 5 OR Questions No. 6.
5. Solve Question 7 OR Questions No. 8.
6. Solve Question 9 OR Questions No. 10.
7. Solve Question 11 OR Questions No. 12.
s.O
8. Due credit will be given to neatness and adequate dimensions.
9. Assume suitable data whenever necessary.
10. Illustrate your answers whenever necessary with the help of neat sketches.
t
b) Define the following terms with suitable example. 8
i) Prefix
ii) Suffix
iii) Substring
iv) Subsequences
en
ud
c) Explain closure of a Relation, 2
find R * for
OR
2. a) Explain Chomsky Hierarchy in detail. 6
w (a / b)*
L w
n (a ) W M 0 D 3 n ( b ) W M 0 D 3
also write application of Finite Automata.
Na
d d
q0 q1 q2 q3
START
OR
NRJ/KW/17/4436 1 P.T.O
4. a) Convert the given Mealy Machine into equivalent Moore Machine. 7
0|z2
0|z1
q1 q2
START
1|z1 0|z1
1|z1
q3
rg
b) Design a Moore and Mealy machine over a, b such that it will generate output 6
EVEN if the number of a's are Even & generate output ODD if number of a's are odd.
s.O
0
START
S
0 1
t
1
b)
B
en
0
A 1
S 01A | 10
A 10 A | 10
b) Convert the given grammar into GNF without renaming the grammar. 6
ur
S AB
A BS | b
B SA | a
gp
L WW R
W (a / b)*
W R is Reverse of W
Na
NRJ/KW/17/4436 2
8. a) Design a PDA for 7
W (a / b)*
L W
n a (W) n b (W)
Where n a ( W) Number of a's in W
& n b ( W) Number of b's in W
rg
(q 0 , a, x) (q 0 , xx)
(q0 , b, x) (q1,)
(q1, b, x) (q1,)
s.O
(q1,, z0 ) (q1,)
9. a) (n 1) 7
Design a Turing Machine to perform where n is an uniary number.
2
t
b) Explain different types of Turing Machine. 6
7
INPUT : # W # and generates
ud
OUTPUT : # W # W
where W a , b .
OR
gp
i wi xi
1 0 000
2 01000 01
3 01 1
*************
NRJ/KW/17/4436 3 P.T.O
NRJ/KW/17/4436
Na
gp
ur
St
4
ud
en
ts.O
rg
www.nagpurstudents.org
rg
4. Solve Question 5 OR Questions No. 6.
5. Solve Question 7 OR Questions No. 8.
6. Solve Question 9 OR Questions No. 10.
7. Solve Question 11 OR Questions No. 12.
s.O
8. Due credit will be given to neatness and adequate dimensions.
9. Assume suitable data whenever necessary.
10. Illustrate your answers whenever necessary with the help of neat sketches.
t
b) Define the following terms with suitable example. 8
i) Prefix
ii) Suffix
iii) Substring
iv) Subsequences
en
ud
c) Explain closure of a Relation, 2
find R * for
OR
2. a) Explain Chomsky Hierarchy in detail. 6
w (a / b)*
L w
n (a ) W M 0 D 3 n ( b ) W M 0 D 3
also write application of Finite Automata.
Na
d d
q0 q1 q2 q3
START
OR
NRJ/KW/17/4436 1 P.T.O
4. a) Convert the given Mealy Machine into equivalent Moore Machine. 7
0|z2
0|z1
q1 q2
START
1|z1 0|z1
1|z1
q3
rg
b) Design a Moore and Mealy machine over a, b such that it will generate output 6
EVEN if the number of a's are Even & generate output ODD if number of a's are odd.
s.O
0
START
S
0 1
t
1
b)
B
en
0
A 1
S 01A | 10
A 10 A | 10
b) Convert the given grammar into GNF without renaming the grammar. 6
ur
S AB
A BS | b
B SA | a
gp
L WW R
W (a / b)*
W R is Reverse of W
Na
NRJ/KW/17/4436 2
8. a) Design a PDA for 7
W (a / b)*
L W
n a (W) n b (W)
Where n a ( W) Number of a's in W
& n b ( W) Number of b's in W
rg
(q 0 , a, x) (q 0 , xx)
(q0 , b, x) (q1,)
(q1, b, x) (q1,)
s.O
(q1,, z0 ) (q1,)
9. a) (n 1) 7
Design a Turing Machine to perform where n is an uniary number.
2
t
b) Explain different types of Turing Machine. 6
7
INPUT : # W # and generates
ud
OUTPUT : # W # W
where W a , b .
OR
gp
i wi xi
1 0 000
2 01000 01
3 01 1
*************
NRJ/KW/17/4436 3 P.T.O
NRJ/KW/17/4436
Na
gp
ur
St
4
ud
en
ts.O
rg
www.nagpurstudents.org
P. Pages : 3 NJR/KS/18/4436
Time : Three Hours *0601* Max. Marks : 80
_____________________________________________________________________
Notes : 1. All questions carry marks as indicated.
2. Solve Question 1 OR Questions No. 2.
rg
3. Solve Question 3 OR Questions No. 4.
4. Solve Question 5 OR Questions No. 6.
5. Solve Question 7 OR Questions No. 8.
6. Solve Question 9 OR Questions No. 10.
s.O
7. Solve Question 11 OR Questions No. 12.
8. Assume suitable data whenever necessary.
b)
c) nt
What is string, prefix, proper prefix & proper suffix with examples.
3
de
OR
2. a) Consider a Relation R = {(a, b), (a, a), (b, b), (c, c), (d, d), (b, a)} on set A = {a, b, c, d}. Is 6
tu
i 1
6
ur
3. a) Construct DFA which can accept the string those can have odd number of 0's and any 7
number of 1's.
b) Design a Moore machine for binary input sequence, if it ends in 101, output is 'A'. if it 6
gp
OR
a E a
q0 q1 q2
NJR/KS/18/4436 1 P.T.O
b) Minimize the following Automata. 7
b a b
q0 b q3 a q4 q5
b
a a b a
a a
b
q1 q2 q7 a q6
b
rg
b
s.O
0 1 0
0 1
q0 q1 q2
nt
i) L a n bmck | n m or m k .
ii) L a n bm | 2n m 3n .
de
iii) L a n bmcmd n \ m, n 1 .
iv) L a n b2n | n 1 .
tu
OR
6. a) Remove all unit productions, all useless production and all E-productions from the 7
S
A aaA |
B bB | bbC
CB
gp
7. a)
Construct PDA for L a 2n bn | n 0 . 6
b)
Show that L a n b j | n j2 is not a context free language. 3
NJR/KS/18/4436 2
OR
b) Explain the modal of PDA and its acceptance by stack and acceptance by final state. 6
rg
9. a) Explain the types of Turing machine. 5
s.O
=0 if a < b
OR
nt
b) Construct the Turing machine for 9
L a n bn a n bn | n 0 .
de
11. a) Write a short note on: 6
i) Post correspondence problem.
ii) Primitive Recursive function.
tu
OR
S
*********
Na
NJR/KS/18/4436 3 P.T.O
NJR/KS/18/4436
Na
gp
ur
S
4
tu
de
nt
s.O
rg
www.nagpurstudents.org
rg
4. Solve Question 5 OR Questions No. 6.
5. Solve Question 7 OR Questions No. 8.
6. Solve Question 9 OR Questions No. 10.
7. Solve Question 11 OR Questions No. 12.
s.O
8. Assume suitable data whenever necessary.
1. a) Explain closure of a Relation. Find R* for R = (1,1) (1, 2) (2,1) (2,3) (3, 2) . 3
i)
nt
1.2.3 + 2.3.4 + .... + n(n + 1) (n + 2) =
n(n + 1) (n + 2) (n + 3)
4
de
n(n + 1) (2n + 1)
ii) 12 + 22 + 32 + .... + n 2 =
6
OR
2. a) Describe the concept of Pigeon – hole principle with example. 5
S
i) Transitive Closure.
v) Substring.
Na
vi) Subsequence
b) Construct a Mealy machine to find 2’s complement of a given binary number. Assume 8
that given binary number is presented from LSB to MSB. Also, convert the resultant
Mealy machine into its equivalent Moore machine.
OR
NIR/KW/18/3381 1 P.T.O
4. a) Convert the following NFA into its equivalent DFA. 6
Q/ 0 1
→p p p, q
*q r r
r - s
*s s s
rg
b) Construct a minimum state automaton equivalent to a given automaton M whose 8
transition table is given by,
State / a b
s.O
→ q0 q0 q3
q1 q2 q5
q2 q3 q4
q3 q0 q5
q4 q0 q6
nt
q5 q1 q4
q6 q1 q3
de
5. a) Reduce the following grammar. 5
S → aA / aBB
A → aaA/
B → bB / bbC
C→B
tu
S → a / Sa / bSS / SbS
OR
gp
6. a) Convert the following Right linear grammar into left linear grammar. 7
S → 01A /10
A → 10A / 10
Na
b a
q0 b q1 q2
a
b
NIR/KW/18/3381 2
7. a) Convert the CFG into PDA. 7
E → aAB / d
A → BA / a
B → Ead / c
rg
8. a) Convert the given PDA to CFG. 7
(q 0 , a, z 0 ) → (q 0 , x z 0 )
(q 0 , a, x) → (q 0 , x x)
(q 0 , b, x) → (q1 ,)
s.O
(q1 , b, x) → (q1 ,)
(q1 ,, z 0 ) → (q1 ,)
nt
3
L = a i i 1
is not regular.
de
9. a) Design a Turing machine for the language 6
n m n
L = a b c n, m 1
tu
11. a) Explain post correspondence problem. Consider the post correspondence system described 7
by the following lists.
A = 10, 01, 0,100,1
B = 101,100,10, 0, 010
gp
OR
12. Write a short note on : 13
i) Halting problem of Turing Machine
ii) Linear bounded Automata
iii) Primitive Recursive Function.
**************
NIR/KW/18/3381 3 P.T.O
NIR/KW/18/3381
Na
gp
ur
S
4
tu
de
nt
s.O
rg
www.nagpurstudents.org
g
5. Solve Question 7 OR Questions No. 8.
6. Solve Question 9 OR Questions No. 10.
.Or
7. Solve Question 11 OR Questions No. 12.
8. Due credit will be given to neatness and adequate dimensions.
9. Assume suitable data whenever necessary.
10. Illustrate your answers whenever necessary with the help of neat sketches.
ts
1. a) With the help of Mathematical Induction, prove that 8
n (n 1) (2n 1)
1) 12 2 2 32 ........ n 2
6
2) 1.1! 2.2! 3.3! ........ n.n ! (n 1)!1
en
b) Explain Pigeonhole principle with example. Also explain Generalised pigeonhole principle. 5
OR
ud
2. a) Explain in detail Chomsky Hierarchy of languages. 6
3. a) Design DFA over 0, 1 to accept strings containing even number of 0's and 1's. 6
r
Consider NFA .
pu
b) 8
Q
Z
a b c
p
Na
-- p q r
q p q r
r q r p
State 0 1
q0 q1 q5
q1 q6 q2
q2 q0 q2
g
q3 q2 q6
.Or
q4 q7 q5
q5 q2 q6
q6 q6 q4
q7 q6 q2
ts
5. Construct F.A. to accept strings over a , b containing atleast one aba and not 13
containing bbb. en OR
CB
A bAA / aS / a
B aBB / bS / b
pu
(q 0 , 0, X) (q1, X)
(q 0 ,, Z0 ) (q 0 ,)
(q1,1, X) (q1,)
(q1, 0, Z0 ) (q 0 , Z0 )
OR
NKT/KS/17/7296 2
8. a) Convert the CFG into PDA. 6
E aAB / d
A BA / a
B Ead / C
h WW R W a, b
9. a) Explain in detail, types of Turing Machines. 6
g
b) Design Turing Machine for 7
.Or
h a n bn cn n 1
OR
ts
b) Give the model of LBA and define it formally. 4
*************
pu
Na
NKT/KS/17/7296 3 P.T.O
NKT/KS/17/7296
Na
pu
rSt
4
ud
en
ts
.Or
g
www.nagpurstudents.org
b) Define : 3
i) Kleene closure ii) Positive closure
with an example.
3. a) Construct a DFA over = {0,1} for the "Language accepting 1100 or 1010 as a 7
substring''.
0/a
1
1/a1
q3
OR
4. a) Construct DFA equivalent to : 6
M = ({q0 ,q1,q 2}, a, b , ,q 0 q 2 )
Where is defined by its state table.
State Input
a b
→ q0 q0 , q1 q 2
q1 q 0 q1
q2 -- q0 , q1
NRT/KS/19/3381 1 P.T.O
b) Convert the NFA with -transition to NFA without -transition. 7
,c
P R
a,c c
,b
b
Q
5. a) What is Regular Grammar? Find left linear and right linear grammar for the following 8
regular expression.
i) (0+1)* 00 (0+1)* ii) 0* (1(0+1))*
OR
0 0
q0 q1
0 1
0
q3 q2
1 1
R : Reverse string.
b) Explain the modal of PDA and its acceptance by stack and acceptance by final state. 6
OR
NRT/KS/19/3381 2
9. a) Design a Turing machine for the language 8
L = WW | W ( 0 + 1) *
R
R : Reverse string.
OR
OR
***************
NRT/KS/19/3381 3 P.T.O
NRT/KS/19/3381 4
www.nagpurstudents.org
b) Define : 3
i) Kleene closure ii) Positive closure
with an example.
3. a) Construct a DFA over = {0,1} for the "Language accepting 1100 or 1010 as a 7
substring''.
0/a
1
1/a1
q3
OR
4. a) Construct DFA equivalent to : 6
M = ({q0 ,q1,q 2}, a, b , ,q 0 q 2 )
Where is defined by its state table.
State Input
a b
→ q0 q0 , q1 q 2
q1 q 0 q1
q2 -- q0 , q1
NRT/KS/19/3381 1 P.T.O
b) Convert the NFA with -transition to NFA without -transition. 7
,c
P R
a,c c
,b
b
Q
5. a) What is Regular Grammar? Find left linear and right linear grammar for the following 8
regular expression.
i) (0+1)* 00 (0+1)* ii) 0* (1(0+1))*
OR
0 0
q0 q1
0 1
0
q3 q2
1 1
R : Reverse string.
b) Explain the modal of PDA and its acceptance by stack and acceptance by final state. 6
OR
NRT/KS/19/3381 2
9. a) Design a Turing machine for the language 8
L = WW | W ( 0 + 1) *
R
R : Reverse string.
OR
OR
***************
NRT/KS/19/3381 3 P.T.O
NRT/KS/19/3381 4
www.nagpurstudents.org