GATE Computer ScienceVery hardGATE CSE

A TM (blank B) has rules: δ(q0,a) = (q1,X,R); δ(q0,Y) = (q3,Y,R); δ(q0,B) = (qa,B,S); δ(q1,a) = (q1,a,R); δ(q1,Y) = (q1,Y,R); δ(q1,b) = (q2,Y,L); δ(q2,a) = (q2,a,L); δ(q2,Y) = (q2,Y,L); δ(q2,X) = (q0,X,R); δ(q3,Y) = (q3,Y,R); δ(q3,B) = (qa,B,S). It starts in q0 on the leftmost symbol and every rule applied counts as one step; qa halts and accepts. For input aaabbb, how many steps are executed up to acceptance?

  1. A. 23
  2. B. 25
  3. C. 26
  4. D. 29

Correct answer: B. 25

Each of the three passes (mark an a, walk right, mark a b, walk back to X, step right) costs 7 steps = 21; then q0 reads Y, q3 skips the two Y's and accepts on the blank: 4 more. Total 25.

More Theory of Computation questions

Exams that ask this topic