GATE / CS ARCHIVE

GATE CSE 2014 SET 2 / QUESTION 36

GATE CSE 2014 Set 2 Q36

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

GATE 2014 Set 2, Q36 2 marks · MCQ
Report issue

Regular Expressions & Languages

Question 36, GATE 2014: L1 consists of binary strings with at least as many occurrences of substring 110 as 011. L2 consists of binary strings with at least as many occurrences of 000 as 111. Which is true? A L1 regular, L2 not; B L2 regular, L1 not; C both regular; D neither regular.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

1. Set up the reasoning. Count overlapping occurrences. For L1, examine maximal runs of at least two 1s: an entering 0 produces one 011 and a leaving 0 produces one 110. Every internal run contributes one of each.

2. Derive the result. For each maximal run of at least two 1s, an entering 0 contributes one 011 and a leaving 0 contributes one 110. Internal runs cancel; hence #110−#011 equals the indicator that the string starts 11 minus the indicator that it ends 11. A finite automaton can track these boundary facts, so L1 is regular. Intersect L2 with 0³0*1³1*: the resulting language is{0m1n: m≥n≥3}, because occurrences number m−2 and n−2. This is not regular: pumping down a zero in 0p1p violates m≥n. Thus L2 is not regular, A.

3. Check the interpretation. Only boundary runs can leave an imbalance, requiring finite memory. For L2, intersect with the regular pattern 0m1n, m,n≥3; counts become m-2 and n-2, demanding the unbounded comparison m≥n. Pumping zeros down from 0p1p contradicts regularity.

Original paper, page 39 · Answer key