All mock tests are FREE till 31 December — register to save your progress

Consider the following DFA over Σ = {a, b, c}. Start state q0, which is also the only final state. Transitions:
Stateabc
→* q0q1q0q0
q1q1q2q0
q2q1q0q3
q3q4q3q3
q4q4q5q3
q5q4q3q0
Which of the following is the best description of the language of this DFA?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: D. L = {set of strings having an even count (including 0) of substring 'abc'}

Explanation

States q0, q1, q2 track progress towards 'abc' (q1 after 'a', q2 after 'ab'); reading 'c' in q2 completes an 'abc' and moves to q3. States q3, q4, q5 do the same job, and completing 'abc' from q5 returns to q0. So the machine flips between the two halves each time 'abc' occurs, and accepts (q0) exactly when the number of 'abc' substrings is even, including 0.

More Theory of Computation and Compilers questions