GATE Computer ScienceModerateGATE CS

A grammar G in Chomsky Normal Form (no ε-production) generates a string w of length 9. How many derivation steps does any derivation of w use?

  1. A. 16
  2. B. 18
  3. C. 9
  4. D. 17

Correct answer: D. 17

Each binary rule A → BC adds one symbol to the sentential form and there are n − 1 = 8 of them to reach 9 variables; then 9 terminal rules A → a convert them. Total 8 + 9 = 2n − 1 = 17.

More Theory of Computation questions

Exams that ask this topic