Theory of Computation (Classroom Practice Booklet Solutions)

Similar documents
MA/CSSE 474 Theory of Computation

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Theory of Computation

VTU QUESTION BANK. Unit 1. Introduction to Finite Automata. 1. Obtain DFAs to accept strings of a s and b s having exactly one a.

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Question Bank UNIT I

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

Properties of Context-Free Languages. Closure Properties Decision Properties

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Theory of Computation (IV) Yijia Chen Fudan University

INSTITUTE OF AERONAUTICAL ENGINEERING

Computational Models - Lecture 5 1

(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

NPDA, CFG equivalence

Ogden s Lemma for CFLs

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Fundamentele Informatica II

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Theory Bridge Exam Example Questions

1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.

CSE 105 THEORY OF COMPUTATION

Automata and Computability. Solutions to Exercises

Final exam study sheet for CS3719 Turing machines and decidability.

Automata and Computability. Solutions to Exercises

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

CSE 105 THEORY OF COMPUTATION

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

DM17. Beregnelighed. Jacob Aae Mikkelsen

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Formal Languages, Automata and Models of Computation

Deterministic PDA s. Deepak D Souza. 21 October Department of Computer Science and Automation Indian Institute of Science, Bangalore.

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

CS154 Final Examination

Foundations of Informatics: a Bridging Course

AC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Pumping Lemma for CFLs

Non-context-Free Languages. CS215, Lecture 5 c

CS481F01 Prelim 2 Solutions

Part I: Definitions and Properties

Section 1 (closed-book) Total points 30

Languages, regular languages, finite automata

Theory of Computation Turing Machine and Pushdown Automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions

CSE 105 THEORY OF COMPUTATION

CPSC 421: Tutorial #1

Author: Vivek Kulkarni ( )

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Properties of Context-Free Languages

Homework 8. a b b a b a b. two-way, read/write

CISC4090: Theory of Computation

Notes for Comp 497 (454) Week 10

Undecidable Problems and Reducibility

CSE 105 THEORY OF COMPUTATION

CS500 Homework #2 Solutions

FABER Formal Languages, Automata. Lecture 2. Mälardalen University

V Honors Theory of Computation

Automata Theory - Quiz II (Solutions)

Grade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages

Rumination on the Formal Definition of DPDA

An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).

Theory & Practice Book. Computer Science & IT. for. Public Sector Exams

Theory of Computation

CS 341 Homework 16 Languages that Are and Are Not Context-Free

Lecture 17: Language Recognition

CSE 355 Test 2, Fall 2016

Deterministic PDA s. Deepak D Souza. 08 Nov Department of Computer Science and Automation Indian Institute of Science, Bangalore.

Pushdown Automata (2015/11/23)

Sri vidya college of engineering and technology

UNIT-VIII COMPUTABILITY THEORY

Please give details of your answer. A direct answer without explanation is not counted.

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

6.8 The Post Correspondence Problem

Fundamentele Informatica 3 Antwoorden op geselecteerde opgaven uit Hoofdstuk 7 en Hoofdstuk 8

The View Over The Horizon

Equivalent Variations of Turing Machines

Computational Theory

Context-free Languages and Pushdown Automata

download instant at Assume that (w R ) R = w for all strings w Σ of length n or less.

Automata: a short introduction

Computational Models - Lecture 4

Automata Theory CS F-08 Context-Free Grammars

CS481F01 Solutions 6 PDAS

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

