rr310504 theory of computation

10
Code No: RR310504 Set No. 1 III B.Tech I Semester Supplimentary Examinations, February 2008 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. q 0 is the initial state and q 3 is the final state. [16] q/Σ 0 1 q 0 q 1 q 2 q 1 q 1 q 1 q 3 q 2 φ φ q 3 q 0 q 3 q 3 2. (a) Compare three Finite automata critically. (b) Construct DFA equivalent to the following Finite automation. Figure 2 [8+8] Figure 2 3. (a) Construct a regular expression representing the following sets The set of all strings over {a, b} in which there are atleast two occurrences of b between any two occurrences of a. (b) Describe whether L = {a 2n |n 1} is regular. State and explain the theorem used. [8+8] 4. (a) Obtain the regular grammar to accept the strings containing even number of zeroes. (b) Give the CFG to generating the following sets The set of palindromes over alphabet {a, b} [8+8] 5. Construct a context free grammar which accepts N(A) where A is ({q 0 , q 1 , q 2 }, {a, b, c}, {a, b, z 0 }, δ , q 0 , z 0 , q 2 ) where δ is given by δ (q 0 , a, z 0 )=(q 0 , az 0 ) δ (q 0 , b, z 0 )=(q 0 , bz 0 ) 1 of 2

Upload: srinivasa-rao-ganta

Post on 12-Nov-2014

348 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Rr310504 Theory of Computation

Code No: RR310504 Set No. 1

III B.Tech I Semester Supplimentary Examinations, February 2008THEORY OF COMPUTATION

( Common to Computer Science & Engineering and Computer Science &Systems Engineering)

Time: 3 hours Max Marks: 80Answer any FIVE Questions

All Questions carry equal marks⋆ ⋆ ⋆ ⋆ ⋆

1. For the following state transition table draw the state transition diagram. Find itsequivalent machine. For the string abbaaab test whether both give same result ornot. 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

2. (a) Compare three Finite automata critically.

(b) Construct DFA equivalent to the following Finite automation. Figure 2[8+8]

Figure 2

3. (a) Construct a regular expression representing the following sets The set of allstrings over {a, b} in which there are atleast two occurrences of b between anytwo occurrences of a.

(b) Describe whether L = {a2n|n ≥ 1} is regular. State and explain the theoremused. [8+8]

4. (a) Obtain the regular grammar to accept the strings containing even number ofzeroes.

(b) Give the CFG to generating the following setsThe set of palindromes over alphabet {a, b} [8+8]

5. Construct a context free grammar which accepts N(A) where A is({q0, q1, q2}, {a, b, c}, {a, b, z0}, δ , q0, z0, q2)where δ is given byδ (q0, a, z0) = (q0, az0)δ (q0, b, z0) = (q0, bz0)

1 of 2

Page 2: Rr310504 Theory of Computation

Code No: RR310504 Set No. 1

δ (q0, a, a) = (q0, aa)δ (q0, b, a) = (q0, ba)δ (q0, a, b) = (q0, ab)δ (q0, b, b) = (q0, bb)δ (q0, c, z0) = (q1, z0)δ (q0, c, a) = (q1, a)δ (q0, c, b) = (q1, b)δ (q1, a, a) = (q1, ∈)δ (q1, b, b) = (q1, ∈)δ (q1,∈ , z0) = (q2, z0) [16]

6. (a) Give formal definition of Turing Machine and explain the concept behindsaying “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 inUnary. [4+12]

7. (a) Discuss different languages and their corresponding machines.

(b) Write the design procedure of shift reduce parser by taking a suitable example.[8+8]

8. Write short notes on any three of the following.

(a) NP hard problems

(b) Reducability

(c) PCP

(d) UTM. [16]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2

Page 3: Rr310504 Theory of Computation

Code No: RR310504 Set No. 2

III B.Tech I Semester Supplimentary Examinations, February 2008THEORY OF COMPUTATION

( Common to Computer Science & Engineering and Computer Science &Systems Engineering)

Time: 3 hours Max Marks: 80Answer any FIVE Questions

All Questions carry equal marks⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Differentiate NFA and DFA with respected to transition and acceptance.

(b) Draw DFA which accepts even number of a‘s over the alphabet {a, b}

(c) Construct DFA equivalent to the following Finite state machine. Figure 1[2+6+8]

Figure 1

2. (a) Explain the procedure to convert NFA- ∈ to ordinary NFA, and apply thesame for the following figure 2a.

Figure 2a

(b) Design Moore and Mealy machines which converts a ternary number intoResidue Modulo 5. [8+8]

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 3 [8+8]

1 of 3

Page 4: Rr310504 Theory of Computation

Code No: RR310504 Set No. 2

Figure 3

4. (a) Construct a regular grammar corresponding to the state Figure 4a.

Figure 4a

(b) Show a derivation tree for the string aabbbb with the grammar S → AB/ ∈A → aB, b → Sb [8+8]

