- 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.
Answer: B. Solution
places no link between the number of a's and b's: it is just the regular expression , 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
- needs to count the a's to match the b's, which a finite automaton cannot do.
- needs a stack to match the second half against the first; it is context-free but not regular.
- is not even context-free.