GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A TM with rules δ(q0,a) = (q1,X,R); δ(q0,Y) = (q3,Y,R); δ(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,R) starts in q0 on the leftmost cell (blank B) and accepts at qa. How many moves does it make before accepting aaabbb?

  1. A. 25
  2. B. 19
  3. C. 30
  4. D. 18

Correct answer: A. 25

Each of the 3 rounds marks the first remaining a as X and the first b as Y, then returns left; the quadratic total including the final scan is 25 moves by simulation.

More Theory of Computation questions

Exams that ask this topic