5. (a) Convert the following to GNFE → E + T/TT → T * F/FF → (E)/a

(b) Construct PDA generating all odd palindromes over string {a, b, c}. [8+8]

6. (a) Give formal definition of Turing Machine and explain the concept behindsaying “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 inUnary. [4+12]

7. Write short notes on:

(a) DCFL and DPDA

(b) LR(k) grammar

(c) C.S. languages. [6+6+4]

8. (a) Is concept of universal gates like Nor and Nand and the universal Turingmachine same. Explain the UTM in detail.

(b) What is modified version PCP? Show or explain that if the PCP is decidablethen modified PCP is also decidable. [8+8]

2 of 3

Page 5: Rr310504 Theory of Computation

Code No: RR310504 Set No. 2

⋆ ⋆ ⋆ ⋆ ⋆

3 of 3

Page 6: Rr310504 Theory of Computation

Code No: RR310504 Set No. 3

III B.Tech I Semester Supplimentary Examinations, February 2008THEORY OF COMPUTATION

( Common to Computer Science & Engineering and Computer Science &Systems Engineering)

Time: 3 hours Max Marks: 80Answer any FIVE Questions

All Questions carry equal marks⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Differentiate NFA and DFA with respected to transition and acceptance.

(b) Draw DFA which accepts even number of a‘s over the alphabet {a, b}

(c) Construct DFA equivalent to the following Finite state machine. Figure 1[2+6+8]

Figure 1

2. (a) Construct the Moore machine for Figure 2a Melay machine.

Figure 2a

(b) Minimize the Finite automation Figure 2b below and show both given and thereduced one are equivalent. [6+10]

1 of 3

Page 7: Rr310504 Theory of Computation

Code No: RR310504 Set No. 3

Figure 2b

3. (a) Construction a DFA for the regular expression r = (a+b)* a bb and optimizethe states.

(b) Show that L = {ap/p is prime} is not regular. [8+8]

4. (a) Construct left linear and right linear grammar for the regular expression.0*(1(0+1))*

(b) Give the CFG to generating the following setsThe set of all strings over alphabet {a, b} with exactly twice as many a’s asb’s. [8+8]

5. Construct a context free grammar which accepts N(A) where A is({q0, q1, q2}, {a, b, c}, {a, b, z0}, δ , q0, z0, q2)where δ is given byδ (q0, a, z0) = (q0, az0)δ (q0, b, z0) = (q0, bz0)δ (q0, a, a) = (q0, aa)δ (q0, b, a) = (q0, ba)δ (q0, a, b) = (q0, ab)δ (q0, b, b) = (q0, bb)δ (q0, c, z0) = (q1, z0)δ (q0, c, a) = (q1, a)δ (q0, c, b) = (q1, b)δ (q1, a, a) = (q1, ∈)δ (q1, b, b) = (q1, ∈)δ (q1,∈ , z0) = (q2, z0) [16]

6. (a) What is delta of a Turing Machine, explain functions involved in a move ofTuring Machines in detail.

(b) Design Turing Machine to accept even palindromes derived from the input {a,b}. Give its Transition table and diagram also. [6+10]

7. (a) Discuss the Chomsky Hierarchy of languages.

2 of 3

Page 8: Rr310504 Theory of Computation

Code No: RR310504 Set No. 3

(b) For the grammar shown below construct the sets of LR(0) items.S ′ → S $S → a S b | a b

[6+10]

8. (a) What is decidability? Explain any two undecidable problems.

(b) Show that the following post correspondence problem has a solution and givethe solution. [8+8]

List A List Bi wi xi

1 11 1112 100 0013 111 11

⋆ ⋆ ⋆ ⋆ ⋆

3 of 3

Page 9: Rr310504 Theory of Computation

Code No: RR310504 Set No. 4

III B.Tech I Semester Supplimentary Examinations, February 2008THEORY OF COMPUTATION

( Common to Computer Science & Engineering and Computer Science &Systems Engineering)

Time: 3 hours Max Marks: 80Answer 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) Explain the procedure to convert NFA- ∈ to ordinary NFA, and apply thesame for the following figure 2a.

Figure 2a

(b) Design Moore and Mealy machines which converts a ternary number intoResidue Modulo 5. [8+8]

3. (a) Construction a DFA for the regular expression r = (a+b)* a bb and optimizethe states.

(b) Show that L = {ap/p is prime} is not regular. [8+8]

4. (a) Construct a regular grammar G generating the regular set represented bya*b(a+b)*.

(b) Give the CFG to generating the following setsThe set of all strings of balanced parenthesis [8+8]

1 of 2

Page 10: Rr310504 Theory of Computation

Code No: RR310504 Set No. 4

5. (a) Design a PDA to accept the following CFGS → AA/aA → SA/b.

(b) Explain properties of C.F. languages. [8+8]

6. (a) Give formal definition of Turing Machine and explain the concept behindsaying “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 inUnary. [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 → a S b | a b[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]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2