Solution Scoring: SD Reg exp.: a(a

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Computability Theory

Context-Free Languages (Pre Lecture)

Transcription:

Theory of Computation (Classroom Practice Booklet Solutions) 1. Finite Automata & Regular Sets 01. Ans: (a) & (c) Sol: (a) The reversal of a regular set is regular as the reversal of a regular expression is a regular expression. (c) The intersection of a regular set & a finite set is a finite set which is regular. n n (b) a b / n 1 is the intersection of a regular set and a CFL & is very much a CFL. So (b) is false. n n (d) a b / n 1 is the intersection of a regular set and a DCFL & is very much a DCFL. So (d) is false. The above NFA accepts all strings over {0, 1} where the third symbol from the right end is a 1. It has 2 3 or 8 states in the minimal DFA. So (d) is the answer. 03. Ans: (c) Sol: The string ba is both (i) & (ii) (a) is there in (ii) & not in (i) (b) a is in (ii) & not in (i) (c) b is in (i) & in (ii) 04. Ans: (b) Sol: (a) S (c) S 02. Ans: (d) A B A B Sol: Consider the DFA a, b a A B B B A B The DFA is also an NFA and has the same number of states. So (a), (b) & (c) can be ruled out. Consider the NFA B B b A B b a b aabbb can be derived AB AB a b a b a b ababab can be derived 0,1 0 0 1 1 1

: 2 : Theory of Computation (d) S A B a A B BB b b b abbb can be derived 05. Ans: (c) Sol: (a) (a +b a ) = (a+ b) (b) (a b + b a ) (a b ) = (a b ) = (a+b) (c) (a(b) +a ) will never yield a b by itself so it cannot be the same as (a) or (b). By elimination (c) is the odd man out. 06. Ans: (a) Sol: (d) can be ruled out ( +0) (101) (+0) contains ( + 0) ( + 0) contain 00 (c) 010 can not be generated (b) (0+10) ( + 1) contains (0+10) containing 00 By elimination (a) is the answer. 07. Ans: (a) Sol: (d) The minimal DFA is unique (c) (0+1) can be accepted by a 1 state minimal DFA (b) The empty set accepts 08. Ans: (a) Sol: A, D, B are not in the grammar. 09. Ans: (a) Sol: 1. As ( +R) = R, C -3 must be in the answer, This rules out choice (b) 2. =, so in D ( a+(b) ) = a + b. So D - 6 cannot be in the answer. This rules out choice (d) 3. =, So in D (a+(b) ) = a+(b), same as choice b. So D 4 must be in the answer. So by elimination (a) is the answer. 10. Ans: (a) Sol: (b) (0+1) 110 has (0+1) 110 has 01110 (c) 0 11 +1 1 has 1 1 has 111 (d) 0 11 00 has 11 has 111 By elimination the answer is (a) 11. Ans: (a) Sol: a(a) + a(a(a) ) + aaaaa a = aa + (even number of a s) a + aaa = a + aa + aa(a ) 12. Ans: (a) Sol: 0,1 0 0 H P M C 0

: 3 : CSIT Postal Coaching Solutions 0 1 H HP H HP HPM H HPM HPMC H HPMC HPMC H 1 1 1 0 H 0 HP 0 0 HPM HPMC 1 13. Ans: (a) Sol: a q 0 a q 2 b b b b a q 1 q 3 a 14. Ans: (b) Sol: (a) This choice contains a c which is a negative string. (c) This choice contains babb which is a negative string. (b) Only the 1 st symbol is a b & the rest of a s. So this is ok. 15. Ans: (b) Sol: (c) (a) L contain {} which is not a infinite language so (c) is false. L contains the finite sets so this is false. (b) L is closed under concatenation as L 1 L 2 will still be infinite. 16. Ans: (c) Sol: (a) This is the palindrome language which is a CFL & not regular (b) {ww R x/ x, w (0+1) + } 0 110 1 = {0 n 110 n 1/n1} is a CFL which is not regular. (c) {wxw R /w, x(0+1) + } = 0(0+1) 0 +1(1+1) is a regular set. (d) {xww R / x, w(0+1) + } 110 110 = {110 n 10 n /n1} is a CFL that is not Regular. 17. Ans: (a) Sol: Any formal language, even if not R.E., can be considered to be the infinite union of singleton sets & hence the infinite union of regular sets is not necessarily infinite.

: 4 : Theory of Computation 18. Ans: (a) Sol: (a) 0B / 0 1 A A 0 1 0B 0 1 00C 0 1 000 1 Since (a) is correct, by the method of elimination (b), (c), (d) can be excluded. 19. Ans: (a) Sol: By the pumping lemma for regular sets there can only one sliding window. If two parts of a string depend on each other then the language cannot be regular. This rules out (b), (c), (d) as the a s, b s & c s depend on each other. 20. Ans: (a) Sol: E a A B a B a b b E aabab 21. Ans: (a) & (b) Sol: (d) {a p / p Prime} is not a regular set. It is a CSL. (a) (c) a k /k is multiple of n =a kn =(a k ) n is a Regular Expression. 22. Ans: (d) Sol: (d) L = {a m b n / m 1, n1} = a + b + is regular (a) L={x/x has equal number of a s & b s} L a b = {a n b n / n0}is a CFL. So L is not regular. (b) L = {a n b n /n1} is not regular by the pumping lemma for regular sets. (c) L a b = {a i b j / i j} is not regular by the pumping lemma for regular sets. 23. Ans: (c) Sol: To accept the complement interchange the final & non-final states. So the two final states become non-final & m 2 non-final states become final in 24. Ans: (a) & (b) c L. 1 Sol: (a) L = {wxw R w, x(0,1) + } = 0 (0 + 1) 0 + 1(0 + 1) 0 is regular (b) L = {wxw R w(a,b) + } = a(a+b) a + b(a+b) b is regular (c) L = {ww R w(a+b) + }is the palindrome 25. Ans: (c) language which is a CFL & not regular. Sol: (a+b ) = (a + + b +b ) = (a + b) So (a) & (b) are valid.

: 5 : CSIT Postal Coaching Solutions 26. Ans: (d) Sol: 1. This is un-decidable as it is the halting problem of TMs 2. The complement of a CFL can represent the valid computations of a Turing Machine & so this is un-decidable. 3. The regular sets are closed under complement. So this is decidable. 4. The recursive sets are closed under complement so this is decidable. 27. Ans: (d) Sol: L = {equal number of a s & b s} L a b = {a n b n n 1}. So L is a CFL which is not regular So L is a CSL as it is a CFL So L is accepted by LBA. The class of DFA, NFA & 2DFA all accept only the regular sets. So they cannot accept L. 28. Ans: (d) Sol: does not contain 100. So must be in the answer. This rules out choices (b) & (c). (a) is 0 (1+0) = (0+1) So it contains all strings. So it cannot be the answer. By elimination (d) is the answer. 29. Ans: (c) Sol: P1 is decidable as we simply trace the string through the state diagram. P2 is a known un-decidable problem. 30. Ans: (d) Sol: L = (0+1) 00 dfa 31. Ans: (a) Sol: [a] is true as L is a standard CFL that is not a regular set. The reason [r] is true & is the reason why L is not a regular set. 32. Ans: (a) 0,1 0 0 H P C 0 1 H HP H HP HPC H HPC HPC H 33. Ans: (b) Sol: S AB/DA B BCD/ABD/CC/b A a/bc C abd/a C abcad/dab A abcad/da A abd/acbd/asbcd

: 6 : Theory of Computation Reduced grammar S AB B b A a/bc C a S Ab A a/bc C a Or S Ab A a/ba Or S ba/bab So the language is finite. 34. Ans: (a) Sol: (a) This is the modulo 5 machine it has 5 states plus one state move to reject state starting with 0. This is true. (b) The NFA is complement of 0/1 0 0 And also the FA cannot have more than 4 states. (d) This is false as the minimal FA is unique. The above is a CSL & not CFL. L 2 = set of all palindromes in unary = a Now L 1 a = L 1 36. Ans: (c) Sol: A modulo N machine has N states. 37. Ans: (b) Sol: L x is not regular. If L is regular L 1/2 is regular. L x is not regular by the pumping lemma for regular sets. To get L 1/2 from a regular set L the machine has to make one move for every two moves of the machine accepting L. 38. Ans: (b) Sol: Practically every question related to regular sets and F.A. is decidable once just has to enumerate all the strings accepted by the DFA in lexicographic order. 39. Ans: (b) Sol: 0/0 1/0 A B 0/0 0/1 1/0 1/0 35. Ans: (d) Sol: L 1 = set of all squares in unary n a 2 / n 1 D 0/0 C 1/0

: 7 : CSIT Postal Coaching Solutions Consider input 0 If A is start state output is 0 If B is start state output is 0 If C is start state output is 0 If D is start state output is 1 So I is false Tracing 1100 from A, II is valid So if II is valid by elimination the answer is (b). 40. Sol: The set accepting is = 0 + 0 (11 + ) = 0 1 41. Ans: (b) Sol: The final state is C. How do we come to C. Clearly from B or D on input 0. How do we come to B or D. We need input 1 from A or B. So (b) is the answer. Condition Condition 1 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 43. Ans: (c) Sol: From state q 1, both a & b lead to a final state. From state q 2, both a & b lead to a final state. q 1 and q 2 can be merged into one state q 3 can be deleted. So minimal DFA is q 0 b a,b a q 1 Set accepted = b a(a + b) 44. Ans: (b) Sol: The minimal DFA has two states. 42. Ans: (c) Sol: 1 1 1 Condition 1 0 0 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 0 1 Condition 1 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 45. Ans: (a) Sol: I is a (bb) is regular. IV is (a+b) c (a+b) is regular. II and III are not regular by the pumping lemma for regular sets. 46. Ans: (a) Sol: (d) is ruled out as it containing (b) is ruled out as it containing 0 (c) is ruled out as it containing 0

: 8 : Theory of Computation 47. Ans: (a) Sol: s and t can be merged as on a & b they go to a final state. 2. Context Free Languages & Push-down Automata 48. Ans: (d) Sol: 1. 00 is 0 must reject, so it should go to q This reduces the choice to (c) and (d) 2. 00 on 1 give to 01. 3. In (c) we have the edge 10 on 0 remain in the same state. This will accept 0. So it cannot be the answer. By elimination (d) is the answer. 49. Ans: (d) Sol: As 0 is accepted (d) is false. Statement I is true as A is a F.A and its complement is regular and hence a CFL. Also L(A) = 0(0+1) + 11 0( 0 +1) = (11 0 +0) (0 +1) = (11 0+0) (0+1) 0 1 01. Ans: (d) Sol: (a) The intersection of two DCFLs can simulate all the valid computations of a Turing Machine, so DCFLs are not closed under complement. (b) The union of the two DCFLs {a n b n /n1} & {a n b 2n /n1}is not a DCFL. So DCFLs are not closed under union. (c) The homomorphism h(c) =, h(a)= a, h(b)=b applied to the DCFLs {a n b n /n1} {ca n b 2n /n1}converts it to a CFL that is not a DCFL. So CFLs are not closed under homomorphism. (d) The class of DCFLs are closed under the operations of complementation & inverse homomorphism 02. Ans: (a), (c) & (d) Sol: (a) They will be infinite classes of languages when L 1 L 2 = is decidable. So it is not only for regular set. This is FALSE. (b) It is decidable for DCFLs if L = R. TRUE

: 9 : CSIT Postal Coaching Solutions (c) The intersection of two DCFLs can simulate all the valid computations of a Turing Machine. This is FALSE. (d) The intersection of two CSLS, is CSLs, can simulate all the valid computations of a Turing Machine. This is FLASE 03. Ans: (a) & (d) Sol: The class of CFLs is closed under intersection with a regular set. (a) A CFL L = L, so it need not be regular. (b) The intersection of a CFL is always a CFL. 04. Ans: (a) Sol: The class of CFLs are closed under min but not max. 07. Ans: (d) Sol: Both L 1 & L 2 are CFL and then union is a CFL their intersection is the language {a n b n c n / n 1} is a CSL that is not a CFL. 08. Ans: (a) Sol: S XY, X Zb, Y Bw Z AB, W Z A aa/ba/ B Ba/Bb/ S XY, X Zb, Y w, Y Bw Z /AB/A/B W Z A a/aa/ba B a/ba/b S XY, X Zb/b, Y b, Y Bw Z AB/A/B, W Z A a/aa/ba B a/ba/b/bb 05. Ans: (a) Sol: The class of all formal languages is not countably infinite. 2 DFAs, CFLs, R.E sets & finite sets are all finite descriptions and are countably 09. Ans: (c) Sol: p a, z/xz q a, x/xx infinite. c, Z/Z c, x/x 06. Ans: (d) Sol: From the state p we can go now here. s b, x/ r, z/ b, x/

: 10 : Theory of Computation If the input states with a c then we cannot proceed with any more. So (a) & (b) are false and rejected. After a s which choose the machine to q & increase the stack, only a c must come for pop moves. So input must have a n c. So (c) is the answer and (d) can be rejected. To simplify this problem note that for (a) we must check for the string cabc, for (b) we must check for the string cacbc, for (c) we must check for the string acbc, for (d) we must check for the string abc. 10. Ans: (b) Sol: MC 1 is the complement of a CFL and is in general an R.E. set. 11. Ans: (c) Sol: The rule B rules out the choice(c) from being an operator grammar. 12. Ans: (c) Sol: The production S bdb/b Makes a CSG. 13. Ans: (d) Sol: (i) Consider the homomorphism h(0) = a, h(1) = b, h(0) = c, h(l 3 ) a b c = {a n b n c n /n 1} is a standard CSL that is not a CFL. So L 3 is not a CFL. (ii) As three parts of the string are related to each other L 2 is not a CFL. 14. Ans: (b) Sol: a is accepted by the NFA, is not accepted by the NFA So the complement should accept & reject a. only (b) can be chosen as the answer. 15. Ans: (a) Sol: L 1 is the annihilator. So L 1 L 2 =. L. 1 16. Ans: (d) Sol: Init (L) contains L, so these are strings with an equal number of a s and b s. This rules out (a) is not there in init (L) so (b) is ruled out (c) is ruled out as Init(L) containing L. 17. Ans: (c) Sol: Let l=1, then the height of the parse tree is 1. Let l= 2, then the height of the parse tree is 2. So (c) is the answer. 18. Ans: (c) Sol: L = {ww R w w in (a+b) + } is a CFL. L ba bba ba b = {ba n bba n ba n b n1} is a CSL that is not a CFL. So [a] is false.

: 11 : CSIT Postal Coaching Solutions The reason also false as the pumping lemma for CFLs is not satisfied. 19. Ans: (b) Sol: The language L = {ww w in (a+b) } is a standard CSL that is not a CFL. Its complement is a CFL as a CFG can be constructed generating L 1. L 1 satisfies the pumping lemma. If a language satisfies the pumping lemma for CFLs are cannot say anything. So [r] is not the reason for [a]. 20. Ans: (a) n 2 Sol: S : a / n 10000000 is a finite set. So the answer should have S 4 as a choice. 21. Ans: (a) Sol: B b,c a S b + /a + /Ab + /a + A and A generates an equal number of a s & b s. So the language generates set of strings with an unequal number of a s & b s. Note that it does not generate all such strings as the a s come first & then the b s. 23. Ans: (b) Sol: 2, 1, 1, 3 is a solution to (1) where (2) has no solution. 24. Ans: (a) Sol: The c in the center of (a) tells us where the mirror can be placed in the mirror language. (b) Contains all palindromes & we have to place the mirror non-deterministically. (c) is a standard CSL that is not a CFL or DCFL. (d) is the same as (b) a CFL that is not a DCFL. 25. Ans: (d) Sol: Non-determinism does not add power to the finite automata. So D f = N f. Non-determinism adds power to the pushdown automata, So D p N P. 26. Ans: (d) Sol: 1. S S or S S 22. Ans: (c) Sol: The DCFLs are not closed under reversal. The language {a n b n n 1} {a 2n b n n 1} is a DCFL but its reversal is not. So has more than one derivation tree & hence G is ambiguous.

: 12 : Theory of Computation 2. G is a CFG So L(G) can be accepted by a PDA. A DPDA can check for an equal number of a s & b s. 3. L (G) generates an equal number of a s & b s, and permutation of such strings. S a B a B B or S a B a B B 27. Ans: (b) Sol: (b) L 3 is R.E but not recursive. So L 3 regular set is R.E but not recursive. (a) DCFL regular is DCFL. (c) DCFL regular is CFL (d) DCFL regular R.E. set = R.E set R.E set R.E set= R.E set 28. Ans: (c) Sol: The grammar generates an equal number of a s & b s. 29. Ans: (b) Sol: 1. aabbab = (aabb) (ab) 2. aabbab = (aabbab) b b a S B b Yields (aabb) (ab) 30. Ans: (c) Sol: (1) Should allow (00) even number of 0 s. (3) & (4) compulsory require a 1 in their input. So P can be mapped to 1 or 2. Q can also be mapped to 1 or 2. So the answer by elimination is (a) or (c). (d) Accepts 0010 and only (1) matches this. So the answer is P 1, Q 2, and so it is (c). b S a B b b Yields (aabbab) 31. Ans: (d) Sol: The set {0 p 1 q 0 r p, q, r 0} is the set a b c a regular set. So L 1 is a regular set L 2 is a CFL which is not regular. So (a) is true. CFL regular = CFL. So (b) is true.

: 13 : CSIT Postal Coaching Solutions L 2 is a CFL and any CFL is a recursive set & the recursive sets are closed under complement. So (c) is true. Complement of L 1 is a regular set so it is a CFL which is regular. So (d) is false. and Turing machine can be finitely described. These finite representations can be effectively enumerated. The set of all formal languages is not countably infinite 01. Ans: (d) Sol: The R.E. sets are not closed under complement but the recursive sets are so, if a R.E set has its complement as a R.E set then it is recursive. 02. Ans: (b) Sol: The membership problem of TMs is partially decidable. Just run the machine and sit infront of it. 03. Ans: (d) 3. Turing Machine, Modifications, CSLs, Recursive & R.E. sets Sol: can not be in any CSL. So, rules out kleene closure, substitution, homomorphism & / The CSLs are closed under -free substitution, - free homomorphism & / + 04. Ans: (a) Sol: The primes can be given by an algorithm so they form a recursive set. The DCFLs 05. Ans: (a) Sol: A singleton set is a finite set and is decidable 06. Ans: (d) Sol: Some NP - Hard problem may possibly have polynomial complexity if P = NP. 07. Ans: (d) Sol: L 1 = 0 1 is a regular set and hence a CFL and R.E set. It can be recognized by finite automata, push down automata and Turing machine. L 2 = {0 n 1 n n 1}is a standard CFL that can be recognized by PDA and Turing machine L 3 = {0 n 1 n 0 n n 1} is a standard CSL that is not a CFL. 08. Ans: (d) Sol: Ram shows L 1 is R.E but this does not mean it is recursive. So, choice (b) is ruled out. If a R.E and its complement are both R.E then the set is recursive

: 14 : Theory of Computation If an R.E. set can have its elements enumerated in a lexicographic order then it is recursive 09. Ans: (a) Sol: An R.E set and its complement are both R.E so the sets L 1 and L 2 both are recursive 10. Ans: (d) Sol: The set is a finite set so it is regular or Type 3 11. Ans: (d) Sol: At present it is not known if NP is closed under complement. If P = NP then NP is closed under complementation. Since NP deals with sets accepted by some deterministic Turing Machine of polynomial time complexity, the class NP is closed under union, intersection and concatenation. 12. Ans: (a) Sol: (b) One blank tape the TM halts on input, so (b) cannot be the answer. (c) On input 0: q 0 0 q 1 1 q 0 1 q 1 1 (d) On input 1: q 0 1 q 1 1 q 0 1 q 1 1 loops. So, (d) can not be the answer. By elimination (a) is the answer. 13. Ans: (a), (c) & (d) Sol: 1. abbb is accepted by the F.A so (a) is ruled out. 2. After an a, ab is compulsory. So aa cannot be a substring. 3. After an a atleast two b s must be there. 14. Ans: (d) Sol: Practically everything about regular sets is decidable. So, (4) is decidable. It is decidable if a CFG generates an empty set. Form the reduced grammar if all productions vanish L (G) = The completeness problem L(G) = is un-decidable for CFLs. The invalid computations of a Turing machine can be given by a CFL. If we can decide if a TM accepts a regular set then we can resolve L(G) = for CFLs. So the regularity problem of TMs is un-decidable. q 0 1.. loops. So (c) cannot be the answer.