Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Theory of Computation
  • Context-free grammars
  • Easy

Which of the following languages is regular?

Context-Free Languages

Pick an option to check your answer.

{anbm}\{a^n b^m\} places no link between the number of a's and b's: it is just the regular expression a∗b∗a^*b^*, accepted by a two-state DFA (plus a dead state). Every other option requires matching counts or mirrored halves, which a finite automaton cannot remember.

Why not the others

  • {anbn:n≥0}\{a^n b^n : n \ge 0\} needs to count the a's to match the b's, which a finite automaton cannot do.
  • {wwR:w∈{a,b}∗}\{ww^R : w \in \{a, b\}^*\} needs a stack to match the second half against the first; it is context-free but not regular.
  • {anbncn:n≥0}\{a^n b^n c^n : n \ge 0\} is not even context-free.

Report an error

GATE CS · Theory of Computation · Context-Free Languages