GATE / CS ARCHIVE

GATE CSE 2003 / QUESTION 53

Nonhalting behavior of a two-state Turing machine

Theory of Computation · Turing Machines · Full GATE CSE 2003 paper

GATE 2003, Q53 2 marks · MCQ
Report issue

Turing Machines

Question 53, GATE 2003: A single-tape Turing machine has states q0 (start), q1, tape symbols {0,1,B}, and input alphabet {0,1}; B is blank. A transition (q,s,D) means write s, move D, enter q. The table is:
q0 on 0: (q1,1,R); on 1: (q1,1,R); on B: Halt.
q1 on 0: (q1,1,R); on 1: (q0,1,L); on B: (q0,B,L).
Which is true?
A. M does not halt on any string in (0+1)+.
B. M does not halt on any string in (00+1)*.
C. M halts on all strings ending in 0.
D. M halts on all strings ending in 1.
Here + between symbols is union and superscript + means one or more repetitions.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Empty input starts with a blank under q0 and halts immediately. Since ε belongs to (00+1)*, B cannot be true.
2. On any nonempty input q0 writes a 1 and moves right into q1. q1 passes over zeros, replacing each with 1, until reaching either a preexisting 1 or the right-hand blank.
3. At this boundary q1 moves left to q0. That left cell is now 1, so q0 moves right into q1 without changing it. q1 sees the same boundary symbol and moves left again. These two configurations repeat forever.
4. This applies to every nonempty binary input, regardless of its final symbol. Hence A, not C or D.

Solution: On a nonempty input, q₀ writes 1 in the first cell and moves right in q₁. State q₁ changes any subsequent zeros to ones and moves right until it sees a 1 or the first blank. At either such boundary it moves left into q₀. The cell to its left is now 1, so q₀ moves right again to the boundary in q₁, producing a two-configuration loop. Thus every nonempty binary input diverges, option A. Empty input halts immediately, so option B, whose starred language includes ε, is false.

Original paper, page 7