GATE Computer ScienceVery hardGATE CS (PYQ pattern)
A DFA reads ternary numerals over {0, 1, 2}, most significant digit first (leading zeros allowed; ε has value 0 and is accepted), and accepts iff the value is divisible by 6. How many states does the minimal DFA have?
- A. 6
- B. 4
- C. 3
- D. 2
Correct answer: C. 3
Value ≡ 0 (mod 6) ⇔ divisible by 3 (last digit is 0, or ε) and even (3 ≡ 1 mod 2, so the parity of the value equals the parity of the digit sum). A state needs (parity, last digit is 0?); but once the parity is odd the last digit no longer matters for any future, so odd/0 and odd/non-0 merge. States: even & last 0 (accepting, start), even & last ≠ 0, odd — 3 states, not the 6 of a mod-6 counter.
More Theory of Computation questions
- 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?
- 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…