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
GATE CSE 2014 Set 2 · Q36
Time
Select one answerSingle correct
Solution
Official answer: A) L1 is regular but not L2
Regular Expressions and Finite Automata### Analysis of : Notice that any transition from a block of consecutive 's to a block of consecutive 's requires the substring (if preceded by at least two 's), and any transition from to a block of 's requires (if followed by at least two 's).
More precisely, in any string , occurrences of and alternate:
An occurrence of indicates entering a block of at least two 's from a .
An occurrence of indicates leaving a block of at least two 's to a .
Because they strictly alternate, the count of and the count of in any string can differ by at most :
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, is regular.
---
### Analysis of : In , occurrences of and can overlap arbitrarily within long runs:
A run of zeros () contains occurrences of .
A run of ones () contains occurrences of .
Consider the family of strings . The condition becomes . Using the Pumping Lemma, if we intersect with the regular language , we get , which requires an unbounded counter and is non-regular. Therefore, is not regular.
Thus, is regular but not (Option A).
Try the question first, then check your work.
Examiner trap
Check whether the difference between occurrences of and can grow arbitrarily large or if they must strictly alternate. Then check whether a long run of identical bits can create an unbounded number of 's without any 's.
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
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.
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 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 AutomataIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.