Skip to content
Official PYQ · 1996

GATE CS 1996 Q1.8 — Regular Expressions and Finite Automata

Explain with AI

Which two of the following four regular expressions are equivalent? (ε\varepsilon is the empty string).

  1. (00)∗(ε+0)(00)^ * (\varepsilon +0)
  2. (00)∗(00)^*
  3. 0∗0^*
  4. 0(00)∗0(00)^*
Choose one option
View worked solution

Answer: C

Let us analyze the language generated by each regular expression over the alphabet {0}\{0\}:

  1. (00)∗(ε+0)(00)^*(\varepsilon + 0): The term (00)∗(00)^* generates all even-length strings of 00s: {ε,00,0000,… }\{\varepsilon, 00, 0000, \dots\}. Concatenating this with (ε+0)(\varepsilon + 0) gives: (00)∗(ε+0)=(00)∗ε+(00)∗0=(00)∗+(00)∗0(00)^*(\varepsilon + 0) = (00)^*\varepsilon + (00)^*0 = (00)^* + (00)^*0 Since (00)∗(00)^* generates all even-length strings and (00)∗0(00)^*0 generates all odd-length strings, their union generates all possible strings of 00s: {ε,0,00,000,… }=0∗\{\varepsilon, 0, 00, 000, \dots\} = 0^*.
  2. (00)∗(00)^*: Generates only even-length strings of 00s: {ε,00,0000,… }\{\varepsilon, 00, 0000, \dots\}.
  3. 0∗0^*: Generates all strings of 00s of any length: {ε,0,00,000,… }\{\varepsilon, 0, 00, 000, \dots\}.
  4. 0(00)∗0(00)^*: Generates only odd-length strings of 00s: {0,000,00000,… }\{0, 000, 00000, \dots\}.

Thus, expressions (i) and (iii) both represent the language 0∗0^* and are equivalent.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular Expressions and Finite Automata questions