GateAI
Regular Expressions and Finite Automata

GATE CSE 2023 · Q63

NAT2 marksEasy

Time

Consider the language LL over the alphabet {0,1}\{0, 1\}, given below: L={w∈{0,1}∗∣w does not contain three or more consecutive 1’s}.L = \{w \in \{0, 1\}^* \mid w \text{ does not contain three or more consecutive 1's}\}. The minimum number of states in a Deterministic Finite-State Automaton (DFA) for LL is __________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 4

Regular Expressions and Finite Automata

The language LL consists of all strings over {0,1}\{0, 1\} that do not contain the substring 111111.

To construct the minimal DFA for LL, we track the number of consecutive 11's at the end of the processed prefix:

  1. State q0q_0 (Start state, Accepting): Represents strings ending in 00 or the empty string ϵ\epsilon (zero consecutive 11's).

    • Transition on 00: goes to q0q_0

    • Transition on 11: goes to q1q_1

  2. State q1q_1 (Accepting): Represents strings ending in a single 11 (one consecutive 11).

    • Transition on 00: goes to q0q_0

    • Transition on 11: goes to q2q_2

  3. State q2q_2 (Accepting): Represents strings ending in 1111 (two consecutive 11's).

    • Transition on 00: goes to q0q_0

    • Transition on 11: goes to q3q_3

  4. State q3q_3 (Dead / Trap state, Non-accepting): Represents strings containing the forbidden substring 111111.

    • Transition on 00: goes to q3q_3

    • Transition on 11: goes to q3q_3

### Myhill-Nerode Equivalence Classes: The prefixes {ϵ,1,11,111}\{\epsilon, 1, 11, 111\} are pairwise distinguishable:

  • 111∉L111 \notin L, while ϵ,1,11∈L\epsilon, 1, 11 \in L (distinguished by the empty string ϵ\epsilon).

  • ϵ\epsilon and 11 are distinguished by z=11z = 11 (ϵ⋅11=11∈L\epsilon \cdot 11 = 11 \in L, but 1⋅11=111∉L1 \cdot 11 = 111 \notin L).

  • ϵ\epsilon and 1111 are distinguished by z=1z = 1 (ϵ⋅1=1∈L\epsilon \cdot 1 = 1 \in L, but 11⋅1=111∉L11 \cdot 1 = 111 \notin L).

  • 11 and 1111 are distinguished by z=1z = 1 (1⋅1=11∈L1 \cdot 1 = 11 \in L, but 11⋅1=111∉L11 \cdot 1 = 111 \notin L).

Thus, exactly 4 states are required in the minimal DFA.

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 Q63 of the GATE CSE 2023 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. 6 of them are 2-mark NAT questions like this one, and GATE CSE 2023 has 2.

How GATE tests Regular Expressions and Finite Automata

More from GATE CSE 2023

Share this solution

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

GateAI solution cardGATE CSE 2023 · Q63 · NAT

Consider the language L over the alphabet {0, 1}, given below: L = {w ∈ {0, 1}* w does not contain three or more consecutive 1's}. The minimum number of states in a Deterministic Finite-State Automaton (DFA) for L is …

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.