GATE Computer ScienceVery hardGATE CS (PYQ pattern)
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, accepting {1, 3}. How many of the 32 strings of length 5 does it accept?
- A. 8
- B. 16
- C. 4
- D. 10
Correct answer: A. 8
State 1 is unreachable (nothing enters it), so only state 3 matters. Count strings per state, length by length: n=1: {2:1, 4:1}; n=2: {0:1, 3:2, 5:1}; n=3: {0:2, 2:2, 4:2, 5:2}; n=4: {0:2, 2:4, 3:4, 4:4, 5:2}; n=5: {0:8, 2:4, 3:8, 4:4, 5:8}. State 3 at n = 5 is entered only from state 2, on both letters, so it holds 2·4 = 8 strings.
More Theory of Computation questions
- 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…
- How many strings of length 20 over {a, b} do not contain aaa as a substring?