we will eliminate a option if
1--The expression can't generate a string accepted by the machine(i.e expression can't generate required number of strings)
OR
2--The expression generates a string not accepted by the machine(i.e expression generates more than the required number of strings)
we will check options:
A--can't generate "baaa" which is accepted by the machine. So eliminated.
B,C,E-- generates string "baaaa" which is not accepted by machine. So eliminated.
So option remaining is D.Hence it is the answer.
How i got the strings to check??
Here there is a epsilon transition from S3 to S4. So in a way it becomes final state(because,once you reach S3 you don't need any symbol to reach final state S4).
To reach S3 or S4 you need the string to end with odd number of a's(since if string ends with even number of a's, then by the end of string, the machine will be in S2).
So the grammar should generate string ending with odd number of a's