All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · September 2022

Consider the grammar G: S → AbB, A → aAb | λ, B → bB | λ. Which language does G generate?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. {aⁿbᵐ : n ≥ 0, m > n}

Explanation

A gives aⁿbⁿ, then a mandatory b, then B gives any number of b's: aⁿ b^(n+1+k). So m > n, n ≥ 0.

More Theory of Computation and Compilers questions