5,115 views
1 votes
1 votes
Options are

a) (0*10*1)*

b) 0*(10*10*)

c) 0*(10*1)*0*

d) 0*(10*1)*10*

 

I have doubt in b and c.which one is correct and why.?

6 Answers

0 votes
0 votes

Option b and d is eliminated because it doesn't produce epsilon . Epsilon has also even no of 1's.

Option a can't produce 110. so a is also eliminated.

So Ans is option C

0 votes
0 votes
Option A will accept either epsilon or a string that is ending with 1 only,It may happen that string have even no. of 1's but it is ending with 0,So it won't be right answer.

Option B will generate string having only 2 1's,so it won't be the right answer because we are looking for that solution that may generate even strings having even no. of 1's.

Option C will generate string having even no. of 1's so it will be the correct answer.

Option D will generate string having odd no. of 1's so definitely it is not going to be the right answer.

So,according to me C will be the right Regex for generating string having even no. of 1's.

Correct me if I'm wrong.

Related questions

3 votes
3 votes
2 answers
2
im.raj asked Jun 16, 2016
20,947 views
A. [(00(0+1)* 11] + [11( 0 + 1)* 00]B. [(00+11) (0+1)+] + [( 0 + 1)+ (00+11)].C. [(00+11) (0+1)*] + [( 0 + 1)* (00+11)]D. (00+11) (0+1)* (00+11).
1 votes
1 votes
1 answer
4
radha gogia asked Mar 6, 2016
2,124 views
why do we count here empty string also , it has no 1's , so what's the reason for counting this ?