Last Updated :
13 Dec, 2018
Which of the following regular expressions generate(s) no string with two consecutive 1’s? (Note that ε denotes the empty string.)
I. (1 + ε)(01 + 0)*
II. (01+10)*
III. (0+1)*(0+ε)
(A) I only
(B) II only
(C) II and III only
(D) I and III only
Answer: (A)
Explanation: Regular expression (I) can not generate string that has two consecutive 1’s.
Regular expression (II) can generate stings that has two consecutive 1\’s, e.g., 0110, 01100110 etc.
Regular expression (III) can generate stings that has two consecutive 1\’s, e.g., 11, 110, 011, 0111 etc.
So, option (A) is correct.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...