GATE Computer ScienceHardGATE CS (PYQ pattern)

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 states does the minimal DFA have?

  1. A. 8
  2. B. 4
  3. C. 3
  4. D. 9

Correct answer: B. 4

Value mod 8 is the last three bits, with missing high bits read as 0. So the DFA only follows progress towards the pattern 011, where the start already counts as having seen a 0 (hence 11 alone, value 3, is accepted). Classes: last bit 0 or ε (start); …01 or 1 alone; …011 or 11 alone (accepting); …111. These 4 are distinct, so 4 states, not 8 residues.

More Theory of Computation questions

Exams that ask this topic