GATE Computer ScienceHardGATE CS (PYQ pattern)

A single-tape TM with blank B starts in q0 on the leftmost cell of the input 10111. Its rules (state, symbol) → (state, write, move) are: δ(q0,0) = (q0,0,R); δ(q0,1) = (q0,1,R); δ(q0,B) = (q1,B,L); δ(q1,1) = (q1,0,L); δ(q1,0) = (qa,1,L); δ(q1,B) = (qa,1,L). It halts in qa. How many moves does it make on this input?

  1. A. 9
  2. B. 10
  3. C. 11
  4. D. 5

Correct answer: B. 10

It scans right across 5 cells and the blank (6 moves), then adds 1 by turning the three trailing 1s into 0s and the next 0 into 1 (4 moves): 10 moves, leaving 11000.

More Theory of Computation questions

Exams that ask this topic