GATE / CS ARCHIVE

GATE CSE 2019 / QUESTION 7

Which language operation need not preserve regularity

Theory of Computation · Closure Properties & Language Hierarchy · Full GATE CSE 2019 paper

GATE 2019, Q7 1 mark · MCQ
Report issue

Closure Properties & Language Hierarchy

Question 7, GATE 2019: Given a regular language L over {a,b}, compare A L·L^R, where L^R is the set of reversed words; B {ww^R : w∈L}; C Prefix(L), all prefixes of words in L; D Suffix(L), all suffixes. The source asks which is “NOT regular”; evaluate this as which operation is not guaranteed to preserve regularity.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Our answer: B under not-necessarily-regular interpretation

Method: use closure constructions for A, C, D, and a counterexample for B.

1. Regular languages are closed under reversal and concatenation. Reversing an automaton's edges and exchanging start/final roles gives an NFA for LR; concatenating automata then recognizes L·LR. Thus A is always regular. Its two factors are chosen independently.
2. For Prefix(L), take a DFA for L and mark as accepting every state from which some original accepting state is reachable. A word reaches such a state exactly when it can be extended to a word of L. Thus C is regular.
3. For Suffix(L), use an NFA whose possible initial states are all states reachable from the original start, while keeping the original accepting states. It recognizes strings that can follow some prefix to complete a word of L. Thus D is regular.
4. B requires the second half to be the reversal of the very same first half. Choose regular L = {a,b}*. B then contains precisely the even-length palindromes. If it had pumping length p, the palindrome ap bb ap would have a nonempty pumped part wholly among its first p a's. Pumping that part down shortens only the left a-run, producing a non-palindrome. This contradicts the pumping lemma.

Result: B identifies the operation that does not preserve regularity. Literally B can be regular for finite or empty L, so the unconditional wording must mean not necessarily regular. The recorded regularity-quantifier discrepancy is retained.

Original paper, page 5 · Answer key