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

2005

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

  1. A.

    regular

  2. B.

    context-free but not regular.

  3. C.

    context-free but its complement is not context-free.

  4. D.

    not context-free

Attempted by 119 students.

Show answer & explanation

Correct answer: A

The language {0^n 1^n 2^n | 1 ≤ n ≤ 10^6} is finite because n has a maximum value of 10^6. Since all finite languages are regular, this language is regular. Therefore, the correct answer is A (regular).

Explore the full course: Gate Guidance By Sanchit Sir