GATE Computer ScienceVery hardGATE CS (PYQ pattern)
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); δ(q2,Y) = (q2,Y,L); δ(q2,X) = (q0,X,R); δ(q3,Y) = (q3,Y,R); δ(q3,B) = (qa,B,R) starts in q0 on the leftmost cell (blank B) and accepts at qa. How many moves does it make before accepting aaabbb?
- A. 25
- B. 19
- C. 30
- D. 18
Correct answer: A. 25
Each of the 3 rounds marks the first remaining a as X and the first b as Y, then returns left; the quadratic total including the final scan is 25 moves by simulation.
More Theory of Computation questions
- 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…
- Which of the following statements are correct? I. Every context-free language over a one-letter alphabet is regular. II. { a^(2ⁿ) : n ≥ 0…