GATE Computer ScienceHardGATE CSE

A single-tape TM (blank B) starts in q0 at the leftmost symbol of a binary string. Rules: δ(q0,0) = (q0,0,R); δ(q0,1) = (q0,1,R); δ(q0,B) = (q1,B,L); δ(q1,1) = (q1,0,L); δ(q1,0) = (qa,1,S); δ(q1,B) = (qa,1,S). Each rule applied is one step and qa halts the machine. For input 1101111, how many steps are executed before it halts?

  1. A. 12
  2. B. 14
  3. C. 16
  4. D. 13

Correct answer: D. 13

7 right moves, 1 turn at the blank, then the carry flips four 1s to 0 (4 steps) and the final rule writes 1 on the 0: total 13; the tape becomes 1110000.

More Theory of Computation questions

Exams that ask this topic