Multiple choice

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$\rightarrow$ a B S $\rightarrow$bA B $\rightarrow$b A$\rightarrow$ a B $\rightarrow$bS A $\rightarrow$aS B $\rightarrow$aBB S$\rightarrow$ bAA

Which of the following strings is generated by the grammar?

  1. aaaabb

  2. aabbbb

  3. aabbab

  4. abbbba

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation