chapter
    Combinatorics and Counting PYQs for GATE CS

    Solve 7+ Combinatorics and Counting 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 Set1 PYQ
    Level 3: Exam Standard

    Consider matrices with their elements from . The number of such matrices with even number of s in every row and every column is

    Question 2
    2025 Slot Set1 PYQ
    Level 3: Exam Standard

    A shop has 4 distinct flavors of ice-cream. One can purchase any number of scoops of any flavor. <b>The order in which the scoops are purchased is inconsequential.</b> If one wants to purchase 3 scoops of ice-cream, in how many ways can one make that purchase?

    Question 3
    2025 Slot Set1 PYQ
    Level 3: Exam Standard

    Let be the set of all ternary strings defined over the alphabet . Consider all strings in that contain at least one occurrence of two consecutive symbols, that is, “aa”, “bb” or “cc”. The number of such strings of length 5 that are possible is _______. (Answer in integer)

    Question 4
    2023 PYQ
    Level 3: Exam Standard
    Let , where is a large positive integer greater than 1000. Let be a positive integer less than . Let be subsets of with and . We say that a permutation of separates from if one of the following is true.

    - All members of appear in the permutation before any of the members of .

    - All members of appear in the permutation before any of the members of .

    How many permutations of separate from ?
    Question 5
    2022 PYQ
    Level 3: Exam Standard

    The number of arrangements of six identical balls in three identical bins is______.

    Question 6
    2021 Slot Set2 PYQ
    Level 3: Exam Standard

    Let be a set consisting of 10 elements. The number of tuples of the form such that and are subsets of , and is __________.

    Question 7
    2021 Slot Set1 PYQ
    Level 3: Exam Standard
    There are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing speeds. Each job is assigned to a computer such that:
    - The fastest computer gets the toughest job and the slowest computer gets the easiest job.
    - Every computer gets at least one job.
    The number of ways in which this can be done is __________.
    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.

    Combinatorics and Counting PYQs for GATE CS

    Solve 7+ Combinatorics and Counting previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Combinatorics and Counting

    Orientation Level 1

    Chapter Roadmap: Combinatorics and Counting

    Step 1 (Current)
    Stars and Bars & Integer Partitions
    Distributing identical items into distinct or identical bins.
    Step 2
    String Counting & Complementary Counting
    Arrangements with restrictions and total minus unwanted.
    Step 3
    Permutations & Order Constraints
    Assigning distinct tasks with priority or capacity rules.
    Step 4
    Subset & Binary Matrix Counting
    Counting subset pairs and matrices with parity constraints.
    Why this order? Stars and Bars teaches you how to handle indistinguishability, the hardest conceptual leap. The rest builds on it by adding order and distinctness.

    The Core Intuition: Stars and Bars

    Concept Level 1

    The Core Intuition: Stars and Bars

    Distributing identical items into distinct bins.

    Visual Model: 5 items, 3 bins
    Bin 1: 2    Bin 2: 0    Bin 3: 3
    The Logic
    • Total positions in sequence:
    • Choose positions for bars:
    • Or choose positions for stars:
    Key Condition: This standard formula assumes bins can be empty ().

    Combinatorics and Counting: Solved Questions with Step-by-Step Explanations (7 Problems)

    Question 1 · Engineering Mathematics · 2026_Set1 MCQ

    Consider matrices with their elements from . The number of such matrices with even number of s in every row and every column is

    1. A.

      512

    2. B.

      1025

    3. C.

      1023

    4. D.

      255

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a binary matrix counting problem with parity constraints, recognizable by the requirement of an "even number of 1s in every row and every column". We solve this by determining the degrees of freedom in the matrix.

    Step 1: Consider the top-left submatrix (rows 1-3, columns 1-3). The entries in this submatrix can be chosen completely freely.

    Number of ways to fill this block = .

    Step 2: Determine the remaining cells in the first 3 rows.

    For each of the first 3 rows, the entry in the 4th column is uniquely forced to make the row sum even.

    Step 3: Determine the remaining cells in the first 3 columns.

    For each of the first 3 columns, the entry in the 4th row is uniquely forced to make the column sum even.

    Step 4: Determine the bottom-right cell (row 4, column 4).

    This cell must satisfy both the 4th row parity and the 4th column parity. In a binary matrix, the sum of all row parities equals the sum of all column parities (both equal the total sum of all elements mod 2). Thus, the two constraints on the bottom-right cell are perfectly consistent, and it is uniquely determined.

    Step 5: Calculate the total.

    Since all other cells are uniquely determined by the free choices in the submatrix, the total number of valid matrices is exactly 512.

    Answer: A

    Question 2 · Engineering Mathematics · 2025_Set1 MCQ

    A shop has 4 distinct flavors of ice-cream. One can purchase any number of scoops of any flavor. <b>The order in which the scoops are purchased is inconsequential.</b> If one wants to purchase 3 scoops of ice-cream, in how many ways can one make that purchase?

    1. A.

      4

    2. B.

      20

    3. C.

      24

    4. D.

      48

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a Stars and Bars problem, recognizable by the distribution of identical items (scoops of the same flavor are indistinguishable) into distinct categories (the 4 distinct flavors), with the phrase "order is inconsequential" confirming we are choosing a multiset.

    Step 1: Identify the parameters for the Stars and Bars formula.

    Number of identical items to distribute: (scoops).

    Number of distinct bins: (flavors).

    Step 2: Apply the standard Stars and Bars formula for non-negative integer solutions.

    The number of ways is given by .

    Step 3: Substitute the values and calculate.

    .

    .

    Answer: B

    Question 3 · Engineering Mathematics · 2025_Set1 NAT

    Let be the set of all ternary strings defined over the alphabet . Consider all strings in that contain at least one occurrence of two consecutive symbols, that is, “aa”, “bb” or “cc”. The number of such strings of length 5 that are possible is _______. (Answer in integer)

    Correct Answer:

    195

    Step-by-Step Solution

    Key idea: This is a complementary counting problem, recognizable by the phrase "at least one occurrence". Counting the desired strings directly involves messy overlapping cases, so we count the complement (strings with NO consecutive identical symbols) and subtract from the total.

    Step 1: Calculate the total number of ternary strings of length 5.

    The alphabet is , so there are 3 choices for each of the 5 positions.

    Total strings = .

    Step 2: Calculate the number of strings with NO consecutive identical symbols.

    • Position 1: 3 choices (any of a, b, c).
    • Position 2: 2 choices (must be different from Position 1).
    • Position 3: 2 choices (must be different from Position 2).
    • Position 4: 2 choices (must be different from Position 3).
    • Position 5: 2 choices (must be different from Position 4).

    Number of such strings = .

    Step 3: Subtract the complement from the total.

    Strings with at least one consecutive pair = Total - Strings with no consecutive pairs

    .

    Answer: 195

    Question 4 · Engineering Mathematics · 2023 MCQ
    Let , where is a large positive integer greater than 1000. Let be a positive integer less than . Let be subsets of with and . We say that a permutation of separates from if one of the following is true.

    - All members of appear in the permutation before any of the members of .

    - All members of appear in the permutation before any of the members of .

    How many permutations of separate from ?
    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: This is a permutation problem with relative order constraints, recognizable by the condition "All members of A appear... before... B". We use the symmetry division technique by focusing on the relative ordering of the specific subsets.

    Step 1: Consider the total number of permutations of , which is .

    Step 2: Focus only on the elements belonging to . In any random permutation of , these elements can appear in any of their internal relative orders.

    Step 3: Count the favorable relative orders.

    We need either all of before all of , or all of before all of .

    • Case 1 (A before B): The first positions among the elements must be occupied by , and the last by . The elements of can be arranged in ways, and in ways. Total = .
    • Case 2 (B before A): By symmetry, this also gives ways.

    Total favorable relative orders = .

    Step 4: Calculate the fraction of favorable permutations.

    The probability of a random permutation having a favorable relative order is .

    Step 5: Multiply by the total permutations.

    Favorable permutations = .

    We can rewrite as .

    Substituting this in:

    .

    Answer: D

    Question 5 · Engineering Mathematics · 2022 NAT

    The number of arrangements of six identical balls in three identical bins is______.

    Correct Answer:

    7

    Step-by-Step Solution

    Key idea: This is an integer partition problem, recognizable because both the items (balls) and the bins are identical. We need to find the number of ways to write 6 as a sum of at most 3 non-negative integers, where the order of the summands does not matter.

    Step 1: Since the bins are identical, a distribution like (4, 1, 1) is the same as (1, 4, 1). We only care about the multiset of counts. We list the partitions of 6 into at most 3 parts systematically, keeping the parts in non-increasing order: .

    Step 2: List the partitions by the largest part :

    • If : (6, 0, 0) 1 way
    • If : (5, 1, 0) 1 way
    • If : (4, 2, 0), (4, 1, 1) 2 ways
    • If : (3, 3, 0), (3, 2, 1) 2 ways
    • If : (2, 2, 2) 1 way

    Step 3: Sum the number of ways.

    Total = 1 + 1 + 2 + 2 + 1 = 7.

    Answer: 7

    Question 6 · Engineering Mathematics · 2021_Set2 NAT

    Let be a set consisting of 10 elements. The number of tuples of the form such that and are subsets of , and is __________.

    Correct Answer:

    59049

    Step-by-Step Solution

    Key idea: This is a subset counting problem using the element-wise independence principle, recognizable by the condition . Instead of counting subsets globally, we evaluate the choices for each element of independently.

    Step 1: Consider an arbitrary element . We must decide its membership in and .

    Step 2: Since , if , then must also be in .

    The valid choices for are:

    1. and
    2. and
    3. and

    The choice and is invalid. Thus, there are exactly 3 valid choices for each element.

    Step 3: Since there are 10 elements in , and each element makes an independent choice from 3 options, the total number of tuples is .

    Step 4: Calculate .

    Answer: 59049

    Question 7 · Engineering Mathematics · 2021_Set1 NAT
    There are 6 jobs with distinct difficulty levels, and 3 computers with distinct processing speeds. Each job is assigned to a computer such that:
    - The fastest computer gets the toughest job and the slowest computer gets the easiest job.
    - Every computer gets at least one job.
    The number of ways in which this can be done is __________.
    Correct Answer:

    65

    Step-by-Step Solution

    Key idea: This is a constrained assignment problem, recognizable by the specific forced allocations (fastest gets toughest, slowest gets easiest) combined with a global "at least one" constraint. We first satisfy the forced assignments, then handle the remaining items using complementary counting for the residual constraint.

    Step 1: Identify the forced assignments.

    Let the jobs be (easiest) to (toughest), and computers be (fastest), (middle), (slowest).

    must get .

    must get .

    Step 2: Check the "at least one job" constraint.

    has 1 job ().

    has 1 job ().

    currently has 0 jobs.

    Step 3: Assign the remaining jobs.

    The remaining 4 jobs () can be assigned to any of the 3 computers.

    Total unrestricted ways to assign these 4 jobs = .

    Step 4: Apply the residual constraint.

    must get at least one job. We subtract the cases where gets NO jobs.

    If gets no jobs, all 4 remaining jobs must go to either or .

    Ways for this to happen = .

    Step 5: Calculate the valid assignments.

    Valid ways = Total unrestricted - (Ways gets no jobs) = .

    Answer: 65

    More previous year questions (pyqs) in this unit