chapter

    Closure Properties and Language Classification Practice Questions for Gate Cs

    Solve 366+ Closure Properties and Language Classification practice 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
    Level 1: Warm-up

    Consider the language over the alphabet . Which of the following statements about and its subsets is TRUE?

    Question 2
    Level 1: Warm-up

    Let and . Which of the following statements about the subsets of is TRUE?

    Question 3
    Level 1: Warm-up

    Order the following languages based on the number of independent count comparisons they require, from the fewest (0) to the most:

    P.

    Q.

    R.

    Question 4
    Level 1: Warm-up

    Order the following languages based on the number of independent count comparisons they require, from the fewest (0) to the most:

    P.

    Q.

    R.

    Question 5
    Level 1: Warm-up

    Order the following languages based on the number of completely unconstrained (filler) variables they contain, from the most to the fewest:

    P.

    Q.

    R.

    Question 6
    Level 1: Warm-up

    Match the language operation in List I with the correct resulting language class in List II, given that is a Regular language and is a Context-Free language.

    List I

    P.

    Q.

    R.

    List II

    1. Always Context-Free
    2. Not necessarily Context-Free
    Question 7
    Level 1: Warm-up

    Match the operation in List I (combining a Regular language and a Context-Free language ) with the result class in List II.

    \textbf{List I}

    P.

    Q.

    R.

    S.

    \textbf{List II}

    (i) CFL

    (ii) NOT necessarily CFL

    Question 8
    Level 1: Warm-up

    \textbf{Assertion (A):} If is a Regular language and is a Context-Free language, then is NOT necessarily Context-Free.

    \textbf{Reason (R):} Context-Free Languages are not closed under complement, so may not be Context-Free.

    Which of the following is correct?

    Question 9
    Level 1: Warm-up

    Consider the language over the alphabet . What is the minimum length of a string in ?

    Question 10
    Level 1: Warm-up

    Consider the following statements about language classes, where and are languages over a finite alphabet:

    S1: If is context-free and is regular, then is context-free.

    S2: If is context-free and is regular, then is context-free.

    S3: If is regular, then and must both be regular.

    S4: If is regular and is context-free, then is necessarily context-free.

    Which of the above statements are TRUE?

    A. S1

    B. S2

    C. S3

    D. S4

    Free preview ends here

    Login to view the complete practice 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.

    Explore complete test series, official past papers, and chapter-wise study tools.

    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 Practice Questions for GATE CS

    Solve 366+ Closure Properties and Language Classification practice 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 MCQ

    Consider the language over the alphabet . Which of the following statements about and its subsets is TRUE?

    1. A.

      Every subset of is regular because itself is regular.

    2. B.

      contains only countably many subsets, all of which are decidable.

    3. C.

      contains uncountably many subsets, most of which are undecidable.

    4. D.

      No subset of can be undecidable since itself is decidable.

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a bounding question about the infinite subset trap. An infinite regular language has uncountably many subsets.

    Step 1: is an infinite regular language.

    Step 2: Any infinite set has uncountably many subsets ().

    Step 3: There are only countably many Turing machines, so only countably many decidable languages.

    Step 4: Therefore, most subsets of are undecidable.

    Answer: contains uncountably many subsets, most of which are undecidable.

    Question 2 · Theory of Computation MCQ

    Let and . Which of the following statements about the subsets of is TRUE?

    1. A.

      Since is regular, every subset of is also regular.

    2. B.

      Since is decidable, every subset of is decidable.

    3. C.

      has uncountably many subsets, and only countably many of them are decidable.

    4. D.

      has countably many subsets, all of which are regular.

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a bounding question about the infinite subset trap. An infinite regular language has uncountably many subsets, but only countably many languages can be decidable.

    Step 1: is an infinite regular language.

    Step 2: Any infinite set has uncountably many subsets (). This eliminates the option claiming countably many subsets.

    Step 3: Subsets do NOT inherit regularity or decidability from the parent language. This eliminates the options claiming all subsets are regular or decidable.

    Step 4: There are only countably many Turing machines, so there are only countably many decidable languages ().

    Step 5: Since has uncountably many subsets but only countably many are decidable, the vast majority of its subsets are undecidable.

    Answer: has uncountably many subsets, and only countably many of them are decidable.

    Question 3 · Theory of Computation MCQ

    Order the following languages based on the number of independent count comparisons they require, from the fewest (0) to the most:

    P.

    Q.

    R.

    1. A.

      Q, R, P

    2. B.

      P, R, Q

    3. C.

      R, Q, P

    4. D.

      Q, P, R

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a classification ranking question. You must count how many distinct variables are forced to be exactly equal to each other in separate blocks.

    Step 1: Analyze Q (). There is no relationship between and . They are independent. Number of comparisons = 0.

    Step 2: Analyze R (). The count of 's must exactly equal the count of 's. This is 1 independent comparison.

    Step 3: Analyze P (). The count of 's must equal 's, AND the count of 's must equal 's. This requires 2 independent comparisons.

    Step 4: Rank from fewest to most: Q (0), R (1), P (2).

    Answer: Q, R, P.

    Question 4 · Theory of Computation MCQ

    Order the following languages based on the number of independent count comparisons they require, from the fewest (0) to the most:

    P.

    Q.

    R.

    1. A.

      P, Q, R

    2. B.

      R, Q, P

    3. C.

      Q, P, R

    4. D.

      P, R, Q

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a classification ranking question. You must count how many distinct variables are forced to be exactly equal to each other in separate blocks.

    Step 1: Analyze P (). There is no relationship between and . They are independent. Number of comparisons = 0.

    Step 2: Analyze Q (). The count of 's must exactly equal the count of 's. The variable is independent. This is 1 independent comparison.

    Step 3: Analyze R (). The count of 's must equal 's, AND the count of 's must equal 's. This requires 2 independent comparisons.

    Step 4: Rank from fewest to most: P (0), Q (1), R (2).

    Answer: P, Q, R.

    Question 5 · Theory of Computation MCQ

    Order the following languages based on the number of completely unconstrained (filler) variables they contain, from the most to the fewest:

    P.

    Q.

    R.

    1. A.

      P, Q, R

    2. B.

      R, Q, P

    3. C.

      Q, P, R

    4. D.

      P, R, Q

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a classification ranking question based on the Quick Classification Checklist. You must identify which variables have no matching counterpart.

    Step 1: Analyze P (). The variables and appear only once. They are completely unconstrained. Number of fillers = 2.

    Step 2: Analyze Q (). The variable appears only once. It is unconstrained. Number of fillers = 1.

    Step 3: Analyze R (). All variables () are linked in a multiple comparison. There are no unconstrained fillers. Number of fillers = 0.

    Step 4: Rank from most to fewest: P (2), Q (1), R (0).

    Answer: P, Q, R.

    Question 6 · Theory of Computation MCQ

    Match the language operation in List I with the correct resulting language class in List II, given that is a Regular language and is a Context-Free language.

    List I

    P.

    Q.

    R.

    List II

    1. Always Context-Free
    2. Not necessarily Context-Free
    1. A.

      P-1, Q-2, R-1

    2. B.

      P-2, Q-1, R-1

    3. C.

      P-1, Q-1, R-2

    4. D.

      P-2, Q-2, R-1

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a mixed operations evaluation question. You must apply the Regular-CFL interaction matrix to each set operation.

    Step 1: Analyze P (). The union of a Regular language and a CFL is always Context-Free. Matches 1.

    Step 2: Analyze Q (). Set difference can be rewritten as . Since CFLs are not closed under complement, is not necessarily CFL. Intersecting a Regular language with a non-CFL language is not guaranteed to be CFL. Matches 2.

    Step 3: Analyze R (). This is equivalent to . Since Regular languages are closed under complement, is Regular. The intersection of a CFL and a Regular language is always CFL. Matches 1.

    Answer: P-1, Q-2, R-1.

    Question 7 · Theory of Computation MCQ

    Match the operation in List I (combining a Regular language and a Context-Free language ) with the result class in List II.

    \textbf{List I}

    P.

    Q.

    R.

    S.

    \textbf{List II}

    (i) CFL

    (ii) NOT necessarily CFL

    1. A.

      P-(i), Q-(i), R-(ii), S-(i)

    2. B.

      P-(i), Q-(ii), R-(i), S-(ii)

    3. C.

      P-(ii), Q-(i), R-(ii), S-(i)

    4. D.

      P-(i), Q-(i), R-(i), S-(ii)

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: When combining a Regular language and a Context-Free language, the result is almost always CFL, except for .

    Step 1: Recall the Regular-CFL interaction matrix from the smart notes:

    • = CFL (CFLs are closed under union with regular sets)
    • = CFL (construct a PDA that simulates the DFA and PDA in parallel)
    • = CFL (CFLs are closed under concatenation with regular sets)
    • = CFL (equals , and is Regular, so Regular CFL = CFL)
    • = NOT necessarily CFL (equals , and CFL is not closed under complement)

    Step 2: Match each operation:

    • P. → (i) CFL
    • Q. → (i) CFL
    • R. → (ii) NOT necessarily CFL
    • S. → (i) CFL

    Step 3: The correct matching is P-(i), Q-(i), R-(ii), S-(i).

    Answer: P-(i), Q-(i), R-(ii), S-(i)

    Question 8 · Theory of Computation MCQ

    \textbf{Assertion (A):} If is a Regular language and is a Context-Free language, then is NOT necessarily Context-Free.

    \textbf{Reason (R):} Context-Free Languages are not closed under complement, so may not be Context-Free.

    Which of the following is correct?

    1. A.

      Both A and R are true, and R is the correct explanation of A

    2. B.

      Both A and R are true, but R is NOT the correct explanation of A

    3. C.

      A is true but R is false

    4. D.

      A is false but R is true

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a construction question in assertion-reason format about the Regular-CFL interaction asymmetry. You need to evaluate both statements and check if R explains A.

    Step 1: Evaluate Assertion (A) — " is NOT necessarily Context-Free."

    • Rewrite using set theory:
    • is Regular ✓
    • is CFL, so is NOT necessarily CFL (CFLs are not closed under complement)
    • We're intersecting a Regular language with a potentially non-CFL language
    • There's no closure property that guarantees this result will be CFL
    • Assertion A is TRUE.

    Step 2: Evaluate Reason (R) — "Context-Free Languages are not closed under complement, so may not be Context-Free."

    • CFLs are indeed NOT closed under complement (proven via De Morgan's laws and non-closure under intersection)
    • Therefore, may not be a CFL
    • Reason R is TRUE.

    Step 3: Check if R explains A:

    • A states that is not necessarily CFL
    • R states that may not be CFL
    • The connection:
    • Since may not be CFL (from R), and we're intersecting it with , the result may not be CFL
    • R correctly explains WHY A is true
    • R is the correct explanation of A.

    Answer: Both A and R are true, and R is the correct explanation of A

    Question 9 · Theory of Computation NAT

    Consider the language over the alphabet . What is the minimum length of a string in ?

    Correct Answer:

    3

    Step-by-Step Solution

    Key idea: this is a pattern minimization question. The language definition allows and to be any strings from the specified sets. To find the minimum length, minimize and .

    Step 1: identify the constraints. The language requires:

    • : is a non-empty string of 's and 's
    • : is a non-empty string of 's and 's
    • The string has the form

    Step 2: minimize and . Since and must be non-empty (the means one or more), the minimum length for each is 1.

    • Minimum (e.g., )
    • Minimum (e.g., )

    Step 3: compute minimum string length. The string is , so:

    • Minimum length =

    Step 4: verify with an example. Let and . The string is , which has length 3 and belongs to .

    Answer: 3

    Question 10 · Theory of Computation MSQ

    Consider the following statements about language classes, where and are languages over a finite alphabet:

    S1: If is context-free and is regular, then is context-free.

    S2: If is context-free and is regular, then is context-free.

    S3: If is regular, then and must both be regular.

    S4: If is regular and is context-free, then is necessarily context-free.

    Which of the above statements are TRUE?

    A. S1

    B. S2

    C. S3

    D. S4

    1. A.

      S1

    2. B.

      S2

    3. C.

      S3

    4. D.

      S4

    Correct Answer:

    ["A","B"]

    Step-by-Step Solution

    Key idea: this is a closure properties statement evaluation question. We must check each statement against the known closure properties of Regular and Context-Free languages.

    Step 1: evaluate S1. CFL Regular = CFL. This is a standard closure property. TRUE.

    Step 2: evaluate S2. CFL - Regular = CFL = CFL Regular = CFL. TRUE.

    Step 3: evaluate S3. This is the intersection fallacy. Counterexample: let (not regular) and (regular). (regular), but is not regular. FALSE.

    Step 4: evaluate S4. Regular - CFL = Regular . Since CFL is not closed under complement, is not necessarily CFL. The intersection of Regular with a non-CFL is not necessarily CFL. FALSE.

    Answer: A, B

    More practice questions in this unit