Published on

archived theory of computation question bannk ecil 2000-2005

Published in: Entertainment & Humor
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. TURING MACHINES & R.E. SETSGN-TM1-Q1. Choose the correct statements:a) A is recursive if both A and its complement areaccepted by TMsb) The r.e sets are closed under complementation.c) The recursive sets are closed undercomplementation.d) The r.e and recursive sets are closed under union.GN-TM1-S1.Solution:a) Consider a TM, M, accepting a r.e. set L1 & andTM, M2 accepting a r.e. set L2.Let L2 be M’s complement
  2. 2. Yes, halt Yes, halt W M1 W M2 No, halt No, halt Loop L (M1) = L1 L (M2) = L2Given a string we feed it to both M1, & M2 as inputsome. Any string w must be in L1 or its complement.So in a finite amount of time we will know if M1 or M2accepts w. So we can determine the membershipproblem. So we have the standard theorem that if aset & its complement are both r.e. then the set isrecursive. So (a) is true.b) The r.e. sets are not closed undercomplementation. To know it Ashok will give me Rs20/- I wait outside his house. If he will give me hewill do so on a finite amount. If he does not want togive I will never know. So formulate a TM simulatingthe same.The universal language L which contains strings<M,w> where a TM M accepts the string w has itscomplement not r.e., so (b) is “FALSE”.c) The recursive sets are closed under complement.Here we only change accepting & rejecting states.(TRUE).d) The r.e. and recursive sets are closed underunion. Let L1 & L2 be two r.e. sets accepted by twoturing machines, M1 & M2. Let M1 be Ashok & M2 beRahim. To test for membership we run M1 & M2parallel, i.e. we ask both Rahim & Ashoksimultaneously. If one of them accepts it is enough
  3. 3. for r.e. sets. For recursive sets we also know if theywill reject the input in a finite amount of time. (d) isTRUE.GN-TM1-Q2. The language L ={anbn/0<n<327th prime number} isa) A regular set b) a CFL c) a CSL d) a r.e setGN-TM1-S2.Solution:The 327th prime number is finite and so L is a finiteset. The best answer is (a).
  4. 4. GN-TM1-Q3. The following languages areclosed under infinite uniona) Recursive sets b) r.e setsc) all formal languages d) none of theaboveGN-TM1-S3.Solution:Any formal language L that is not even R.e can beconsidered to be a infinite union of finite sets,consisting of a single string from L. Thus (a) & (b)are ruled out.GN-TM1-Q4. Recursive languages are:
  5. 5. a) A proper superset of CFLs b) alwaysrecognizablec) Also called type 0 languages d) recognizableby Turing machinesGN-TM1-S4.Solution:Answer---all are correct except (c).GN-TM1-Q5. In which of the cases stated belowis the following statement true?“For every non-deterministic machine M1 thereexists an equivalent deterministic machine M2recognizing the same language”.a) M1 is a non-deterministic finite automatab) M1 is a non-deterministic PDAc) M1 is a non-deterministic Turing machined) For no machine M1 the above statement is trueGN-TM1-S5.
  6. 6. Answer: (b).The nondeterministic pda is more powerful than thedeterministic one, as acceptance of yhe language ofall even length palindromes shows.GN-TM1-Q6. Which of the following statementsare true?a) The union of two recursive languages is recursiveb) The infinite union of recursive languages isrecursivec) The language {an/ n prime} is not regulard) Regular sets are closed under infinite union and soare DCFLsGN-TM1-S6.Solution:The recursive sets are closed under union and the
  7. 7. language of primes in unary is not regular.Infinite union does not preserve any class of formallanguages, expect all formal languages.GN-TM1-Q7. Choose the incorrect statements:a) Every subset of a countable set is countable b)The class of TMs is countablec) The class of LBA is countable d) Theclass of DPDA is not countableGN-TM1-S7.Solution:TMs & LBAs are finite descriptions, so the class ofTMS & the class of LBA are countable. A countableset has a countably infinite subset and so iscountable.The DPDA are finite descriptions & so the class ofDPDA is countable infinite.
  8. 8. GN-TM1-Q8. Which of the following conversionis not possible (algorithmically)?a) Regular grammar to Context-free grammarb) Non-deterministic FSA to deterministic FSAc) Non-deterministic PDA to deterministic PDAd) Non-deterministic TM to deterministic TMGN-TM1-S8.Solution:a) A regular grammar is trivially a cfgb) A nfa can be converted to an equivalent dfa a bytheconstruction of the subset machine.c) The language of even length palindromes showsthat npda are more powerful than dpda’sd) Number the moves of the Tm 1, 2, 3, ----h.Enumerate string in base h+1. For each stringenumerated try the move. If a non-deterministic TM
  9. 9. accepts it does so by a finite numbers of movesrepresented by h1, h2----hn, which will beenumerated in a finite amount of time.GN-TM1-Q9. Consider grammar with thefollowing productionsSa  b/b  c/aBS  S/bS  bb/abb  bdb/bThe above grammar isa) Context free b) Regular c) Contextsensitive d) LR(K)GN-TM1-S9.Answer: (c). The last production has two symbols onthe lhs.
  10. 10. GN-TM1-Q10. Which of the followingstatements is false:a) The halting problem of TMs is undecidableb) Determining whether a CFG is ambiguous isundecidablec) Given two arbitrary CFGs G1 and G2 it isundecidable whether L(G1) = L(G2)d) Given two regular grammars G1 and G2 it isundecidable whether L(G1) = L(G2)GN-TM1-S10.Solution:The halting problem is a standard undecidableproblem. The ambiguity problem of cfg’s isundecidable. The equivalence problem of cfls isundecidable. However, the equivalence problem ofregular sets is decidable.
  11. 11. GN-TM1-Q11. Which one of the following is notdecidable?a) Given a TM M, a string s and an integer k, Maccepts with in k steps.b) Equivalence of two given TMsc) Language accepted by a given FSM is non empty.d) Language generated by a CFG is non empty.GN-TM1-S11.Solution:a) Run the TM for h steps to find out if it accepts S.So this is decidable.b) The equivalence problem of r.e. sets isundecidable.c) Test strings of length 0, 1, 2, ----n up to n thenumber of states of the ndfa. If the set accepted isnot empty then at least a string of length <n will beaccepted.d) Obtain the reduced grammar draw a graph of the
  12. 12. grammar with nonterminals as nodes. If we here aproduction A  B    draw an edge from A to B. If theresulting graph vanishes the set accepted is empty.GN-TM1-Q12. Regarding the power ofrecognition of languages, which of thefollowing statements is false?a) The NDFA are equivalent to DFA. b) The NDFAare equivalent to DPDA.c) The NDFA are equivalent to DTMs. d) MultitapeTMs are equivalent to single-tape TMsGN-TM1-S12.Answer: (b) & (c) are false.
  13. 13. GN-TM1-Q13. Consider the following decisionproblems:(P1) does a given FSM accept a given string.(P2) does a given CFG generate an infinitenumber of strings.Which of the following statements is true?a) Both (P1) and (P2) are decidable b) Neither(P1) nor (P2) are decidablec) Only (P1) is decidable d) Only (P2) isdecidableGN-TM1-S13.Solution:P1: Run the FS as on the input strings to see if it isaccepted.P2: Reduce the cfg by useless no to minerals. Drawthe graph of the grammar with every non to minal anode of the graph. For a rule A  B    draw an edgefrom A to B. If the resolution graph has a loop thelanguage generated infinite.
  14. 14. GN-TM1-Q14. Consider the following problemX.Given a TM M over the input alphabet  , for anystate q of M and a word w   *, does thecomputation of M on w visit the state q? Whichof the following statements about X is correct?a) X is decidableb) X is undecidable but partially decidable.c) X is undecidable and not even partially decidabled) X is not a decision problemGN-TM1-S14.Answer: (b).Run the turing machine M on input w, if it ever haltswe will know in a finite amount of time.
  15. 15. GN-TM1-Q15. Choose the correct statementsa) The problem as to whether a TM M accepts w isundecidable.b) It is decidable if a TM M started on blank top willever haltc) It is decidable if a TM ever prints a symbold) It is decidable if a TM ever enters a particularstate.GN-TM1-S15.Solution:X is not decidable as we can make a state q in theturing machine, such that when the machine entersq it will halt. This will result in the halting problembeing solved. X is partially decidable. Run themachine M on w and wait patiently. If the state q isever entered then we will know in a finite amount ofhow, else we may here to want for an infiniteamount of time if q is not entered. This problem ispartially decidable.Solution:
  16. 16. a) This reduces to the HALTING PROBLEM which isundecidable.b) This is the BLANKTAPE halting problem which isundecidable. It can be converted to problem (a). TheTM first prints w on the input tape and proceeds.c) This is the PRINTING PROBLEM. We can modify anarbitrary turing machine so that it halts when itprints the symbol, thus resolving the Haltingproblem.d) If we can determine whether a TM enters aparticular state then we can modify an arbitrary TMis so that when it enters the state it will halt. Thiswill resolve the halting problem.GN-TM1-Q16. Which of the following are true.a) The member ship problem of cfls is undecidableb) It is undecidable if a cfl is regularc) The halting problem of finite automata is
  17. 17. undecidable.d) The membership problem for type 0 languages isdecidable.GN-TM1-S16.Solution:a) The CYK algorithm determines membership in acfl.b) L= R, L is a cfl & R is a regular set is undecidable.If R is Σ* then the problem reduces to whether a cflgenerates all the strings over its terminalvocabulary.c) Run the fa on an input larger than the number ofstates to see if it terminates in a final state.Alternatively form regular expressions from the finiteautomata. The well formed regular expressions aregenerated by a cfg. The problem reduces to themembership roblrm of cfls.d) This reduces to the standard halting problem & isundecidable.
  18. 18. GN-TM1-Q17. Which of the following is thestrongest correct statement about a finitelanguage over some finite alphabet  ?a) It could be undecidable b) It is TM recognizablec) It is a regular language. d) None of the above.GN-TM1-S17.Answer: (a), (b) & (c) are valid. (c) is the strongeststatement.GN-TM1-Q18. Let L be a language over suppose L satisfies two conditions givenbelowi) L is in NPii) For every n, there is exactly one string oflength n that belongs to L. Let Lc be thecomponent of L in  *.
  19. 19. a) Lc is also in NP b) Lc is undecidablec) Lc is not in NP d) None of the aboveGN-TM1-S18.Solution:Answer (a).Given a string w, see if it is in L. Run M on L, if Maccepts L, we only here to run it P (IwI) steps. If w isnot accepted by L in P (IWI) steps then it is in Lc.Thus the machine determines membership for Lc andis a NDTM. So Lc is in NP.GN-TM1-Q19. Ram and shyam have been askedto show that a certain problem  is NP-complete. Ram shows a polynomial timereduction from the 3-SAT problem to  , andshyam shows a polynomial time reduction from to 3–SAT. Which of the following can beinferred from these reduction?a)  is NP-hard but not NP-complete b)  is NP,
  20. 20. but not NP-completec)  is NP-complete d)  is neitherNP-hard nor in NPGN-TM1-S19.Answer is (a).The NP-complete problems form an exclusive club.Membership to the club is by invitation. If a knpownNP-complete problem reduces to a new problem X.Then X is said to be NP-hard. X is being consideredfor membership of the club by invitation.X cannot suo motto declare its eligibility to be in theclub. No outsider can say X is fit for membership.If X is in NP then after being invited it gets NP-complete status.GN-TM1-Q20. Nobody knows yet if P = NP.Consider the language L defined as follows.
  21. 21. L = (0+1)* if P = NP=  otherwiseWhich of the following statements is true?a) L is recursiveb) L is recursively enumerable but not recursivec) L is not recursively enumerabled) Whether L is recursive or not will be known afterwe find out if P = NPGN-TM1-S20.Solution:Answer is (a).In either case L is a recursive set.Common sense: “Whether Ram or Ravan rules,L will be a recursive set”.GN-TM1-Q21. Consider two languages L1 and
  22. 22. L2, each on the alphabet  .f*   * be apolynomial time computable bijection such that( x ) [x L1 iff f(x) L2]. Further let f-1 be alsopolynomial time computable. Which of thefollowing CANNOT be true?a) L1 P and L2 is finiteb) L1 NP and L2 Pc) L1 is undecidable and L2 is decidabled) L1 is recursively enumerable and L2 is recursiveGN-TM1-S21.Solution:Use the method of elimination. Let L1=L2. Then (b),(a), (d) are valid. Clearly (c) is invalid.Note: We did not even have to read thequestion. The method of elimination is applieddirectly to the answers.
  23. 23. GN-TM1-Q22. A single tape TM M has twostates q0 and q1, of which q0 is the startingstate. The tape alphabet of M is { 0, 1, B} andits input alphabet is {0, 1}. The symbol B is theblank symbol used to indicate end of an inputstring. The transition function of M is describedin the following table 0 1 B q0 (q1, 1, R) (q1, 1, R) Halt q1 (q1, 1, R) (q0, 1, L) (q0, 1, L)Which of the following statements is true aboutM?a) M does not halt on any string in (0+1)+b) M does not halt on any string (00+1)*c) M halts on all strings ending in a 0.d) M halts on all strings ending in a 1.GN-TM1-S22.Solution:BY elimination if the input is  the machine halts soanswer is (b) as a, b, d input contain Simulation:
  24. 24. 1) q0 0  1q1  q0 0  1q1    loop2) q0 0  1q1  q01  1q1    loop3) q0 00  1q1 0  11q1  1q01  nq1    loop4) q0 01  1q11  q011  1q11  q011    loop5) q011      loop6) q010  1q1 0  11q1  1q01  11q1 R    loopGN-TM1-Q23. Define language L0 and L1 asfollowsL0= {<M, w, 0> / M halts on w}L1 = {<M, w, 1> / M does not halt on w}Here <M, w, 1> is a triplet, whose firstcomponent, M, is an encoding of a TM secondcomponent, w, is a string, and thirdcomponent, i, is a bit.Let L=L0 L1. Which of the following is true?a) L is recursively enumerable, but L is not b) L isrecursively enumerable, L but is not
  25. 25. c) Both L and L are recursive d) Neither Lnor L is recursively enumerableGN-TM1-S23.Solution:Answer is (c ).a) If L is r.e. then are can determine the haltingproblem for by strings in L . So (a) and (c) are ruledout.b) If L is r.e. then we can determine the haltingproblem.The answer is thus ©.GN-TM1-Q24. An FSM can be considered to be aTMa) of finite tape length, rewinding capability andunidirectional tape movement.b) of finite tape length, without rewinding capability
  26. 26. and unidirectional tape movement.c) of finite tape length, without rewinding capabilityand bi-directional tape movement.d) of finite tape length, rewinding capability and bi-directional tape movement.GN-TM1-S24.Solution:Answer is (b).The ink is of no use to the turing machine inthis case. A turing machine without ink acceptsthe regular sets.GN-TM1-Q25. TM is more powerful than FMbecausea) Tape movement is confined to one direction b) ithas no finite state controlc) It has the capability to remember arbitrary longsequences of input symbols.
  27. 27. d) None of the above.GN-TM1-S25.Solution:Answer is ( c ).GN-TM1-Q26. A PDM haves like an FA when thenumber of auxiliary memory it has, is less thana) 0 b) 1 c) 2 d) None of theaboveGN-TM1-S26.Solution:Answer is (d).A 2 stack machine can simulate a TM.
  28. 28. GN-TM1-Q27. A PDM behaves like a TM whenthe number of auxiliary memory it has, isa) 0 b) 1 or more c) 2 or more d) Noneof the aboveGN-TM1-S27.Solution:Answer is (c ).A 2 stack machine can simulate a TM.GN-TM1-Q28. Choose the correct statements.a) An FSM with 1 stack is more powerful than an
  29. 29. FSM with no stack.b) An FSM with 2 stacks is more powerful than anFSM with 1 stack.c) An FSM with 3 stacks is more powerful than anFSM with 2 stacks.d) All of the above comments are true.GN-TM1-S28.Solution:A 2 stack machine can simulate a TM.GN-TM1-Q29. Bounded minimisation is atechnique fora) Proving whether a primitive recursive function isTuring computable or notb) Proving whether a primitive recursive function istotal function or notc) Generating primitive recursive functions.d) Generating partial recursive functions.
  30. 30. GN-TM1-S29.Solution: (d).GN-TM1-Q30. Choose the correct statements:a) A total recursive function is also a partial recursivefunctionb) A partial recursive function is also a totalrecursive functionc) A partial recursive function is also a primitiverecursive functiond) A primitive recursive function is also a partialrecursive functionGN-TM1-S30.Solution:
  31. 31. Partial reverse functions Total functions Primitive Recursive functionsGN-TM1-Q31. If there exists a language L, forwhich there exists a TM, T, that accepts everyword in L and either rejects or loops for everyword that is not in L, is said to bea) Recursive b) recursively enumerablec) NP-HARD d) None of the aboveGN-TM1-S31.Solution:Answer is (b).
  32. 32. Definition of a r.e. set.GN-TM1-Q32. Choose the correct statements:a) L = {an bn an}/n=1, 2, 3….} is r.eb) r.e languages are closed under unionc) Every recursive language is recursivelyenumerabled) Recursively languages are closed underintersectionGN-TM1-S32.Solution:All are true.
  33. 33. GN-TM1-Q33. Choose the correct statements:a) Set of recursively enumerable languages is closedunder union.b) If a language and its complement are bothrecursively enumerable, then the language must berecursive.c) Recursive languages are closed undercomplementationd) None of the above.GN-TM1-S33.All (a), (b) & (c) are true.Solution: r. e. sets Recursive {a b a / n  1} n n n csl v, p, -
  34. 34. GN_TM1-Q34. Pick the correct answers:a) Stored-program computers b) Interpretiveimplementation of programming languagesc) Computability d) None of the aboveGN-TM1-Q35. The number of internal states ofa UTM should be at leasta) 1 b) 2 c) 3 d) 4
  35. 35. GN-TM1-S35.Solution: (c ).GN-TM1-Q36. The statement... ”A TM can’tsolve halting problem” isa) True b) False c) Still an open question d) None of the aboveGN-TM1-S36.Solution: (a).
  36. 36. GN-TM1-Q37. If there exists a TM which whenapplied to any problem in the class, terminatesif the computer answer is yes and may or maynot terminate other wise, is said to bea) Stable b) Unsolvable c) Partiallysolvable d) unsolvableGN-TM1-S37.Solution: (c).GN-TM1-Q38. The vernacular language English,if considered a formal language, is aa) Regular language b) Context freelanguagec) Context sensitive language d) none of the aboveGN-TM1-S38.
  37. 37. Solution:None of the above.