GATE Computer ScienceVery hardGATE CS (PYQ pattern)
L = { w ∈ {a, b}* : (n_a(w) − n_b(w)) ≡ 0 (mod 3) and |w| is even }. How many states does the minimal complete DFA for L have?
- A. 18
- B. 12
- C. 6
- D. 3
Correct answer: C. 6
|w| = n_a + n_b ≡ n_a − n_b (mod 2), so '|w| even' just says the difference is even. Together the conditions say n_a − n_b ≡ 0 (mod 6). The DFA is a mod-6 counter (a: +1, b: −1) with one accepting residue, and all 6 residues are distinguishable: 6 states, not the 3 × 2 product counted twice or the 18 of three separate counters.
More Theory of Computation questions
- Let L = { w ∈ {a, b} : |w| ≥ 3 and the 3rd symbol from the right end equals the last symbol }. How many states does the minimal complete…
- L = { w ∈ {a, b} : the 5th symbol from the right is a AND the 3rd symbol from the right is b } (so |w| ≥ 5). How many states does the…
- L = { w ∈ {a, b} : the 4th symbol from the right is a, OR the 2nd symbol from the right is b }. How many ACCEPTING states does the minimal…
- How many states does the minimal complete DFA have for the set of ODD-length strings over {a, b} that contain neither aba nor bab as a…
- The minimal complete DFA for { w ∈ {a, b} : abab is a substring of w } has how many states?
- Let L = { w ∈ {a, b} : w contains aa as a substring and w contains bb as a substring }. Which pair of strings is equivalent under the…