GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Binary strings are read LSB first (the leftmost symbol is the least significant bit; ε has value 0 and is accepted). How many states does the minimal DFA accepting exactly the multiples of 12 have?

  1. A. 6
  2. B. 5
  3. C. 12
  4. D. 7

Correct answer: A. 6

Divisible by 12 ⇔ the two lowest bits are 0 and the rest is divisible by 3. Reading LSB first: ε and '0' are accepting but distinct (after ε a 1 is fatal, after 0 the string 01 is fatal but 001 is not); a 1 among the first two bits leads to a dead state. After 00 the remaining bits have weights ≡ 1, 2, 1, 2, … (mod 3), so the core tracks value mod 3 together with position parity, but (r, even) ≡ (2r, odd) and these 6 pairs collapse to 3 classes. Total 2 + 1 + 3 = 6 (MSB first would give 5).

More Theory of Computation questions

Exams that ask this topic