GATE Computer ScienceHardGATE CS (PYQ pattern)

A TM (blank B, start q0 on the leftmost cell, halting state qa) has rules: δ(q0,1) = (q0,1,R); δ(q0,0) = (q1,1,R); δ(q1,1) = (q1,1,R); δ(q1,B) = (q2,B,L); δ(q2,1) = (qa,B,R). Started on 111011 (unary 3, a separator 0, unary 2), how many moves does it make before halting?

  1. A. 6
  2. B. 10
  3. C. 5
  4. D. 8

Correct answer: D. 8

It moves right over 3 ones, turns the 0 into 1, moves over the remaining 2 ones and the blank, steps back and erases the last 1: 8 moves, leaving 11111.

More Theory of Computation questions

Exams that ask this topic