GATE Computer ScienceEasyGATE CS (PYQ pattern)

A DFA over {a, b} has states 0 to 5, transitions 0: a→2, b→0; 1: a→0, b→3; 2: a→2, b→5; 3: a→4, b→2; 4: a→3, b→4; 5: a→4, b→1. Start 0, accepting {1,3,4}. What is the length of the shortest string it accepts?

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

Correct answer: A. 3

A breadth-first search from state 0 reaches an accepting state first at depth 3.

More Theory of Computation questions

Exams that ask this topic