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?
- A. 8
- B. 6
- C. 7
- 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
- A TM with rules δ(q0,a) = (q1,X,R); δ(q0,Y) = (q3,Y,R); δ(q1,a) = (q1,a,R); δ(q1,Y) = (q1,Y,R); δ(q1,b) = (q2,Y,L); δ(q2,a) = (q2,a,L)…
- A single-tape TM (blank B, start q0 on the leftmost cell, accepting state qa) has rules: δ(q0,0) = (q1,B,R); δ(q0,1) = (q4,B,R); δ(q0,B) =…
- For the palindrome-checking TM with rules δ(q0,0) = (q1,B,R); δ(q0,1) = (q4,B,R); δ(q0,B) = (qa,B,R); δ(q1,0) = (q1,0,R); δ(q1,1) =…
- The grammar S → aSBC | aBC; CB → BC; aB → ab; bB → bb; bC → bc; cC → cc generates { aⁿbⁿcⁿ : n ≥ 1 }. How many derivation steps does EVERY…
- Which of the following productions cannot appear in a context-sensitive (non-contracting) grammar?
- A grammar has productions S → aS | bA | ε; A → aA | b. Which is the most restricted class of the Chomsky hierarchy that the grammar…