Given productions of grammar G :
S → aSb / X
X → aX / Xb / a / b
NOTE : While finding the expression for any given Grammar G, always try to solve in bottom up fashion.
For X : In X, any number of a & b can occur and when we wish to terminate, we have choice
between a & b.
So, X → $a^{m}(a+b) / (a+b)b^{p}$ $(m \geq 0, p \geq 0)$
Replace this X in above productions. Then productions will look like this :
S → aSb / $a^{m}(a+b) / (a+b)b^{p}$.
For S : Let’s first analyze S → aSb
S → aSb
S → aaSbb
S → aaaSbbb
This is simply, $a^{n}b^{n}$ ($n\geq 1$). Let’s Substitute this :
S → $a^{n}a^{m}(a+b)b^{n} / a^{n}(a+b)b^{p}b^{n}$
This can further be simplified as : $a^{*}(a+b)b^{*}$
Option B, is correct answer.