GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 46

GATE CSE 2015 Set 2 Q46

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q46 2 marks · MCQ
Report issue

Regular Expressions & Languages

Question 46, GATE 2015: Which languages are regular? L1={wxw^R:w, x∈{a, b}*, |w|, |x|>0}; L2={a^n b^m:m≠n, m, n≥0}; L3={a^p b^q c^r:p, q, r≥0}. A L1, L3; B L2 only; C L2, L3; D L3 only.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

L1 consists exactly of length≥3 strings with equal first/last symbols: choose the one-symbol w and nonempty interior x. Its regex is a(a+b)(a+b)*a + b(a+b)(a+b)*b, so regular. If L2 were regular, subtracting it from a*b* would make{an bn} regular, contradiction. L3=a*b*c* is regular. Thus L1, L3, A.

In L1, the first and last symbols must agree because w and its reversal surround x. Conversely, any length≥3 string with equal ends can choose a one-symbol w and the nonempty middle as x, so that simple description is exact and regular. L2 is the unequal-count complement within a*b*. If it were regular, subtracting it from regular a*b* would make the equal-count language regular, contradicting its pumping argument. L3 has the direct regular expression a*b*c*. Thus A contains exactly the regular choices.

Original paper, page 41 · Answer key