GateAI
Combinatorics

GATE CSE 2025 Set 1 · Q30

NAT1 markEasy

Time

Let SS be the set of all ternary strings defined over the alphabet {a,b,c}\{a, b, c\}. Consider all strings in SS 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)

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 195

Combinatorics

To find the number of ternary strings of length 55 containing at least one occurrence of two consecutive identical symbols ("aa", "bb", or "cc"), we can use the complement principle:

  1. Total number of ternary strings of length 5: Since the alphabet has 33 symbols ({a,b,c})(\{a, b, c\}) and each position can take any of the 33 symbols independently:

    Total strings=35=243\text{Total strings} = 3^5 = 243
  2. Number of strings with NO two consecutive identical symbols:

    • For the 1st1^{\text{st}} position, there are 33 choices.

    • For the 2nd2^{\text{nd}} position, it cannot be equal to the 1st1^{\text{st}} symbol, leaving 22 choices.

    • For the 3rd3^{\text{rd}} position, it cannot be equal to the 2nd2^{\text{nd}} symbol, leaving 22 choices.

    • For the 4th4^{\text{th}} position, it cannot be equal to the 3rd3^{\text{rd}} symbol, leaving 22 choices.

    • For the 5th5^{\text{th}} position, it cannot be equal to the 4th4^{\text{th}} symbol, leaving 22 choices.

    Number of strings without consecutive identical symbols=3×24=3×16=48\text{Number of strings without consecutive identical symbols} = 3 \times 2^4 = 3 \times 16 = 48
  3. Number of required strings:

    Required strings=243−48=195\text{Required strings} = 243 - 48 = 195

Thus, the correct answer is 195.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Combinatorics previous year question is Q30 of the GATE CSE 2025 Set 1 paper. Find more GATE CSE PYQs on Combinatorics in Engineering Mathematics, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Combinatorics PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Combinatorics in GATE CSE

Combinatorics has 19 GATE CSE PYQs across 15 papers from 2012 to 2025. 5 of them are 1-mark NAT questions like this one, and it is the only one in GATE CSE 2025 Set 1.

How GATE tests Combinatorics

More from GATE CSE 2025 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 1 · Q30 · NAT

Let S be the set of all ternary strings defined over the alphabet {a, b, c}. Consider all strings in S 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)

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.