GATE Computer ScienceHardGATE CS (PYQ pattern)
Over Σ = {a, b, c}, how many strings of length 6 have an even number of a's and do not contain cc?
- A. 448
- B. 224
- C. 365
- D. 243
Correct answer: B. 224
Run the 4-state product DFA (parity of a, last symbol c or not) for 6 steps. Let (E, E') be counts with even a's ending in non-c / c, (O, O') likewise. From any state: a flips parity → non-c; b keeps parity → non-c; c keeps parity → c, allowed only from non-c. Iterating from (E, E', O, O') = (1, 0, 0, 0) gives after 6 steps E + E' = 224 (out of 448 strings with no cc).
More Theory of Computation questions
- Let L = { aⁿ : n = 1, or n ≥ 3 and (n ≡ 2 (mod 4) or n ≡ 3 (mod 6)) }. How many states does the minimal DFA for this unary language have?
- Let L = { aⁿ : n² ≡ 1 (mod 8) }. How many states does the minimal DFA for L have?
- Let L = { aⁿ : n ≥ 5 and n ≡ 1 (mod 3) }. How many states does the minimal DFA for the concatenation L·L have?
- Let L = { w ∈ {a, b} : |w| ≥ 5 and the 5th symbol from the LEFT equals the 1st symbol }. How many states does the minimal complete DFA for…
- L = { aⁿbᵐ : n, m ≥ 0 and n ≡ m (mod 3) }. How many states does the minimal complete DFA for L have?
- Occurrences of aa may overlap (aaa contains two). How many states does the minimal complete DFA for { w ∈ {a, b} : w contains EXACTLY two…