GATE Computer ScienceHardGATE CSE
A single-tape TM (blank B) starts in q0 at the leftmost symbol of a binary string. Rules: δ(q0,0) = (q0,0,R); δ(q0,1) = (q0,1,R); δ(q0,B) = (q1,B,L); δ(q1,1) = (q1,0,L); δ(q1,0) = (qa,1,S); δ(q1,B) = (qa,1,S). Each rule applied is one step and qa halts the machine. For input 1101111, how many steps are executed before it halts?
- A. 12
- B. 14
- C. 16
- D. 13
Correct answer: D. 13
7 right moves, 1 turn at the blank, then the carry flips four 1s to 0 (4 steps) and the final rule writes 1 on the 0: total 13; the tape becomes 1110000.
More Theory of Computation questions
- How many strings of length 10 over {a, b} have no three consecutive equal symbols (neither aaa nor bbb)?
- Over {a, b}, L = { w : w contains aab as a substring and |w| is odd }. What is the number of states in the minimal complete DFA for L?
- Decimal numerals are read most significant digit first (empty string = 0, leading zeros allowed). What is the number of states in the…
- Let L = { w ∈ {a, b} : the third symbol from the right end of w is a }; its minimal complete DFA has 8 states. How many states does the…
- Let L = { a^i b^j c^k : i ≠ j or j ≠ k, i, j, k ≥ 0 }. Which statement is correct?
- A DFA over {a, b} has states 0–3, start 0 and accepting state 3. Transitions: 0 –a→ 1, 0 –b→ 0; 1 –a→ 2, 1 –b→ 0; 2 –a→ 2, 2 –b→ 3; 3 –a→…