GateAI
Regular Expressions and Finite Automata

GATE CSE 2021 Set 1 · Q38

MCQ2 marksEasy

Time

Consider the following language. L={w∈{0,1}∗∣w ends with the substring 011} L = \{w \in \{0, 1\}^* \mid w \text{ ends with the substring } 011\} Which one of the following deterministic finite automata accepts LL?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D)

Regular Expressions and Finite Automata

To design a minimal DFA that accepts all strings ending with the substring 011011, we define states representing the longest suffix of the input read so far that is a prefix of 011011 [1]:

  • State q0q_0 (Start state): Represents suffix ϵ\epsilon (no prefix of 011011 matched).

  • State q1q_1: Represents suffix 00.

  • State q2q_2: Represents suffix 0101.

  • State q3q_3 (Accept state): Represents suffix 011011.

Let us determine the transitions for each state:

  1. From q0q_0:

    • On 0→q10 \to q_1 (suffix becomes 00)

    • On 1→q01 \to q_0 (suffix remains ϵ\epsilon)

  2. From q1q_1 (suffix 00):

    • On 0→q10 \to q_1 (suffix remains 00)

    • On 1→q21 \to q_2 (suffix becomes 0101)

  3. From q2q_2 (suffix 0101):

    • On 0→q10 \to q_1 (suffix becomes 00)

    • On 1→q31 \to q_3 (suffix becomes 011011)

  4. From q3q_3 (suffix 011011):

    • On 00: Suffix becomes 01100110. The longest suffix of 01100110 that is a prefix of 011011 is 00, so it must transition to q1q_1.

    • On 11: Suffix becomes 01110111. The longest suffix of 01110111 that is a prefix of 011011 is ϵ\epsilon, so it must transition back to the start state q0q_0.

Evaluating the options based on transitions from q3q_3:

  • (A) has a self-loop on 11 at q3q_3, so it would incorrectly accept strings ending in 01110111.

  • (B) has a self-loop on 0,10, 1 at q3q_3, which accepts any string containing 011011 as a substring.

  • (C) has a transition on 11 from q3q_3 to q2q_2, which would incorrectly accept 0111101111.

  • (D) correctly transitions on 00 to q1q_1 and on 11 to q0q_0.

Thus, option D is the correct DFA [1].

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 Q38 of the GATE CSE 2021 Set 1 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 it is the only one in GATE CSE 2021 Set 1.

How GATE tests Regular Expressions and Finite Automata

More from GATE CSE 2021 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2021 Set 1 · Q38 · MCQ

Consider the following language. L = {w ∈ {0, 1}* w ends with the substring 011} Which one of the following deterministic finite automata accepts L?

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.