Let L = { w ∈ ( 0 + 1 ) * | w has even number of 1s } , i.e. L is the set of all bit strings with even number of 1s. Which one of the regular expressions below represents L?

(A) (0*10*1)* (B) 0*(10*10*)*

(C) 0*(10*1*)*0* (D) 0*1(10*1)*10*

ANSWER : B

Explanation :

A) It will not generate all the string with even number of 1's. This will accept the string which must ends with 1, so string 1010 will not be accepted by this language.

C) This will accept some string which will not contain even number of 1's. ex-010

D) String containing zero only will not be allowed by this language. ex- 000

a is not generating string with 0 number of 1s

c. generate string with odd number of 1s

d.is not generating string with 0 number of 1s

so ans is B

## Pages