Consider the following languages.

L= { wxyx ∣ w,x,y ∈ (0+1)_{1}^{+}}L= { xy ∣ x,y ∈ (a+b)*, ∣x∣=∣y∣, x≠y }_{2}

Which one of the following is TRUE ?

**(A)** L_{1} is regular and L_{2} is context- free

**(B)** L_{1} context- free but not regular and L_{2} is context-free

**(C)** Neither L_{1} nor L_{2} is context- free

**(D)** L_{1} context- free but L_{2} is not context-free

**Answer:** **(A)** **Explanation:**

L= { wxyx ∣ w,x,y ∈ (0+1)_{1}^{+}}

In L_{1} putting x as 0 and 1 we get a subset,

L= w0y 0 + w1y1_{1}L= (0 + 1)_{1}^{+}0(0 + 1)^{+}0 + (0 + 1)^{+}1(0 + 1)^{+}1

So, L_{1} is regular language.

L= { xy ∣ x,y ∈ (a+b)*, ∣x∣=∣y∣, x≠y } is CFL_{2}

We observe that a string is in L_{2} if and only if it can be written as xy with |x| = |y| such that for some i, the ith character of x is different from the ith character of y. To obtain such a string, we start generating the corresponding ith characters, and fill up the remaining characters.

Based on the above idea, we define the CFG for C is as follows:

S → AB | BA A → XAX | 0 B → XBX | 1 X → 0 | 1

Option (A) is correct.

Quiz of this Question

## Recommended Posts:

- GATE | GATE CS 2020 | Question 40
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 15
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 16
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 17
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 18
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 19
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 20
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 21
- GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 22
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 47
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 48
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 49
- GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 22
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 1
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 2
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 3
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 4
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 5
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 6
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 7