GATE | Gate IT 2005 | Question 6

The language {0n 1n 2n | 1 ≤ n ≤ 106} is

(A) regular
(B) context-free but not regular.
(C) context-free but its complement is not context-free.
(D) not context-free

Answer: (A)

The value of ‘n’ is finite.
So, only finite number of strings can be part of given language.
Therefore, we can construct a finite state automata for this language.

Thus, option (A) is correct.

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

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.