StreakPeaked· Practice

ExamsGATETechnical

Let Σ = {a,b,c}. For x ∈ Σ*, and α ∈ Σ, let #α(x) denote the number of occurrences of α in x. Which one or more of the following option(s) define(s) regular language(s)?

  1. {a^m bⁿ | m,n ≥ 0}
  2. {a,b}* ∩ {a^m bⁿ c^(m−n) | m ≥ n ≥ 0}
  3. {w | w ∈ {a,b}*, #a(w) ≡ 2 (mod 7), and #b(w) ≡ 3 (mod 9)}
  4. {w | w ∈ {a,b}*, #a(w) ≡ 2 (mod 7), and #a(w) = #b(w)}

Correct answer: {w | w ∈ {a,b}*, #a(w) ≡ 2 (mod 7), and #b(w) ≡ 3 (mod 9)}

Solution

Option C defines a regular language because it specifies constraints on the counts of 'a' and 'b' using modular arithmetic, which can be represented by finite automata. Regular languages can handle such conditions, as they can track a finite number of states corresponding to the remainders of the counts.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →