Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Theory of Computation
  • Context-free grammars
  • Medium

A grammar is in Chomsky Normal Form. How many production applications does a derivation of a string of length n≥1n \ge 1 use?

Context-Free Languages

Pick an option to check your answer.

In CNF every rule is A→BCA \to BC or A→aA \to a. Growing from one variable to nn variables takes n−1n - 1 applications of A→BCA \to BC, and turning the nn variables into terminals takes nn applications of A→aA \to a. The total is (n−1)+n=2n−1(n - 1) + n = 2n - 1.

Why not the others

  • nn counts only the terminal rules.
  • 2n2n adds one step too many.
  • n−1n - 1 counts only the binary rules.

Report an error

GATE CS · Theory of Computation · Context-Free Languages