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)
Explanation:
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
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.




