GATE Computer ScienceVery hardGATE CS (PYQ pattern)
For the palindrome-checking TM with rules δ(q0,0) = (q1,B,R); δ(q0,1) = (q4,B,R); δ(q0,B) = (qa,B,R); δ(q1,0) = (q1,0,R); δ(q1,1) = (q1,1,R); δ(q1,B) = (q2,B,L); δ(q2,0) = (q3,B,L); δ(q2,B) = (qa,B,R); δ(q3,0) = (q3,0,L); δ(q3,1) = (q3,1,L); δ(q3,B) = (q0,B,R); δ(q4,0) = (q4,0,R); δ(q4,1) = (q4,1,R); δ(q4,B) = (q5,B,L); δ(q5,1) = (q3,B,L); δ(q5,B) = (qa,B,R) (start q0 on the leftmost cell), what is the number of moves it takes to accept the input 010010?
- A. 21
- B. 37
- C. 25
- D. 28
Correct answer: D. 28
Three rounds of 'erase the left symbol, run right, erase the matching right symbol, run back' cost about 2k moves each for shrinking length k; simulation gives 28 moves in total.
More Theory of Computation questions
- The grammar S → aSBC | aBC; CB → BC; aB → ab; bB → bb; bC → bc; cC → cc generates { aⁿbⁿcⁿ : n ≥ 1 }. How many derivation steps does EVERY…
- Which of the following productions cannot appear in a context-sensitive (non-contracting) grammar?
- A grammar has productions S → aS | bA | ε; A → aA | b. Which is the most restricted class of the Chomsky hierarchy that the grammar…
- Which of the following statements are correct? I. Every context-free language over a one-letter alphabet is regular. II. { a^(2ⁿ) : n ≥ 0…
- Let A = { ⟨M⟩ : the Turing machine M accepts at most one string }. Which statement is correct?
- Which of the following statements about the Post Correspondence Problem (PCP) are correct? I. PCP restricted to a one-letter alphabet is…