edited by
2,247 views
12 votes
12 votes

Which of the following regular expressions correctly accepts the set of all $0/1$-strings with an even (possibly zero) number of $1$s?

  1. $(10^*10^*)^*$
  2. $(0^*10^*1)^*$
  3. $0^*1(10^*1)^*10^*$
  4. $0^*1(0^*10^*10^*)^*10^*$
  5. $(0^*10^*1)^*0^*$
edited by

6 Answers

Best answer
14 votes
14 votes

As, mentioned in the question, the regular expression must accept all strings of $0$ and $1$ but with even no of $1$s (including no $1$s). Hence, $00$ must be in the language. Option A, B, C, D do not accept $00$. Hence, option E is correct.

edited by
6 votes
6 votes

take some random strings and try to eliminate the options
i will take0, 00,1001 ,0011, 1100,1010,0101........etc
 option(E) is able to generate  all the strings  having even no ons's
so E) is correct answer
 

0 votes
0 votes

ans is hidden in the question - 

 even (poossibly zero) number of 1s

In option A & B, epsilon is possible but only 0's are not possible.

In option C & D, we can't get rid from the two 1's.

but in option E all criteria is met.

epsilon, no 1's, even no. of 1's

Answer:

Related questions