1.

The regular expression denotes a language comprising all possible strings of even length over the alphabet (0, 1).(a) 1 + 0(1+0)*(b) (0+1) (1+0)*(c) (1+0)(d) (00+0111+10)*I have been asked this question at a job interview.Origin of the question is Regular Expression in chapter Compiler Introduction of Compiler

Answer»

The correct answer is (d) (00+0111+10)*

To elaborate: Option 1 + 0(1+0)* → It does not consider even length criteria for the question.

Option (0+1) (1+0)* → It can so HAPPEN here that from the former BRACKET it takes 0 or 1 and takes NULL from the latter then it FORMS a string of odd length

Option (1+0) → It GIVES either 1 or 0.

Hence Option (00+0111+10)* is the answer.



Discussion

No Comment Found

Related InterviewSolutions