Computer Science EngineeringHard

For the grammar S -> aSb | ab, how many derivation steps produce the string aaabbb?

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

Correct answer: B. 3

Two applications of S -> aSb followed by one of S -> ab give 3 steps.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic