Question discussion

The grammar S → aSb | ε generates the language

1736Medium DSSSB TGT Computer Science 0 replies

The grammar S → aSb | ε generates the language

  • A{aⁿbⁿ | n ≥ 0}, which is context-free but not regular
  • B{aⁿbᵐ | n, m ≥ 0}, which is regular
  • C{aⁿbⁿcⁿ | n ≥ 0}, which is context-sensitive
  • D{(ab)ⁿ | n ≥ 0}, which is regular
Correct answer: A

Explanation

Each application of S → aSb adds one a and one b, so the strings are aⁿbⁿ; this language needs a stack to count and is not regular.

Discussion 0

Nobody has replied yet. Start the discussion!