Answer : D

$\color{red}{\text{Method 1(Complete Analysis) :}}$
We have two final states, $Q,R.$
First find the regular expression for set of all strings that end up at the initial state $P$ when running the given $\textsf{NFA}.$ Let’s call this $P.$
Note that $P$ is the initial state, so, NFA execution starts at $P.$ Now, to end up on state $P$ at the end of the string, we can do any of the following, in any order, any number of times :
- Read $’a’$, go to state $Q,$ then read any number of $b’s$, then read $b$ to come back to state $P.$ So, $1 = ab^*b$
- Read $’b’$, go to state $R,$ then read any number of $a’s$, then read $a$ to come back to state $P.$ So, $2= ba^*a$
So, $P = (1+2)^* = [(ab^*b)+(ba^*a)]^*$ (Because we can do $1$ or $2$ in any order, any number of times)
Now, we want to find language of the given NFA $N$, whose final states are $Q,R.$
So, $RegEx(N) = Q + R $
Where $Q$ is the regular expression for set of all strings that end up at the state $Q$ when running the given $\textsf{NFA}$ and $R$ is the regular expression for set of all strings that end up at the state $R$ when running the given $\textsf{NFA}.$
$Q = P ab^*$
$R = Pba^*$
So, $RegEx(N) = Q + R = P ab^* + Pba^* = P(ab^* + ba^*)$
$RegEx(N) = [(ab^*b)+(ba^*a)]^* (ab^* + ba^*)$
Hence, Option D is Correct Answer.
$\color{blue}{\text{Method 2 (Option Elimination) :}}$
Option A :
The Strings $\text{“}a\text{”}$ and $\text{“}b\text{”}$ are accepted by the given NFA BUT these strings are Not generated by the regular expression in Option A. So Option A is wrong.
Option B :
The String $abbbbaa$ is accepted by the given NFA BUT this string is Not generated by the regular expression in Option B. So Option B is wrong.
Option C :
The Empty String is NOT accepted by the given NFA BUT this string is generated by the regular expression in Option C. So Option C is wrong.
Correct answer is D.