1.

How many strings of length less than 4 contains the language described by the regular expression (x+y)*y(a+ab)*?(a) 7(b) 10(c) 12(d) 11This question was addressed to me in an interview for job.My enquiry is from Regular Language & Expression in section Regular Expressions and Languages of Automata Theory

Answer»

Right answer is (c) 12

Explanation: string of length 0 = Not possible (because y is ALWAYS present).

string of length 1 = 1 (y)

string of length 2 = 3 (XY,YY,ya)

string of length 3 = 8 (XXY,xyy,yxy,yyy,YAA,yab,xya,yya)



Discussion

No Comment Found

Related InterviewSolutions