chapter
    Closure Properties and Language Classification PYQs for GATE CS

    Solve 14+ Closure Properties and Language Classification previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    2026 Slot Set2 PYQ
    Level 3: Exam Standard
    Let and let .
    Which of the following constraints ensure(s) that the language is context-free?
    Question 2
    2026 Slot Set1 PYQ
    Level 3: Exam Standard
    Let and be two languages over a finite alphabet, such that and are regular languages.

    Which of the following statements is/are always true?
    Question 3
    2025 Slot Set2 PYQ
    Level 3: Exam Standard
    Let . For , and , let denote the number of occurrences of in .

    Which one or more of the following option(s) define(s) regular language(s)?
    Question 4
    2025 Slot Set2 PYQ
    Level 3: Exam Standard
    Consider the two lists List I and List II given below:

    List IList II(i)Context free languages(a)Closed under union(ii)Recursive languages(b)Not closed under complementation(iii)Regular languages(c)Closed under intersection
    For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?
    Question 5
    2025 Slot Set1 PYQ
    Level 3: Exam Standard
    Consider the following two languages over the alphabet , where and are natural numbers.



    Which ONE of the following statements is CORRECT?
    Question 6
    2025 Slot Set1 PYQ
    Level 3: Exam Standard
    Consider the following two languages over the alphabet :



    Which ONE of the following statements is CORRECT?
    Question 7
    2024 Slot Set1 PYQ
    Level 3: Exam Standard

    Let be two regular languages and a language which is not regular. Which of the following statements is/are always TRUE?

    Question 8
    2023 PYQ

    Which of the following statements is/are CORRECT?

    Question 9
    2022 PYQ

    Consider the following languages:

    Note that is the reversal of the string . Which of the following is/are TRUE?

    Question 10
    2022 PYQ
    Level 3: Exam Standard

    Consider the following languages:

    Which of the following statements is/are FALSE?

    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Closure Properties and Language Classification PYQs for GATE CS

    Solve 14+ Closure Properties and Language Classification previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Closure Properties and Language Classification

    Chapter Roadmap

    Closure Properties and Language Classification

    1. Regular Language Identification and Classification

    Foundation: Finite memory, modular counting, and subset traps. (Weightage: ~3 questions)

    2. Context-Free Language Classification and Structural Constraints

    Advanced: Structural constraints, pumping lemma, and grammar ambiguity. (Weightage: ~6 questions)

    3. Closure Properties of Language Classes

    Application: Algebraic tools to prove language class membership without building machines. (Weightage: ~5 questions)

    By the end of this chapter: You will have a complete, step-by-step decision framework to classify any language and prove its properties under various operations.

    Regular Language Identification and Classification

    Theory of Computation › Closure Properties and Language Classification

    Regular Language Identification and Classification

    The foundation of the Chomsky hierarchy: mastering finite memory constraints and spotting regularity in complex patterns.

    1. Finite memory intuition 2. The finite language rule 3. Modular arithmetic patterns 4. Subset property traps

    Closure Properties and Language Classification: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Theory of Computation · 2026_Set2 MSQ
    Let and let .
    Which of the following constraints ensure(s) that the language is context-free?
    1. A.

    2. B.

      and

    3. C.

      and

    4. D.

    Correct Answer:

    ["C","D"]

    Step-by-Step Solution

    Key idea: This is a structural constraint question for Context-Free Languages, recognizable because it asks which arithmetic constraints on the exponents of a 4-part string allow it to be generated by a single stack (PDA).

    Step 1: The base string format is . A PDA processes this left-to-right. It can push symbols for the first parts and pop for the later parts. The fundamental limit is that it can only maintain ONE active nested comparison at a time.

    Step 2: Evaluate Option A: . This requires matching the sum of the first and third parts with the sum of the second and fourth parts. Because and are in the middle, a single stack cannot simultaneously track against and against in a crossed manner. This requires two independent comparisons. NOT CFL.

    Step 3: Evaluate Option B: and . This requires matching with and with . These are two independent comparisons separated by other symbols. A single stack cannot do this. NOT CFL.

    Step 4: Evaluate Option C: and . The string is . The PDA can push 's, then push 's. When reading 's, it pops 's (matching ). When reading 's, it pops 's (matching ). This is a single, perfectly nested comparison. IS CFL.

    Step 5: Evaluate Option D: . The PDA can push both 's and 's onto the stack. The total number of symbols pushed is . Then, it pops for every and every . The total number of symbols popped is . Since , the stack will empty exactly at the end. This is a single comparison of sums. IS CFL.

    Answer: C, D

    Question 2 · Theory of Computation · 2026_Set1 MSQ
    Let and be two languages over a finite alphabet, such that and are regular languages.

    Which of the following statements is/are always true?
    1. A.

      is regular

    2. B.

      is regular

    3. C.

      is context-free

    4. D.

      is context-free

    Correct Answer:

    ["C"]

    Step-by-Step Solution

    Key idea: This is a closure properties question involving the subset fallacy, recognizable because it gives a condition on an intersection and asks what must be true about the individual languages.

    Step 1: We are given that is regular and is regular. We need to determine which statements are ALWAYS true.

    Step 2: Evaluate Option A ( is regular) and Option B ( is regular). Consider the counterexample where . The empty set is regular. Then , which is regular. This satisfies the given conditions for ANY language . If we choose to be a non-regular language (e.g., ), then is not regular, and is not regular. Thus, A and B are NOT always true.

    Step 3: Evaluate Option D ( is context-free). Using the same counterexample where (which is not context-free) and , the conditions are met but is not CFL. Thus, D is NOT always true.

    Step 4: Evaluate Option C ( is context-free). We are explicitly given that is regular. Since every regular language is also a context-free language (Regular CFL), MUST be context-free. This is ALWAYS true.

    Answer: C

    Question 3 · Theory of Computation · 2025_Set2 MSQ
    Let . For , and , let denote the number of occurrences of in .

    Which one or more of the following option(s) define(s) regular language(s)?
    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    ["A","C"]

    Step-by-Step Solution

    Key idea: This is a regular language identification question, recognizable because it asks which of the given string patterns can be recognized by a finite automaton (DFA), focusing on modular counting and intersection traps.

    Step 1: Evaluate Option A: . This is simply the language . A DFA can easily recognize this by staying in a start state for 's, transitioning to a second state for 's, and rejecting if an appears after a . This IS regular.

    Step 2: Evaluate Option B: . The intersection with means we only keep strings that contain NO 's. For the second language to have no 's, the exponent of must be 0, so . The language reduces to . This requires unbounded counting and is NOT regular.

    Step 3: Evaluate Option C: . This language only requires counting the number of 's modulo 7 and the number of 's modulo 9. A DFA can easily maintain two separate counters (one cycling every 7 states, one cycling every 9 states) using the product construction. This IS regular.

    Step 4: Evaluate Option D: . While the modulo condition is regular, the condition requires unbounded counting to ensure the total number of 's exactly equals the total number of 's. A finite automaton cannot remember an arbitrarily large count. This is NOT regular.

    Answer: A, C

    Question 4 · Theory of Computation · 2025_Set2 MSQ
    Consider the two lists List I and List II given below:

    List IList II(i)Context free languages(a)Closed under union(ii)Recursive languages(b)Not closed under complementation(iii)Regular languages(c)Closed under intersection
    For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?
    1. A.

      (i) – (a), (ii) – (b), and (iii) – (c)

    2. B.

      (i) – (b), (ii) – (a), and (iii) – (c)

    3. C.

      (i) – (b), (ii) – (c), and (iii) – (a)

    4. D.

      (i) – (a), (ii) – (c), and (iii) – (b)

    Correct Answer:

    ["B","C"]

    Step-by-Step Solution

    Key idea: This is a language classification and closure properties matching question. We must verify the truth of each proposed pairing between a language class and its closure property.

    Step 1: Analyze Context-Free Languages (CFLs).

    CFLs are closed under union, concatenation, and Kleene star.

    CFLs are NOT closed under intersection or complementation.

    Therefore, (i) matches (a) "Closed under union" and (b) "Not closed under complementation".

    Step 2: Analyze Recursive Languages.

    Recursive languages are closed under union, intersection, complementation, concatenation, and Kleene star.

    Therefore, (ii) matches (a) "Closed under union" and (c) "Closed under intersection".

    Step 3: Analyze Regular Languages.

    Regular languages are closed under all standard operations: union, intersection, complementation, concatenation, Kleene star, reversal, etc.

    Therefore, (iii) matches (a) "Closed under union" and (c) "Closed under intersection".

    Step 4: Evaluate the given options.

    Option A: (i)-(a) [True], (ii)-(b) [False, Recursive IS closed under complement], (iii)-(c) [True]. Overall: False.

    Option B: (i)-(b) [True], (ii)-(a) [True], (iii)-(c) [True]. Overall: True.

    Option C: (i)-(b) [True], (ii)-(c) [True], (iii)-(a) [True]. Overall: True.

    Option D: (i)-(a) [True], (ii)-(c) [True], (iii)-(b) [False, Regular IS closed under complement]. Overall: False.

    Answer: Options B and C are correct.

    Question 5 · Theory of Computation · 2025_Set1 MCQ
    Consider the following two languages over the alphabet , where and are natural numbers.



    Which ONE of the following statements is CORRECT?
    1. A.

      Both and are context-free languages.

    2. B.

      is a context-free language but is not a context-free language.

    3. C.

      is not a context-free language but is a context-free language.

    4. D.

      Neither nor are context-free languages.

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a language classification question comparing two similar-looking languages, recognizable because it tests the difference between multiple independent comparisons and a single nested sum comparison.

    Step 1: Analyze . The string has three parts: , , and . The condition requires matching with (both have exponent ), AND then matching the from the first part with the first 's. This requires two independent comparisons ( with , and with ). A single stack cannot do this. Thus, is NOT context-free.

    Step 2: Analyze . The string has three parts: , , and . The condition requires the total number of 's to equal the sum of 's and 's.

    Step 3: Can a PDA recognize ? Yes. The PDA can push a symbol for every read, then push a symbol for every read. The stack now contains symbols. Then, for every read, it pops one symbol. Since the total number of 's is exactly , the stack will empty exactly at the end of the string. This is a single, valid stack operation. Thus, IS context-free.

    Step 4: Compare with the options. is not CFL, is CFL. This matches Option C.

    Answer: C

    Question 6 · Theory of Computation · 2025_Set1 MCQ
    Consider the following two languages over the alphabet :



    Which ONE of the following statements is CORRECT?
    1. A.

      Both and are regular languages.

    2. B.

      is a regular language but is not a regular language.

    3. C.

      is not a regular language but is a regular language.

    4. D.

      Neither nor is a regular language.

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: We must determine the regularity of two languages defined by string patterns. The key is to simplify the pattern definitions by analyzing the constraints on and .

    Step 1: Analyze .

    is any non-empty string over . The shortest possible is a single character ('a' or 'b').

    is any non-empty string over .

    Therefore, any string in must have a length of at least , and it must start and end with the same single character.

    Can any string of length starting and ending with the same character be formed? Yes. Let the first character be , the middle part be , and the last character be .

    Thus, is exactly the set of strings of length that start and end with 'a', OR start and end with 'b'.

    Regular Expression for : .

    Since it can be described by a regular expression, is a Regular Language.

    Step 2: Analyze .

    Here, is restricted to one or more 'a's. So for some .

    The string format is .

    This requires the number of 'a's at the beginning to exactly match the number of 'a's at the end, with an arbitrary string in the middle.

    This is a classic counting dependency (similar to ), which requires unbounded memory. A finite automaton cannot track the arbitrary count .

    Therefore, is NOT a Regular Language.

    Conclusion: is regular, but is not regular.

    Answer: Option B.

    Question 7 · Theory of Computation · 2024_Set1 MSQ

    Let be two regular languages and a language which is not regular. Which of the following statements is/are always TRUE?

    1. A.

      if and only if

    2. B.

      is not regular

    3. C.

      is not regular

    4. D.

      is regular

    Correct Answer:

    ["C","D"]

    Step-by-Step Solution

    Key idea: This question tests the closure properties of Regular languages and how they interact with non-regular languages. We evaluate each statement for universal truth.

    Step 1: Evaluate Option A.

    Statement: if and only if .

    The condition is equivalent to . It does not guarantee .

    Counterexample: , . , but . Thus, Option A is FALSE.

    Step 2: Evaluate Option B.

    Statement: is not regular.

    Counterexample: Let (which is regular) and be any non-regular language. Then , which IS regular. Thus, Option B is FALSE.

    Step 3: Evaluate Option C.

    Statement: is not regular.

    Proof by contradiction: If were regular, then its complement would also be regular (since Regular languages are closed under complementation). This contradicts the given fact that is not regular. Thus, Option C is TRUE.

    Step 4: Evaluate Option D.

    Statement: is regular.

    Since and are regular, their complements and are also regular (closure under complement). The union of two regular languages is always regular (closure under union). Thus, Option D is TRUE.

    Answer: Options C and D are always TRUE.

    Question 8 · Theory of Computation · 2023 MSQ

    Which of the following statements is/are CORRECT?

    1. A.

      The intersection of two regular languages is regular.

    2. B.

      The intersection of two context-free languages is context-free.

    3. C.

      The intersection of two recursive languages is recursive.

    4. D.

      The intersection of two recursively enumerable languages is recursively enumerable.

    Question 9 · Theory of Computation · 2022 MSQ

    Consider the following languages:

    Note that is the reversal of the string . Which of the following is/are TRUE?

    1. A.

      and are regular.

    2. B.

      and are context-free.

    3. C.

      is regular and is context-free.

    4. D.

      and are context-free but not regular.

    Question 10 · Theory of Computation · 2022 MSQ

    Consider the following languages:

    Which of the following statements is/are FALSE?

    1. A.

      is not context-free but and are deterministic context-free.

    2. B.

      Neither nor is context-free.

    3. C.

      , and all are context-free.

    4. D.

      Neither nor its complement is context-free.

    Correct Answer:

    ["B","C","D"]

    Step-by-Step Solution

    Key idea: This question requires classifying three specific languages and evaluating statements about them. We must identify which statements are FALSE.

    Step 1: Classify .

    This language requires matching an arbitrary string with an identical copy of itself. A single stack cannot remember an unbounded, unconstrained string to verify the second half. Thus, is NOT context-free.

    However, its complement IS context-free (a PDA can non-deterministically guess a mismatched character or an odd length).

    Step 2: Classify .

    This requires matching the count of 'a's and 'b's, while 'c's are independent. A single stack can push for 'a' and pop for 'b', then ignore 'c'. This is a Deterministic Context-Free Language (DCFL), and therefore a CFL.

    Step 3: Classify .

    Similar to , the 'a's are independent, and the stack matches 'b's and 'c's. This is also a DCFL, and therefore a CFL.

    Step 4: Evaluate the statements.

    Statement A: " is not context-free but and are deterministic context-free." -> This is a TRUE statement.

    Statement B: "Neither nor is context-free." -> FALSE, because IS context-free.

    Statement C: ", and all are context-free." -> FALSE. , which is the classic non-context-free language.

    Statement D: "Neither nor its complement is context-free." -> FALSE, because IS context-free.

    Answer: Statements B, C, and D are FALSE.

    More previous year questions (pyqs) in this unit