Question

Let Σ={a,b,c}\Sigma = \{a, b, c\}. For x∈Σ∗x \in \Sigma^*, and α∈Σ\alpha \in \Sigma, let #α(x)\#_\alpha(x) denote the number of occurrences of α\alpha in xx.

Which one or more of the following option(s) define(s) regular language(s)?

Choose every correct option
Official answer and solution
Official answer
A and C
From
Official GATE 2025 answer key

Solution

Test each language for finite-state recognizability versus unbounded comparison of counts.

  • (A) is Regular: {ambn∣m,n≥0}\{a^m b^n \mid m, n \ge 0\} is generated by the regular expression a∗b∗a^* b^*.
  • (B) is NOT Regular: Any string in {a,b}∗\{a, b\}^* contains zero cc's, so intersecting with {ambncm−n∣m≥n≥0}\{a^m b^n c^{m-n} \mid m \ge n \ge 0\} forces m−n=0  ⟹  m=nm - n = 0 \implies m = n, yielding {anbn∣n≥0}\{a^n b^n \mid n \ge 0\}, which is a non-regular CFL.
  • (C) is Regular: Tracking #a(w) mod 7\#_a(w) \bmod 7 requires 77 states and tracking #b(w) mod 9\#_b(w) \bmod 9 requires 99 states; their product DFA has 7×9=637 \times 9 = 63 states.
  • (D) is NOT Regular: Enforcing #a(w)=#b(w)\#_a(w) = \#_b(w) requires unbounded memory and cannot be done by a finite automaton.
Final answer

Options (A), (C)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 2 (CS2)
Question
52 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.