The smallest finite automaton that accepts the language {x | length of x is…

2002

The smallest finite automaton that accepts the language {x | length of x is divisible by 3} has:

  1. A.

    2 states

  2. B.

    3 states

  3. C.

    4 states

  4. D.

    5 states

Attempted by 39 students.

Show answer & explanation

Correct answer: B

For the language of strings whose length is divisible by 3, the automaton must remember the current length modulo 3. Use three states: q0 for length 0 mod 3, q1 for length 1 mod 3, and q2 for length 2 mod 3. On each input symbol, move q0 -> q1 -> q2 -> q0. The accepting state is q0. These three remainder classes are distinguishable, so fewer than 3 states cannot work. Therefore, the smallest finite automaton has 3 states.

Explore the full course: Gate Guidance By Sanchit Sir