Skip to content
Official PYQ · 2019

GATE CS 2019 Q7 — Regular and Context-free Languages

Explain with AI

If LL is a regular language over Σ={a,b}\Sigma = \{a,b\}, which one of the following languages is NOT regular?

Choose one option
View worked solution

Answer: B

To determine which language is NOT guaranteed to be regular, let us analyze each option given that LL is a regular language over Σ={a,b}\Sigma = \{a,b\}:

  • Option A: L.LR={xy∣x∈L,yR∈L}L.L^R = \{xy \mid x \in L, y^R \in L\}
    Since regular languages are closed under reversal, LRL^R is regular. Regular languages are also closed under concatenation, so the concatenation L.LRL.L^R is guaranteed to be regular.
  • Option B: {wwR∣w∈L}\{ww^R \mid w \in L \}
    This language requires a matching of the string ww with its reverse wRw^R, which generally requires a stack (memory) to keep track of the symbols in ww.
    For example, if we choose the regular language L=Σ∗={a,b}∗L = \Sigma^* = \{a,b\}^*, then the language becomes {wwR∣w∈{a,b}∗}\{ww^R \mid w \in \{a,b\}^*\}, which is the classic non-regular (but context-free) language of even-length palindromes. Thus, this language is not regular in general.
  • Option C: Prefix(L)={x∈Σ∗∣∃y∈Σ∗ such that xy∈L}\text{Prefix}(L) = \{x \in \Sigma^* \mid \exists y \in \Sigma^* \text{ such that } xy \in L\}
    Regular languages are closed under the prefix operation. If LL is recognized by a DFA MM, we can construct a DFA for Prefix(L)\text{Prefix}(L) by making any state in MM from which a final state is reachable an accepting state.
  • Option D: Suffix(L)={y∈Σ∗∣∃x∈Σ∗ such that xy∈L}\text{Suffix}(L) = \{y \in \Sigma^* \mid \exists x \in \Sigma^* \text{ such that } xy \in L\}
    Regular languages are closed under the suffix operation. If LL is recognized by a DFA MM, we can construct an NFA for Suffix(L)\text{Suffix}(L) by making the start state of the NFA have ϵ\epsilon-transitions to all states of MM that are reachable from the original start state.

Therefore, the language in Option B is NOT regular.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular and Context-free Languages questions