Which of the following definitions generates the same language as L, where L =…

2012

Which of the following definitions generates the same language as L, where
L = { WWᴿ | W ∈ {a, b}* }

  1. A.

    S → aSb | bSa | ε

  2. B.

    S → aSa | bSb | ε

  3. C.

    S → aSb | bSa | aSa | bSb | ε

  4. D.

    S → aSb | bSa | aSa | bSb

Attempted by 12 students.

Show answer & explanation

Correct answer: B

The language L consists of even-length palindromes over {a, b}. The grammar S → aSa | bSb | ε correctly generates this by recursively adding matching characters around a center until the empty string is reached. Other options fail to enforce the palindrome structure or miss required cases like the empty string.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor