# Code No: RR310504

Set No. 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 accepted 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: 3. (a) Construct FA equivalence to the following regular expression r = 01[((10)∗ + 111)∗ +0]*1 (b) Construct the regular expression accepted by following ﬁnite automaton. Figure 2 [8+8] 4. (a) Construct regular grammar G generating the regular set a∗ b(a + b)∗ . (b) Deﬁne 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: 5. (a) Convert the following to GNF E → E + T/T T → T * F/F F → (E)/a (b) Construct PDA generating all odd palindromes over string {a, b, c}. [8+8]

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 = m}. [16] 7. (a) Discuss diﬀerent languages and their corresponding machines. (b) Write the design procedure of shift reduce parser by taking a suitable example. [8+8] 8. (a) Diﬀerentiate NP complete and NP hard problems. Explain NP complete and NP Hard problems with some examples. (b) What is undecidability? Explain PCP and modiﬁed PCP in detail. ⋆⋆⋆⋆⋆ [8+8]

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 ﬁnal state. [16] q/Σ 0 1 q0 q1 q2 q1 q1 q1 q3 q2 φ φ q3 q0 q3 q3 2. (a) Construct the Moore machine for given Melay machine. a b Output q0 q2 0 q1 q0 1 q2 q1 1 (b) Minimise the Finite automation given below and show both the given and the reduced one are equivalent. [6+10] 0 1 q0 q1 q2 q1 q3 q4 q2 q5 q6 q3 q3 q4 q4 q5 q6 q5 q3 q4 q6 q5 q6 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 A → aB / ∈ B → aA C → cCD D → abd.

Set No. 2

(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 deﬁnition 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] 7. (a) Discuss the Chomsky Hierarchy of languages. (b) For the grammar shown below construct the sets of LR(0) items. S′ → S \$ S → aS b|ab [6+10]

8. Let G1 and G2 be grammars with G1 is regular. Is the problem L(G1 ) = L(G2 ) decidable when (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 ⋆⋆⋆⋆⋆ 1. For the NFA given by following state transition diagram Figure 1 (a) check whether the string abbabba is accepted or not (b) Give at least two transition paths. (c) Find equivalent DFA. Check for same result of bit (a). [5+3+8]

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: (b) Construct Moore machine for the Melay machine in Figure 3 (c) Construct a minimum automation equivalent to a given automation. [4+6+6] α q0 q1 q2 q3 q4 A q1 q2 q3 q4 q0 b q2 q3 q4 q4 q0 Output 0 0 1 0 0

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 automaton. 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: 5. (a) Construct a PDA to accept the language L = { w/w (w)} (a, b)∗ , na (w) = 2nb [8+8]

(b) Enumerate the properties of CFL. Explain any two of them.

6. Deﬁne Turing Machine formally, explain how Turing Machine can be used to compute 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) Deﬁne the ‘Handler’. For the derivation aabb ﬁnd the viable preﬁxes of the grammar shown below. S′ → S S → aS b|ab (b) When an item is said to be complete, ﬁnd the sets of LR(0) items. 8. Discuss any three of the following brieﬂy. (a) Decidability of problems (b) Undecidability of post correspondence problem. (c) P and NP problems. (d) RICE’s theorem. ⋆⋆⋆⋆⋆ [16] [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 ﬁve consecutive contain at least two o’s} (c) Give mathematical deﬁnition of NFA and state main diﬀerences between NFA and DFA. [4+8+4] 2. (a) Construct the Moore machine for Figure 1 Melay machine.

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] 4. (a) Construct ﬁnite automata recognizing the following grammar. A0 → aA1 A1 → bA1 /bAo / a

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 deﬁnition for a derivation tree and give an example. [8+8] 5. (a) Design a PDA to accept the following CFG S → AA/a A → SA/b. (b) Explain properties of C.F. languages. [8+8]

6. Deﬁne Turing Machine formally, explain how Turing Machine can be used to compute 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] 7. Write short notes on: (a) DCFL and DPDA (b) LR(k) grammar (c) C.S. languages. 8. Explain brieﬂy (a) NP hard and NP complete problems. (b) Modiﬁed post correspondence problem. (c) UTM. ⋆⋆⋆⋆⋆ [16] [6+6+4]

3 of 3