Skip to content
Official PYQ · 2021

GATE CS 2021 Set 1 Q38 — Regular Expressions and Finite Automata

Explain with AI

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 L?L?

Choose one option
View worked solution

Answer: D

To construct a Deterministic Finite Automaton (DFA) that accepts the language L={w∈{0,1}∗∣w ends with 011}L = \{ w \in \{0,1\}^* \mid w \text{ ends with } 011 \}, we define states based on the longest suffix of the input processed so far that is also a prefix of 011011:

  • q0q_0 (Initial state): Suffix is ϵ\epsilon (no progress towards 011011).
  • q1q_1: Suffix is 00.
  • q2q_2: Suffix is 0101.
  • q3q_3 (Final state): Suffix is 011011.

Let us determine the transitions for each state:

  • From q0q_0: On 00, go to q1q_1 (progresses to 00). On 11, stay at q0q_0.
  • From q1q_1: On 00, stay at q1q_1 (the suffix is still 00). On 11, go to q2q_2 (progresses to 0101).
  • From q2q_2: On 00, go to q1q_1 (the suffix becomes 010010, whose longest matching prefix is 00). On 11, go to q3q_3 (progresses to 011011).
  • From q3q_3: On 00, go to q1q_1 (the suffix becomes 01100110, whose longest matching prefix is 00). On 11, go to q0q_0 (the suffix becomes 01110111, which has no prefix match).

This exact transition behavior is correctly represented by the DFA in Option D.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular Expressions and Finite Automata questions