1
III B.Tech I Semester Supplementary Examinations, February 2007
THEORY OF COMPUTATION
( Common to Computer Science & Engineering and Computer Science &
Systems Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Prove or explain with the help of algorithm that “Every NFA will have an
equivalent DFA.
(b) Find DFA equal to NFA described by following state transition table, initial
state= p, F={q, s}
Initial State = P, F = {q, s} [8+8]
0 1
p q,s q
q r q,r
r s p
s - p
2. For the NFA-E given check whether the string aannanan is accepted or not, If ac-
cepted write the transition path. Find equivalent NFA without epsilon transitions,
explain the procedure used and check the string given on your new NFA. Figure 1
[16]
Figure 1:
4. (a) Construct regular grammar G generating the regular set a∗ b(a + b)∗ .
(b) Define CFG and give examples. What is CFL generated by the grammar
S → abB, A → aaBb, B → bbAa, A → E [8+8]
1 of 2
Code No: RR310504 Set No. 1
Figure 2:
6. Construct Turing machine to accept following language and give its state transition
table and diagram. Check the machine by tracing a suitable instance.
L = { an bm : n≥ 1 and n 6= m}. [16]
⋆⋆⋆⋆⋆
2 of 2
Code No: RR310504 Set No. 2
III B.Tech I Semester Supplementary Examinations, February 2007
THEORY OF COMPUTATION
( Common to Computer Science & Engineering and Computer Science &
Systems Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. For the following state transition table draw the state transition diagram. Find its
equivalent machine. For the string abbaaab test whether both give same result or
not. q0 is the initial state and q3 is the final state. [16]
q/Σ 0 1
q0 q1 q2
q1 q1 q1 q3
q2 φ φ
q3 q0 q3 q3
3. (a) Construct the NFA for the regular expression r = 0*1 ((0+1)0*1)* (∈+(0+1)
(00)*)+0(00)*
(b) Consider the FA and construct regular expressions that is accepted by it.
Figure 1 [8+8]
4. (a) Find the regular grammar for the following automata. Figure 2
(b) Given the grammar G as S → 0B/1A, A → 0/0S/1AA, B → 1/1S/0BB
Give the leftmost and rightmost and derivation trees to derive the string
00110101. [8+8]
5. (a) Convert the following GNF
S → aA/B/C/a
1 of 3
Code No: RR310504 Set No. 2
Figure 1:
Figure 2:
2 of 3
Code No: RR310504 Set No. 2
A → aB / ∈
B → aA
C → cCD
D → abd.
(b) Construct CFG generating the set of all strings over {a, b} consisting of equal
no of a’s and b’s. [8+8]
6. (a) Give formal definition of Turing Machine and explain the concept behind
saying “Turing Machine is more powerful than the digital computer”.
(b) Design Turing Machines for the following:
i. To compliment a given binary number.
ii. To compute f(x,y) = x+y for x and y positive integers represented in
Unary. [4+12]
(a) G2 is unrestricted
(b) G2 is context free
(c) G2 is regular. [6+6+4]
⋆⋆⋆⋆⋆
3 of 3
Code No: RR310504 Set No. 3
III B.Tech I Semester Supplementary Examinations, February 2007
THEORY OF COMPUTATION
( Common to Computer Science & Engineering and Computer Science &
Systems Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
Figure 1:
2. (a) Constance state Transition Table for the Moore machine given in Figure 2
below.
Figure 2:
1 of 3
Code No: RR310504 Set No. 3
Figure 3:
3. (a) Construct Finite automaton to accept the regular expression (0 + 1)∗ (00+11)
(0 + 1)∗ .
(b) Find the regular expression accepted by following deterministic Finite automa-
ton. Figure 4 [8+8]
Figure 4:
4. (a) Find the regular grammar for the following automata. Figure 5
(b) Given the grammar G as S → 0B/1A, A → 0/0S/1AA, B → 1/1S/0BB
Give the leftmost and rightmost and derivation trees to derive the string
00110101. [8+8]
2 of 3
Code No: RR310504 Set No. 3
Figure 5:
P
5. (a) Construct a PDA to accept the language L = { w/w (a, b)∗ , na (w) = 2nb
(w)}
(b) Enumerate the properties of CFL. Explain any two of them. [8+8]
6. Define Turing Machine formally, explain how Turing Machine can be used to com-
pute integer functions. Design the Turing Machine to compute following function,
show its transition diagram also f(x, y) = xy where x and y are positive integers
represented in unary. [16]
7. (a) Define the ‘Handler’. For the derivation aabb find the viable prefixes of the
grammar shown below.
S′ → S
S → aS b|ab
(b) When an item is said to be complete, find the sets of LR(0) items. [8+8]
⋆⋆⋆⋆⋆
3 of 3
Code No: RR310504 Set No. 4
III B.Tech I Semester Supplementary Examinations, February 2007
THEORY OF COMPUTATION
( Common to Computer Science & Engineering and Computer Science &
Systems Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. (a) Let R={(1, 2), (2, 2), (2, 3)} be a relation on the set {1, 2, 3}, Find R*.
(b) Develop a Deterministic Finite Automation accepting the language given over
the alphabet {0, 1}. L = {the set of all strings such that every block of five
consecutive contain at least two o’s}
(c) Give mathematical definition of NFA and state main differences between NFA
and DFA. [4+8+4]
Figure 1:
(b) Minimise the Finite automation Figure 2 below and show both the given and
the reduced one are equivalent. [6+10]
3. (a) Prove or disprove the following for the regular expressions r and s.
i. (rs+r)*r = r(sr + r)*
ii. (r* s*)* = (r+s)*
(b) Find the regular expression accepted by following automaton. Figure 3 [8+8]
1 of 3
Code No: RR310504 Set No. 4
Figure 2:
Figure 3:
2 of 3
Code No: RR310504 Set No. 4
(b) Describe the language generated by the grammar
S → aAB, A → bBb, B → A/∧
Give the rigorous definition for a derivation tree and give an example. [8+8]
6. Define Turing Machine formally, explain how Turing Machine can be used to com-
pute integer functions. Design the Turing Machine to compute following function,
show its transition diagram also f(x, y) = 2x + 3y where x and y are positive
integers represented in unary. [16]
8. Explain briefly
⋆⋆⋆⋆⋆
3 of 3