GateAI
Regular Expressions and Finite Automata

GATE CSE 2014 Set 2 · Q36

MCQ2 marksHard

Time

Let L1={w∈{0,1}∗∣w has at least as many occurrences of (110)’s as (011)’s}L_1 = \{w \in \{0,1\}^* \mid w\text{ has at least as many occurrences of } (110)\text{'s as } (011)\text{'s}\}. Let L2={w∈{0,1}∗∣w has at least as many occurrences of (000)’s as (111)’s}L_2 = \{w \in \{0,1\}^* \mid w\text{ has at least as many occurrences of } (000)\text{'s as } (111)\text{'s}\}. Which one of the following is TRUE?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) L1 is regular but not L2

Regular Expressions and Finite Automata

### Analysis of L1L_1: Notice that any transition from a block of consecutive 11's to a block of consecutive 00's requires the substring 110110 (if preceded by at least two 11's), and any transition from 00 to a block of 11's requires 011011 (if followed by at least two 11's).

More precisely, in any string ww, occurrences of 011011 and 110110 alternate:

  • An occurrence of 011011 indicates entering a block of at least two 11's from a 00.

  • An occurrence of 110110 indicates leaving a block of at least two 11's to a 00.

Because they strictly alternate, the count of (110)(110) and the count of (011)(011) in any string ww can differ by at most 11:

count(110)−count(011)∈{−1,0,1}\text{count}(110) - \text{count}(011) \in \{-1, 0, 1\}

Since the difference between the two counts is bounded by a constant independent of string length, a finite automaton can keep track of the current difference using a finite number of states. Thus, L1L_1 is regular.

---

### Analysis of L2L_2: In L2L_2, occurrences of 000000 and 111111 can overlap arbitrarily within long runs:

  • A run of nn zeros (0n0^n) contains n−2n - 2 occurrences of 000000.

  • A run of mm ones (1m1^m) contains m−2m - 2 occurrences of 111111.

Consider the family of strings w=0n1mw = 0^n 1^m. The condition becomes (n−2)≥(m−2)  ⟹  n≥m(n - 2) \ge (m - 2) \implies n \ge m. Using the Pumping Lemma, if we intersect L2L_2 with the regular language 0∗1∗0^* 1^*, we get {0n1m∣n≥m}\{0^n 1^m \mid n \ge m\}, which requires an unbounded counter and is non-regular. Therefore, L2L_2 is not regular.

Thus, L1L_1 is regular but not L2L_2 (Option A).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Regular Expressions and Finite Automata previous year question is Q36 of the GATE CSE 2014 Set 2 paper. Find more GATE CSE PYQs on Regular Expressions and Finite Automata in Theory of Computation, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Regular Expressions and Finite Automata PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Regular Expressions and Finite Automata in GATE CSE

Regular Expressions and Finite Automata has 41 GATE CSE PYQs across 24 papers from 2011 to 2026. 10 of them are 2-mark MCQs like this one, and GATE CSE 2014 Set 2 has 2.

How GATE tests Regular Expressions and Finite Automata

More from GATE CSE 2014 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2014 Set 2 · Q36 · MCQ

Let L1 = {w ∈ {0,1}* w has at least as many occurrences of (110)'s as (011)'s}. Let L2 = {w ∈ {0,1}* w has at least as many occurrences of (000)'s as (111)'s}. Which one of the following is TRUE?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.