GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A single-tape TM (blank B, start q0 on the leftmost cell, accepting state qa) has 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). It accepts exactly the binary palindromes. How many moves does it make to accept 0110?
- A. 12
- B. 15
- C. 19
- D. 8
Correct answer: B. 15
It erases the first symbol, runs to the right end, checks and erases the matching last symbol, and returns; two such rounds plus the final blank check take 15 moves by simulation.
More Theory of Computation questions
- 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) =…
- 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?