Skip to content
Official PYQ · 1992

GATE CS 1992 Q16 — Regular and Context-free Languages

Explain with AI

Which of the following three statements are true? Prove your answer.

Select all correct options
View worked solution

Answer: A;B

Statements (i) and (ii) are true, while statement (iii) is false.

  1. The union of two recursive languages is recursive (True):
    If L1L_1 and L2L_2 are recursive languages, there exist Turing machines M1M_1 and M2M_2 that decide them (i.e., they always halt and either accept or reject). We can construct a decider MM for L1∪L2L_1 \cup L_2 as follows: on input ww, run M1M_1 on ww. If M1M_1 accepts, accept. If M1M_1 rejects, run M2M_2 on ww. If M2M_2 accepts, accept; otherwise, reject. Since both M1M_1 and M2M_2 are guaranteed to halt, MM always halts and decides L1∪L2L_1 \cup L_2. Thus, recursive languages are closed under union.

  2. The language L={0n∣n is a prime}L = \{0^n \mid n \text{ is a prime}\} is not regular (True):
    Assume LL is regular. Let pp be the pumping length. Choose a prime n≥p+2n \ge p + 2. The string w=0n∈Lw = 0^n \in L. By the Pumping Lemma, w=xyzw = xyz such that ∣xy∣≤p|xy| \le p, ∣y∣=m≥1|y| = m \ge 1, and xykz∈Lxy^k z \in L for all k≥0k \ge 0.
    The length of xykzxy^k z is given by ∣xykz∣=n+(k−1)m|xy^k z| = n + (k-1)m.
    If we choose k=n+1k = n + 1, the length becomes n+nm=n(1+m)n + nm = n(1+m). Since n≥3n \ge 3 and m≥1m \ge 1, both factors nn and 1+m1+m are greater than or equal to 22. Thus, n(1+m)n(1+m) is composite, meaning 0n(1+m)∉L0^{n(1+m)} \notin L, which contradicts the Pumping Lemma. Hence, LL is not regular.

  3. Regular languages are closed under infinite union (False):
    Any single-string language {0n}\{0^n\} is finite and therefore regular. However, the infinite union of such regular languages, ⋃n is prime{0n}\bigcup_{n \text{ is prime}} \{0^n\}, results in the non-regular language {0n∣n is prime}\{0^n \mid n \text{ is prime}\}. Thus, regular languages are not closed under infinite union.

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

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