Skip to content
Related Articles

Related Articles

GATE | GATE-CS-2004 | Question 87
  • Difficulty Level : Easy
  • Last Updated : 26 Sep, 2014

The language {am bn Cm+n | m, n ≥ 1} is

(A) regular
(B) context-free but not regular
(C) context sensitive but not context free
(D) type-0 but not context sensitive


Answer: (B)

Explanation:
We construct a PDA for the given language.

PUSH Z0 in the stack initially.
PUSH X in the stack for each occurrence of ‘a’ .
PUSH Y in the stack for each occurrence of ‘b’.
POP X and Y from the stack for each occurrence of ‘c’.

If after popping all X and Y from the stack , no input element is left in the string and we get Z0 on the top of the stack then the string is accepted.

 
Thus, option (B) is correct.

 
Please comment below if you find anything wrong in the above post.


Quiz of this Question

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :