GATE 2022 CS – Question 12
Which one of the following regular expressions correctly represents the language of the finite automaton given below?

Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (D) $(ba^*a+ab^*b)^*(ab^*+ba^*)$
Explanation
Each return loop to the start is $ab^*b$ or $ba^*a$, repeated any number of times. The string then ends in either accepting state, via $ab^*$ or $ba^*$. This gives $(ba^*a+ab^*b)^*(ab^*+ba^*)$.