UGC NET Paper 2 (Computer Science)Hard

The language {a^n b^n | n >= 0} is:

  1. A. Regular but not context-free
  2. B. Context-free but not regular
  3. C. Neither context-free nor regular
  4. D. Both regular and context-free

Correct answer: B. Context-free but not regular

The pumping lemma for regular languages disproves regularity while a simple CFG S -> aSb | e generates it.

More UGC NET Computer Science and Applications questions

Exams that ask this topic