• retagged by
39,300 views
57 57 votes

Which one of the following regular expressions represents the set of all binary strings with an odd number of $1’$s?

  1. $((0+1)^*1(0+1)^*1)^*10^*$
  2. $(0^*10^*10^*)^*0^*1$
  3. $10^*(0^*10^*10^*)^*$
  4. $(0^*10^*10^*)^*10^*$

3 Answers

Best answer
67 67 votes
Regular expression in option A cannot generate $001$
Regular expression in option B cannot generate $100$
Regular expression in option C cannot generate $001$
Regular expression in option D cannot generate $001$

Hence, mark was given to everyone in GATE for this question.
• selected by
6 6 votes
Taking each option 1-by-1:

Option A:  it is not generate 01 which has odd number of 1.

Option B: it is not generate 10 which has odd number of 1.

option C: it is not generate 01 which has odd number of 1 i.e. force to start with 1 only.

Option D is also not generate 01.

So none of them is correct
• edited by
3 3 votes
[(0+1)*1(0+1)*1]*10* cannot generate "01".

(0*10*10*)*0*1 cannot generate "10"

10*(0*10*10*)* cannot generate "01"

(0*10*10*)*10* cannot generate "01".

All given options are wrong. No option generates the set of all binary strings with an odd number of 1's. The following expressions represents the set of all binary strings with odd number of 1's.

I. (0*10*10*)0*10*

II. 0*10*(0*10*10*
Answer:
Position:
Show:

Related questions

61 61 votes
4 answers 4 answers
25.3k
25.3k views
Arjun asked Feb 12, 2020
25,284 views
Consider a double hashing scheme in which the primary hash function is $h_1(k)= k \text{ mod } 23$, and the secondary hash function is $h_2(k)=1+(k \text{ mod } 19)$. Ass...
39 39 votes
4 answers 4 answers
22.0k
22.0k views
Arjun asked Feb 12, 2020
21,961 views
Consider the following statements.If $L_1 \cup L_2$ is regular, then both $L_1$ and $L_2$ must be regular.The class of regular languages is closed under infinite union....
61 61 votes
8 answers 8 answers
31.7k
31.7k views
Arjun asked Feb 12, 2020
31,694 views
Consider the language $L = \{a^{n}\mid n \geq 0\} \cup \{a^{n}b^{n}\mid n \geq 0\}$ and the following statements.$L$ is deterministic context-free.$L$ is context-free but...
54 54 votes
10 answers 10 answers
28.3k
28.3k views
Arjun asked Feb 12, 2020
28,318 views
Which of the following languages are undecidable? Note that $\left \langle M \right \rangle$ indicates encoding of the Turing machine M.$L_1 = \{\left \langle M \right \r...