GATE Computer ScienceModerateGATE CSE · UGC NET

In the grammar S → A B c | d; A → B B | a; B → b | ε; C → A C | ε, how many non-terminals are nullable?

  1. A. 2
  2. B. 3
  3. C. 4
  4. D. 5

Correct answer: B. 3

B is nullable, A → B B is therefore nullable, and C → ε is nullable; S always produces c or d, so 3 non-terminals are nullable.

More Compiler Design questions

Exams that ask this topic