Skip to content
Official PYQ · 2002

GATE CS 2002 Q2.13 — Regular Expressions and Finite Automata

Explain with AI

The smallest finite automaton which accepts the language {x∣\{x \mid length of xx is divisible by 3}3\} has

Choose one option
View worked solution

Answer: B

The language is defined as L={x∣∣x∣(mod3)=0}L = \{x \mid |x| \pmod 3 = 0\}, where ∣x∣|x| denotes the length of the string xx.

To determine the number of states in the minimal finite automaton (DFA) accepting LL, we can track the length of the input string modulo 33. There are three possible remainders when the length is divided by 33:

  • Remainder 0: ∣x∣≡0(mod3)|x| \equiv 0 \pmod 3 (represented by state q0q_0)
  • Remainder 1: ∣x∣≡1(mod3)|x| \equiv 1 \pmod 3 (represented by state q1q_1)
  • Remainder 2: ∣x∣≡2(mod3)|x| \equiv 2 \pmod 3 (represented by state q2q_2)

Since we want to accept strings whose length is divisible by 33, the start state q0q_0 is also the only accepting (final) state.

The transition function δ\delta for any alphabet symbol a∈Σa \in \Sigma is defined as:

  • δ(q0,a)=q1\delta(q_0, a) = q_1
  • δ(q1,a)=q2\delta(q_1, a) = q_2
  • δ(q2,a)=q0\delta(q_2, a) = q_0

Since all three states are reachable and represent distinct equivalence classes under the Myhill-Nerode relation (as ϵ∈L\epsilon \in L, a∉La \notin L, and aa∉Laa \notin L), the minimum number of states required is exactly 33.

Therefore, the correct option is B.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular Expressions and Finite Automata questions