GATE CSE 2025 Session 1 Q30: Ternary strings of length 5 with a repeated adjacent symbol
- Engineering Mathematics
- 1 mark
- NAT
- No negative marking
Question
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)
Try it: numerical answer: type the value
Show answer and explanation
Answer: 195 (official GATE 2025 final answer key)
Concept used: Complementary counting: count strings with no two equal adjacent symbols and subtract.
First step: Strings with no equal neighbours: 3 choices for the first symbol and 2 for each later one, i.e. ; subtract from .
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2025 Session 1 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Engineering Mathematics PYQs
- 2026 Session 1 · Q11Pólya urn: equal red and blue after two steps
- 2026 Session 1 · Q124×4 binary matrices with even parity in every row and column
- 2026 Session 1 · Q13Maximum multiplicity of an eigenvalue of an n×n real matrix
- 2026 Session 1 · Q20Matrix with e2 in its null space: determinant and rank
- 2026 Session 1 · Q32Continuity at 0 of c1·e^x − c2·ln(1/x)
- 2026 Session 1 · Q46Extrema and smoothness of (|x|/2 − x)(x − |x|/2)