GATE Computer ScienceHardGATE CSE
How many strings of length 8 over {a, b} contain aa as a substring but do not contain bb as a substring?
- A. 55
- B. 48
- C. 53
- D. 61
Correct answer: C. 53
Strings with no bb number F(10)=55; among them subtract those with no aa either, i.e. alternating strings (2). Direct enumeration gives 53.
More Theory of Computation questions
- An NFA with ε-moves over {a, b} has states 0–4, start 0 and accepting state 4. Transitions: 0 –ε→ 1, 2 –ε→ 3; δ(0,a) = {0}; δ(1,b) = {2}…
- The grammar S → SS | a | b is ambiguous. How many distinct parse trees does it give for the string ababa?
- How many strings of length 8 does the grammar S → aSb | bSa | SS | ε generate?
- Consider these statements. I. Deterministic context-free languages are closed under complementation. II. Deterministic context-free…
- For a Turing machine M given as input, how many of these properties are undecidable? (a) L(M) = ∅ (b) M has at least 5 states (c) L(M)…
- Which of the following languages over {0, 1} is regular?