GATE Computer ScienceHardGATE CS (PYQ pattern)

The regular expression ((aa + bb)(ab + ba)*)* is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?

  1. A. 4
  2. B. 5
  3. C. 7
  4. D. 6

Correct answer: D. 6

Read the string in blocks of two: the language is all even-length strings that are empty or whose first 2-block is aa or bb (any later block, aa/bb or ab/ba, is allowed). States: start (accepting), after one symbol a, after one symbol b, inside-language even position (accepting), inside-language odd position, and dead (first block ab or ba). 6 states.

More Theory of Computation questions

Exams that ask this topic