Consider the following deterministic finite automaton (DFA) defined over the…

2025

Consider the following deterministic finite automaton (DFA) defined over the alphabet, \(Ξ£ = \{π‘Ž, 𝑏\}\). Identify which of the following language(s) is/are accepted by the given DFA.

  1. A.

    The set of all strings containing an even number of \(𝑏\)’s.

  2. B.

    The set of all strings containing the pattern \(π‘π‘Žπ‘\).

  3. C.

    The set of all strings ending with the pattern \(π‘π‘Žπ‘\).

  4. D.

    The set of all strings not containing the pattern \(π‘Žπ‘π‘Ž\).

Attempted by 32 students.

Show answer & explanation

Correct answer: C

Final answer: The DFA accepts exactly the set of all strings that contain an even number of b's.

Reasoning: the automaton effectively tracks the parity of the number of b's seen so far.

  • Start/accepting state = even number of b's observed so far (including zero).

  • Reading an a does not change parity: transitions on a stay within the same parity class, so a's do not affect acceptance.

  • Reading a b toggles parity: each b moves the machine between the even and odd parity states. Therefore acceptance depends solely on whether the total number of b's is even.

Examples (to build intuition):

  • Accepted: the empty string (0 b's), "aa" (0 b's), "bb" (2 b's), "abaabb" (2 b's).

  • Rejected: "b" (1 b), "ab" (1 b), "bba" (1 b), "bbab" (3 b's).

Why the other described languages do not match the DFA:

  • The property "contains the substring 'bab'": not equivalent. Counterexample: "bbab" contains 'bab' but has three b's and is rejected.

  • The property "ends with 'bab'": not equivalent. Counterexample: "bbab" ends with 'bab' but is rejected since it has an odd number of b's.

  • The property "does not contain 'aba'": not equivalent. Counterexample: "b" does not contain 'aba' but is rejected because it has an odd number of b's.

Conclusion: The DFA accepts exactly those strings over {a, b} whose total number of b's is even.

A video solution is available for this question β€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir