Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Theory of Computation
  • Finite automata
  • Easy

How many states does the minimal DFA have for strings over {a, b} whose length is divisible by 3?

Regular Languages

Pick an option to check your answer.

The DFA only needs the length modulo 3, giving states q0,q1,q2q_0, q_1, q_2, where q0q_0 is both start and accepting. Each symbol moves qi→q(i+1) mod 3q_i \to q_{(i+1) \bmod 3}. All three remainders behave differently, so none can be merged.

Why not the others

  • 2 cannot distinguish remainders 1 and 2.
  • 4 adds an unnecessary dead state — every string has some remainder.
  • 6 wrongly tracks the symbols as well as the length.

Report an error

GATE CS · Theory of Computation · Regular Languages