Skip to content
Related Articles

Related Articles

GATE | Quiz for Sudo GATE 2021 | Question 45

Improve Article
Save Article
  • Last Updated : 18 Dec, 2020
Improve Article
Save Article

The language L = {WbcWR | W ∈ (a+b)*} is _____.

Note – This question is multiple select questions (MSQ).
(A) Regular
(D) CFL but not DCFL

Answer: (B) (C)

Explanation: Any language for which we can have a Deterministic PDA is always a DCFL.
Here for language L= {WbcWR | W ∈ (a+b)*} we can have a PDA with following transitions in which PDA accepts a string when it halts on a final state. q0 in initial state and qf is final state.

1. (q0, a , Z) -> (q0, aZ)

2. (q0, b , Z) -> (q0, bZ)

3. (q0, a , a) ->(q0, aa)

4. (q0, b , a) -> (q0, ba)

5. (q0, a, b) -> (q0, ab)

6. (q0, b , b) -> (q0, bb)

7. (q0, c , b) -> (q1, null)

8. (q1, a , a) ->(q1, null)

9. (q1, b , b) -> (q1, null)

10. (q1, null, Z ) -> (qf, Z)

Here all a’s and b’s are initially pushed onto the stack for W. As soon as a c occurs after b , B is popped from the stack after which W^R is checked. If the further string alphabets match the
alphabet of the stack the alphabet is popped from the stack and finally the string reaches the final state if language is of the form L= {WbcW^R | W ∈ (a+b)*}.

Hence the above language is a DCFL, so CFL.

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

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!