1.

The RE in which any number of 0′s is followed by any number of 1′s followed by any number of 2′s is?(a) (0+1+2)*(b) 0*1*2*(c) 0* + 1 + 2(d) (0+1)*2*This question was addressed to me by my college professor while I was bunking the class.The above asked question is from Regular Expression in portion Compiler Introduction of Compiler

Answer» RIGHT answer is (b) 0*1*2*

The best explanation: The order for the desired STRING is 012 and for any number of 0s we write 0* for any number of 1S we DENOTE it by 1* and similarly for 2*.THUS 0*1*2*.


Discussion

No Comment Found

Related InterviewSolutions