Let L = { w | w is a binary string with an even number of 1s }. Which of the following REs represents L?
a.0* (1 0* 1*)* 0*
b.0* 1 (1 0* 1)* 1 0*
c.(0* 1 0* 1)*
d.0* + (0*1 0* 1 0*)*
The answer to the above question is:
d.0* + (0*1 0* 1 0*)*
Explanation:
In option (a), there is a possibility of getting odd number of 1s
In option (b), there will be a 11 form and other forms are not supported
In option (c), the number of 1s will be even but there is no possibility of just 0s and no 1s i.e, only zeroes and no ones(zero 1s is also even)
In option (d), there can be 0s and no 1s (zero 1s is also even) and if there are 1s they will always be even
Thats why option (d) is the correct answer.
Get Answers For Free
Most questions answered within 1 hours.