GATE Computer ScienceModerateGATE CS (PYQ pattern)

For the TM with 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) (start q0 on the leftmost cell, halts in qa), what is the number of 1s left on the tape after it halts on the input 11110111?

  1. A. 8
  2. B. 6
  3. C. 7
  4. D. 9

Correct answer: C. 7

The machine computes unary addition m + n by replacing the separator with 1 and erasing the final 1: 4 + 3 = 7 ones remain.

More Theory of Computation questions

Exams that ask this topic