GATE Computer ScienceHardGATE CS (PYQ pattern)
A DFA over {a, b} has states 0 to 5, transitions 0: a→2, b→1; 1: a→5, b→4; 2: a→5, b→4; 3: a→3, b→0; 4: a→0, b→3; 5: a→5, b→1. Start 0, accepting {1,3}. How many strings of length at most 5 over {a, b} does it accept (counting the empty string if accepted)?
- A. 30
- B. 14
- C. 63
- D. 21
Correct answer: D. 21
Count accepted strings for each length 0..5 by dynamic programming over the transition table and add them: 21.
More Theory of Computation questions
- A DFA over {a, b} has states 0 to 5, transitions 0: a→4, b→2; 1: a→4, b→2; 2: a→3, b→3; 3: a→5, b→0; 4: a→0, b→5; 5: a→2, b→4. Start 0…
- For a language L, the derivative u⁻¹L is { w : uw ∈ L }. Let L be the language of the regular expression (a + b)abb. Which expression…
- For a language L, the derivative u⁻¹L is { w : uw ∈ L }. Let L be the language of the regular expression (ab + b)a. Which expression…
- For a language L, the derivative u⁻¹L is { w : uw ∈ L }. Let L be the language of the regular expression (a + b)a(a + b)(a + b). Which…
- For a language L, the derivative u⁻¹L is { w : uw ∈ L }. Let L be the language of the regular expression (a + ba)b. Which expression…
- For a language L, the derivative u⁻¹L is { w : uw ∈ L }. Let L be the language of the regular expression (aa + b). Which expression…