Question

Which one of the following regular expressions is equivalent to the language accepted by the DFA given below?

A 2-state DFA where the left initial state has a self-loop on 0 and a transition on 1 to the right accepting state, which has a self-loop on 0 and a transition on 1 back to the left state.
Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2024 answer key

Solution

Convert the 2-state DFA (which accepts strings with an odd number of 1s) into a regular expression using Arden's theorem or state elimination.

Let the initial (left) state be q0q_0 and the accepting (right) state be q1q_1.

  • From q0q_0, the DFA reads any number of 0s (0∗0^*) and transitions to q1q_1 on reading the first 1 (0∗10^*1).
  • Once in the accepting state q1q_1, the DFA can return to q1q_1 any number of times either by reading 0 directly (self-loop on q1q_1) or by reading 1 (moving to q0q_0), any number of 0s (0∗0^*), and another 1 (returning to q1q_1), which corresponds to (0+10∗1)∗(0 + 10^*1)^*.

Hence the regular expression for the language accepted by the DFA is 0∗1(0+10∗1)∗0^*1(0 + 10^*1)^*.

Final answer

Option (A)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2024 Computer Science and Information Technology - Set 2 (CS2)
Question
22 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.