GATE Computer ScienceModerateGATE CSE
A grammar in Chomsky normal form generates a string of length 17. How many derivation steps (production applications) does any derivation of that string take?
- A. 34
- B. 16
- C. 17
- D. 33
Correct answer: D. 33
In CNF, n−1 = 16 binary productions build the tree and n = 17 terminal productions finish it: 2n − 1 = 33.
More Theory of Computation questions
- 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…
- Consider the grammar S → aSa | bSb | a | b | ε. How many strings of length exactly 7 does it generate?