GATE CS 2024 Set 2 — Question 22

MCQ+1 / -0.33MediumDFA to REFinite Automata & Regular LanguagesTheory of Computation

Theory of Computation → Finite Automata & Regular Languages → DFA to RE

Last updated

Question

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

A.
01(0+101)0^*1(0 + 10^*1)^*
B.
0(1011)00^*(10^*11)^*0^*
C.
01(0101)00^*1(010^*1)^*0^*
D.
0(1+0101)00(1 + 0^*10^*1)^*0^*

Correct answer

(A) 0^ 1(0 + 10^ 1)^

Solution

The DFA has two states. Let the start state be q0q_0 and the accepting state be q1q_1.
Transitions:
  • q00q0q_0 \xrightarrow{0} q_0
  • q01q1q_0 \xrightarrow{1} q_1
  • q10q1q_1 \xrightarrow{0} q_1
  • q11q0q_1 \xrightarrow{1} q_0
We want to find the regular expression for strings accepted by this DFA (ending in q1q_1).
Path analysis:
1.To reach q1q_1 from q0q_0 for the first time, we must read any number of 0s followed by a 1: 010^*1.
2.Once in q1q_1, we can stay in q1q_1 by reading 0s (00^*) or by going back to q0q_0 and returning to q1q_1. The path q1q0q1q_1 \to q_0 \to q_1 corresponds to reading a 1, then any number of 0s (loop at q0q_0), then a 1. So, the cycle is 10110^*1.
3.Therefore, from q1q_1, we can loop any number of times using either 00 or 10110^*1. This corresponds to (0+101)(0 + 10^*1)^*.
Combining these, the total regular expression is the concatenation of the initial path and the loop:
L=01(0+101)L = 0^*1(0 + 10^*1)^*This matches option (A).

More questions on Finite Automata & Regular Languages

Practice GATE CS PYQs with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free