GATE / CS ARCHIVE

SUBJECT COLLECTION

Theory of Computation · Turing Machines

4 questions, newest first

GATE CSE has asked 4 questions on Turing Machines (Theory of Computation) from 1991 to 2026, in 4 of the 46 papers; the most recent is in GATE CSE 2026 Set 2. In the last five years it carried 0.1 marks per 100-mark paper on average, against 0.1 since 2003. Since 2014 the questions have been 1 MCQ. 2 groups of questions here are solved the same way; “One per method” keeps the newest of each.

Browse topics
1 mark · MCQ
Report issue

Deciding versus recognizing a language

Turing Machines

Question 13, GATE 2026: For a Turing machine M and L⊆{0,1}*, which is equivalent to M deciding L? A M halts everywhere; B M accepts all members of L; C M rejects all nonmembers; D M accepts every member and rejects every nonmember.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Givens and goal

For a Turing machine M and L⊆{0,1}*, which is equivalent to M deciding L? A M halts everywhere; B M accepts all members of L; C M rejects all nonmembers; D M accepts every member and rejects every nonmember.

Approach

A decider must be both correct and terminating on every input.

Step-by-step solution

1. A decision procedure answers the membership question for every finite binary input. When the input belongs to L the answer must be acceptance, and otherwise it must be rejection.
2. Both accepting and rejecting are halting outcomes. Thus D guarantees termination on every input as well as the correct result, and exactly captures the definition.
3. A alone permits an always-accept machine even when L is a proper subset of {0,1}*. B permits accepting nonmembers too, or failing to halt on them. C permits wrongly rejecting members or looping on them.
4. Therefore D is necessary and sufficient. A recognizer need only accept precisely the members, and may loop on nonmembers; a decider has the additional total-halting requirement.

Original paper, page 12 · Answer key

2 marks · MCQ
Report issue

Nonhalting behavior of a two-state Turing machine

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

1 mark · MCQ
Report issue

An uncountable collection of languages

Turing Machines

Question 3.4, GATE 1997: Over{a, b}, which is uncountable: all finite strings, all languages, regular languages, or Turing-recognizable languages?
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Finite strings can be enumerated by length and lexicographic order, so Σ* is countably infinite. All languages form its power set P(Σ*), which is uncountable by Cantor’s theorem. In contrast, finite automata and Turing machines each have finite descriptions over a finite alphabet, so there are only countably many of either and hence only countably many languages they describe. Thus B. The distinction is between elements that are strings and arbitrary sets of those strings.

Original paper, page 3

5 marks · Descriptive
Report issue

Constant-workspace machines recognize regular languages

Turing Machines

Question 17(a), GATE 1991: Prove that Turing machines with a read-only input tape and constant-size work tape recognize exactly the regular languages. Use the standard single input-head model with endmarkers.
Tap to enlarge
Answer & solution

Answer: Exactly the regular languages: finite workspace folds into finite control, giving a two-way finite automaton, and two-way finite automata recognize regular languages. (no official key was published)

For the easy direction, let L be regular and choose a DFA for L. A Turing machine stores the DFA state in its finite control, scans the read-only input from left to right, and accepts exactly when the simulated DFA ends in an accepting state. It needs no growing work tape, hence satisfies the constant-space requirement.

For the other direction, let the machine use at most c work cells, where c is independent of input length. If the work alphabet is Γ and the finite control has q states, the work contents and work-head location together have at most |Γ|^c·O(c) possibilities. Fold these possibilities into the control state. This gives a finite-state device whose only unbounded feature is the position of its single head on the read-only input. It is a two-way finite automaton, not immediately an ordinary one-way DFA: treating input-head position as a fixed finite state would be an error.

Here is why two-way motion does not add language power. For any finite input block, summarize its behavior by a finite relation recording which control state and side can enter the block and which control state and side can next exit it, together with whether acceptance can be reached before exit. There are finitely many such boundary-state combinations, so only finitely many possible block summaries, regardless of block length. Infinite internal loops yield no exit or acceptance in the summary.

The summary of a concatenation uv is determined solely by the summaries of u and v: connect their touching boundaries and compute reachability through the finite interface graph, allowing repeated crossings. Each symbol has its own summary. A one-way DFA can therefore read symbols from left to right, retaining the accumulated block summary as its state and updating it by this finite composition. With the endmarkers included, its accepting states are exactly the summaries allowing the original initial state to reach acceptance. This constructs a finite recognizer for the same language. For nondeterministic machines use existential reachability in the same summaries; a finite relation still suffices.

Thus the constant-workspace machine cannot recognize any nonregular language, and both containments establish equality. The standard assumptions exclude multiple independent input heads or writable unbounded input cells, which would invalidate this reduction.

Original paper, page 8