GATE Computer ScienceHardGATE CSE · ISRO
How many strings of length at most 5 over {0, 1} (the empty string included) contain the substring 00 and also have an even number of 1s?
- A. 19
- B. 16
- C. 12
- D. 24
Correct answer: B. 16
Enumerating lengths 0 to 5 and testing both conditions gives 16 strings.
More Theory of Computation questions
- A grammar in Chomsky normal form generates a string of length 17. How many derivation steps (production applications) does any derivation…
- Consider the grammar S → aSb | bSa | SS | ε. How many strings of length exactly 8 does it generate?
- For a Turing machine M given as input, which one of the following problems is decidable?
- Let L be the set of strings over {a, b} whose second symbol from the right is a, and which also satisfy: the last symbol is b, or the…
- Over {a, b, c}, let L = {aⁱbʲcᵏ : i = j} ∪ {aⁱbʲcᵏ : j = k} (i, j, k ≥ 0). How many strings of length at most 12 belong to L?
- Let A ≤ₘ B denote a many-one (mapping) reduction from A to B. How many of the following hold for all A, B? (i) B decidable ⇒ A decidable…