Open In App

GATE | GATE CS 2019 | Question 40

Like Article
Like
Save
Share
Report

Which one of the following languages over ∑ = {a, b} is NOT context-free?

(A)

{anbi ⏐ i ∈ {n, 3n, 5n}, n≥ 0}

(B)

{wanwRbn ⏐ w ∈ {a, b}*, n≥ 0}

(C)

{wwR ⏐ w ∈ {a, b}*}

(D)

{wan bn wR ⏐ w ∈ {a, b}*, n≥ 0}


Answer: (B)

Explanation:

(A): It is CFL, because we have union of three CFLs, and CFLs are closed under union property.

{anbi ⏐ i ∈ {n, 3n, 5n}, n≥ 0} 
= anbn ∪ anb3n ∪ anb5n 

We can identify strings of these languages using only one stack. 

(B): It is not CFL, because you can identify strings of given language using only one stack, you need atleast 2 stacks. There is alternate string matching which is not possible using only one stack. It is context sensitive language but not content free. 

(C): It is very well known CFL. It is language of palindrome over only two alphabets which can be recognize by using only one stack. 

(D): It is also CFL, since we can first push w, then a’s, b’s pop with a’s and wR pops with the w. 

So PDA can accept the language. Option (B) is correct. 


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 01 Oct, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads