GATE Computer ScienceVery hardGATE CSE · ISRO
A DFA over {a, b} has states 0–4, start 0 and accepting states {2, 4}. Transitions (on a, b): 0:(1,2), 1:(2,0), 2:(3,3), 3:(4,1), 4:(4,0). How many strings of length 10 does it accept?
- A. 433
- B. 392
- C. 409
- D. 469
Correct answer: C. 409
Propagate the number of strings reaching each state for 10 steps (transfer-matrix power) and add the counts of states 2 and 4: 409.
More Theory of Computation questions
- Over {a, b}, L = { w : the number of a's in w is ≡ 1 (mod 4) and |w| ≡ 3 (mod 6) }. How many states does the minimal DFA of L have?
- A DFA over {0,1} has states p0 (start), p1, p2, A (accepting), D. Transitions: p0 –0,1→ p1; p1 –0,1→ p2; p2 –1→ A; p2 –0→ D; A –0,1→ A; D…
- How many strings of length 12 over {a, b} contain neither aba nor bbb as a substring?
- Consider the grammar S → aSbS | bS | ε over {a, b}. How many strings of length exactly 9 does it generate?
- The grammar S → SS | aS | a is used to parse the string a⁶ (six a's). How many different parse trees does a⁶ have?
- A Turing machine (blank B, halts when no rule applies or in state acc) has rules: q0: a→(q1,B,R), b→(q2,B,R), B→(acc,B,S); q1 and q2…