GATE Computer ScienceVery hardGATE CS (PYQ pattern)
Let L = { w ∈ {a, b}* : (n_a(w) − 2·n_b(w)) mod 6 ∈ {0, 3} }, where n_a and n_b count the a's and b's. How many states does the minimal complete DFA for L have?
- A. 3
- B. 6
- C. 2
- D. 12
Correct answer: A. 3
A mod-6 counter (a: +1, b: −2 ≡ +4) reaches all six residues, but the accepting set {0, 3} is invariant under adding 3, so residues r and r + 3 accept exactly the same suffixes and merge. Only the residue mod 3 matters, and those 3 classes are pairwise distinguishable (append a's). Answer 3, not the naive 6.
More Theory of Computation questions
- Let L = { w ∈ {a, b} : (2·na(w) + 4·nb(w)) mod 6 = 2 }. How many strings of length exactly 7 belong to L?
- A DFA reads ternary numerals over {0, 1, 2}, most significant digit first (leading zeros allowed; ε has value 0 and is accepted), and…
- Binary strings are read LSB first (the leftmost symbol is the least significant bit; ε has value 0 and is accepted). How many states does…
- Binary strings are read LSB first (the leftmost symbol is the least significant bit; ε has value 0 and is accepted). The minimal DFA for…
- A DFA over {0, 1} reads a binary numeral MSB first (leading zeros allowed, ε has value 0) and accepts iff the value ≡ 3 (mod 8). How many…
- L = { w ∈ {a, b} : (na(w) − nb(w)) ≡ 0 (mod 3) and |w| is even }. How many states does the minimal complete DFA for L have?