Open In App

GATE | GATE-CS-2007 | Question 30

Like Article
Like
Save
Share
Report

The language L= {0i21i | i≥0 } over the alphabet {0,1, 2} is:

(A)

not recursive

(B)

is recursive and is a deterministic CFL.

(C)

is a regular language.

(D)

is not a deterministic CFL but a CFL.



Answer: (B)

Explanation:

Let us first design a deterministic pushdown automata for the given language.

  • For each occurrence of ‘0’ , we PUSH X in the stack.
  • When ‘2’ appears, no stack operation is performed. But, state of the automata is changed.
  • For each occurrence of ‘1’ , we POP X from the stack.
  • If at the end Z0 is on the stack top then input string is accepted

We also design a Turing machine for the given language.

  • When ‘0’ appears in the input string , we replace it with X .Then, traverse to the rightmost corner and replace ‘1’ with Y.
  • We go back to the leftmost ‘0’ and repeat the above process.
  • While traversing rightwards from the beginning of the input string, if after X, ‘2’ appears and after ‘2’, Y appears then we reach the HALT state. Thus, the given language is recursive. Every recursive language is a CFL. Thus, option (B) is the answer. 


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


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