GATE Computer ScienceVery hardGATE CSE
A Turing machine (blank B, halts when no rule applies or in state acc) has rules: q0: a→(q1,B,R), b→(q2,B,R), B→(acc,B,S); q1 and q2: a,b→(same state,same symbol,R); q1: B→(q3,B,L); q2: B→(q4,B,L); q3: a→(q5,B,L), B→(acc,B,S); q4: b→(q5,B,L), B→(acc,B,S); q5: a,b→(q5,same symbol,L), B→(q0,B,R). It starts in q0 on the leftmost symbol of the input abbaabba. How many steps (rule applications) does it perform before halting?
- A. 37
- B. 51
- C. 58
- D. 45
Correct answer: D. 45
The machine strips matching end symbols round by round (round cost grows by about 4 per shrink); simulating the full tape yields 45 steps and it ends in acc.
More Theory of Computation questions
- Which regular expression (+ denotes union) denotes exactly the set of non-empty strings over {a, b} that start with a, end with a and…
- How many strings of length 10 over {a, b} belong to the language of (a+b)(aab + bba)(a+b), that is, contain aab or bba as a substring?
- Let L = { w ∈ {a, b} : (|w|a + 2·|w|b) mod 12 ∈ {1, 5, 9} }, where |w|a and |w|b count the a's and b's. What is the number of equivalence…
- Consider these problems: (a) Given a DFA M, is L(M) empty? (b) Given two CFGs G₁, G₂, is L(G₁) ∩ L(G₂) = ∅? (c) Given a TM M and input w…
- How many of the following statements are true? (i) DCFLs are closed under complement. (ii) CFLs are closed under intersection with a…
- Among the six languages L₁ = {aⁱbʲcᵏdˡ : i = k and j = l}, L₂ = {aⁱbʲcᵏ : i = j or j = k}, L₃ = {wwᴿ : w ∈ {a,b}}, L₄ = complement of…