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?

  1. A. 12
  2. B. 15
  3. C. 19
  4. 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

Exams that ask this topic