Consider the CFG with {S,A,B) as the non-terminal alphabet, {a,b) as the…

PYQ GATE 2007

Consider the CFG with {S,A,B) as the non-terminal alphabet, {a,b) as the terminal alphabet, S as the start symbol and the following set of production rules

S --> aB        S --> bA
B --> b         A --> a
B --> bS        A --> aS
B --> aBB       A --> bAA

Which of the following strings is generated by the grammar?

  1. A.

    aaaabb

  2. B.

    aabbbb

  3. C.

    aabbab

  4. D.

    abbbba

Attempted by 84 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…