Skip to content
Official PYQ · 2025

GATE CS 2025 Set 1 Q40 — Regular Expressions and Finite Automata

Explain with AI

Consider the following deterministic finite automaton (DFA) defined over the alphabet, Σ={a,b}\Sigma=\{a, b\}. Identify which of the following language(s) is/are accepted by the given DFA.

DFA

Choose one option
View worked solution

Answer: C

The given DFA accepts the set of all strings over Σ={a,b}\Sigma = \{a, b\} that end with the pattern babbab. We can verify this by analyzing the states and their corresponding tracking behavior:

  • State q0q_0 (Start State): Represents the state where the string processed so far does not end with any prefix of babbab (i.e., it ends with aa or is empty).
  • State q1q_1: Represents that the string processed so far ends with the prefix bb.
  • State q2q_2: Represents that the string processed so far ends with the prefix baba.
  • State q3q_3 (Accepting State): Represents that the string processed so far ends with the pattern babbab.

Let us trace the transitions from the accepting state q3q_3 to see how it maintains this property:

  • If we receive an aa at q3q_3 (string ends in babababa), the suffix matching the pattern becomes baba, so we transition to q2q_2.
  • If we receive a bb at q3q_3 (string ends in babbbabb), the suffix matching the pattern becomes bb, so we transition to q1q_1.

Since q3q_3 is the only final state, the DFA accepts a string if and only if it ends with the pattern babbab.

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

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