GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A TM with rules δ(q0,a) = (q1,X,R); δ(q0,Y) = (q4,Y,R); δ(q1,a) = (q1,a,R); δ(q1,Y) = (q1,Y,R); δ(q1,b) = (q2,Y,R); δ(q2,b) = (q2,b,R); δ(q2,Z) = (q2,Z,R); δ(q2,c) = (q3,Z,L); δ(q3,a) = (q3,a,L); δ(q3,b) = (q3,b,L); δ(q3,Y) = (q3,Y,L); δ(q3,Z) = (q3,Z,L); δ(q3,X) = (q0,X,R); δ(q4,Y) = (q4,Y,R); δ(q4,Z) = (q4,Z,R); δ(q4,B) = (qa,B,R) starts in q0 on the leftmost cell of the input (blank = B) and accepts by reaching qa. How many moves does it make before accepting the input aabbcc?

  1. A. 19
  2. B. 26
  3. C. 23
  4. D. 12

Correct answer: C. 23

Each round marks one a, one b and one c (X, Y, Z) and returns to the left; two full rounds plus the final verification sweep take 23 moves by direct simulation.

More Theory of Computation questions

Exams that ask this topic