New UPSC Foundation, Optional and TGPSC/APPSC batches are open — book your counselling slot.Today's Current AffairsToday's Daily QuizCall 98804 87071

Prelims GS-II (CSAT) · Reasoning · Logical and analytical reasoning

Coding-decoding

Coding-decoding questions test the ability to identify a rule that transforms letters, words, numbers or symbols and then apply that rule consistently. For CSAT, the central skills are pattern recognition, accurate calculation, comparison of examples and elimination of incompatible options. The safest method is to identify what changes, what remains unchanged and whether the proposed rule explains every supplied example.

1. Scope and basic reasoning principles

In a coding-decoding problem, an ordinary expression is represented in another form according to a hidden or stated rule. Coding moves from the original expression to its representation; decoding attempts the reverse. The objects involved may be letters, digits, complete words or arbitrary symbols. These problems assess disciplined inference rather than knowledge of a specialised subject.

Begin by inspecting the structure of the input and output. An unchanged length may suggest substitution, rearrangement or both. A word represented by one number may suggest an aggregate such as the sum of alphabet positions. A longer output may use two-digit letter values or additional markers. These are working hypotheses, not universal rules.

Distinguish a reversible transformation from a many-to-one code. Replacing each letter with the next letter permits unique reversal. Adding letter positions does not: AB and BA both total 3. Therefore, a numerical aggregate may allow coding without uniquely allowing decoding. Never assume that every supplied code can reconstruct the original word.

The examination objective is to establish the simplest rule consistent with the evidence and the question's constraints. Avoid inventing complicated exceptions merely to rescue an early guess. If two plausible rules yield different answers, look for another example, a stated restriction or an option that resolves the ambiguity.

  • Read whether the task asks for a code, a decoded expression, a missing element or an incorrect pair.
  • Check lengths, repeated characters, end letters and obvious numerical relationships before calculating.
  • Separate what the question explicitly states from conventions that you are merely assuming.

2. Alphabet tools and letter transformations

Write a compact alphabet-position strip when repeated conversions are required. Useful anchors include E = 5, J = 10, O = 15, T = 20 and Z = 26. For reverse-alphabet substitution, pair A with Z, B with Y and so on. The ordinary positions of opposite letters add to 27; thus the opposite of a letter at position p is at position 27 − p.

A fixed shift moves every letter by the same amount. Under a forward shift of two places, CAT becomes ECV. Unless otherwise specified, alphabet-shift questions commonly wrap around: Y shifted forward by three places becomes B. Confirm this convention from the wording or examples rather than applying it automatically to every number code.

Variable shifts depend on location or another property. With successive shifts of +1, +2, +3 and +4, MATH becomes NCWL. Alternating shifts may follow +1, −1, +1, −1. Record each input-output difference instead of calculating only the first letter and extrapolating without verification.

Rearrangement changes order rather than identity. Common patterns include reversal, swapping adjacent letters, placing odd-position letters before even-position letters, or interchanging word halves. To distinguish rearrangement from substitution, compare letter counts. A pure rearrangement preserves every letter and its frequency.

Mixed transformations require careful attention to sequence. Reversing a word and applying one fixed shift gives the same result as shifting and then reversing. This is not generally true for position-dependent shifts, because reversal changes which letter occupies each position. Write intermediate outputs when two operations are involved.

  • For a shift difference, compare output position with input position and account for wraparound.
  • For reversal, inspect whether the first input letter corresponds to the last output letter.
  • For mixed rules, test the transformation on the whole example, including repeated letters.

From observation to verified answer

  1. 1. Read the task, conventions and exceptions.
  2. 2. Compare lengths, positions, repetitions and shared elements.
  3. 3. Classify the likely coding family.
  4. 4. Form a simple candidate rule.
  5. 5. Test it against every supplied example.
  6. 6. Apply it to the target and verify the selected option.

3. Number codes, word substitutions and conditional rules

In number coding, a word may be represented by individual alphabet values or by an operation on them. CAT can appear as 3-1-20 when positions are listed, or 24 when they are added. Other questions may involve differences, products, word length or vowel counts. Test simple operations first and verify the rule against every example before considering more elaborate arithmetic.

Pay attention to separators and digit grouping. The uninterrupted string 112 is ambiguous under variable-width alphabet positions: it might represent 1-1-2, 1-12 or 11-2. A stated two-digit convention, such as A = 01 and L = 12, removes this particular ambiguity. Do not silently choose a grouping that happens to produce a familiar word.

In an artificial-language problem, complete words are replaced by tokens. If 'red blue' becomes 'ka ti' and 'blue green' becomes 'ti mo', the common word blue corresponds to the common token ti, provided the coding is a consistent one-to-one substitution and token order is unspecified. The remaining mappings are red = ka and green = mo.

A common intersection does not always identify a unique mapping. If two statements share two words and two tokens, the pair may be identified without determining which token represents which word. A third statement may resolve the issue. Keep unresolved possibilities explicit rather than guessing from token order.

Conditional coding provides a base mapping and additional instructions. For instance, vowels may receive one treatment while consonants receive another, or the first and last characters may be exchanged under a specified condition. Read all exceptions before producing the final code. If two conditions overlap, follow any priority given in the question.

  • Use a mapping table for word-token substitutions.
  • Distinguish a number used as a label from a number generated by arithmetic.
  • Check conditions concerning first position, last position, parity and repeated characters.
Common coding families and their first diagnostic checks
FamilyIllustrationFirst check
Fixed alphabet shiftCAT → ECVEach letter moves forward by two places.
Reverse-alphabet substitutionCAT → XZGInput and output alphabet positions sum to 27.
RearrangementTRAIN → NIARTThe letter sequence is reversed.
Position-dependent shiftMATH → NCWLSuccessive shifts are +1, +2, +3 and +4.
Alphabet-position sumCAT → 243 + 1 + 20 = 24; reversal is not unique.
Word-token substitutionblue → tiFind common words and common tokens across statements.

4. A reliable CSAT solving strategy

First classify the likely family: letter transformation, numerical rule, word substitution or conditional mapping. Then place the example and its code in aligned rows. Mark positional differences, swapped locations or common elements. This makes a candidate rule visible and reduces working-memory errors.

Validation is the decisive stage. A rule inferred from one example must be checked against the remaining examples and every position within them. For an artificial language, use intersections across statements. For number coding, recalculate independently. If the proposed rule fails even one relevant observation, reject or revise it.

Use answer choices as constraints after identifying a plausible rule. A first-letter transformation, last-letter check or length comparison may eliminate several options quickly. However, an option matching one character is not enough: verify the complete selected answer. Option-based elimination should reduce work, not replace reasoning.

Manage time in relation to the full paper. The average available time is 90 seconds per question, although passages and multi-question sets require uneven allocation. If repeated attempts do not produce a stable rule, mark the item for review and move on. Timed practice should improve both accuracy and the ability to abandon unproductive hypotheses.

Maintain an error log organised by cause: alphabet-position mistakes, missed wraparound, wrong operation order, overlooked conditions and unjustified assumptions. Review the cause, not merely the correct answer. Short mixed sets are useful because they train recognition of the coding family rather than repetition of one memorised method.

  • Use a short rough-work notation: input, output, difference and candidate rule.
  • Reserve a final check for boundary letters such as A and Z and for exceptional conditions.
  • Do not spend disproportionate time searching for a uniquely intended rule in an under-specified practice item.

5. Connections with real information systems

Coding-decoding exercises provide a simplified introduction to representation, but they should not be confused with modern cryptography. Encoding changes how information is represented; encryption aims to protect confidentiality using a cryptographic method and usually a key. A classroom alphabet shift is useful for reasoning but does not provide meaningful modern security.

Real systems also demonstrate why conventions matter. ASCII assigns numerical values to characters; uppercase A has decimal value 65, not 1. Unicode supplies a much broader character repertoire. Neither convention should be imported into an aptitude question unless stated or clearly indicated.

Check digits illustrate another distinction. They are calculated from other digits to help detect transcription errors rather than to conceal information. Recognising these different purposes reinforces the central CSAT habit: establish the exact rule and its scope before manipulating the symbols.

  • Representation is not automatically secrecy.
  • A transformation may detect some errors without correcting them.
  • Context determines whether symbols express values, positions, labels or instructions.

Real-world case studies

The Caesar cipher: a fixed-shift model

The historical Caesar cipher replaces letters by a fixed alphabet shift. With a forward shift of three, A becomes D and CAT becomes FDW; decoding shifts backward by three. There are only 25 non-zero shifts in the 26-letter English alphabet, making exhaustive checking easy. It illustrates reversibility and wraparound, not secure modern encryption.

ISBN-13: coding for error detection

The ISBN-13 system used for books calculates a final check digit from the first 12 digits using alternating weights of 1 and 3. The check digit makes the weighted total divisible by 10. This detects all single-digit substitutions but not every possible transposition. It illustrates a stated positional rule whose purpose is validation rather than secrecy.

Previous year questions

No source-linked PYQ is available here yet. Use the practice questions below.

Practice questions

Practice MCQ 1 · Easy

In a code, every letter is replaced by the letter three places ahead in the English alphabet, with counting continuing from A after Z. Thus, GRAIN is coded as JUDLQ. How is WHEAT coded?

  • A. ZKHDU
  • B. YJGCV
  • C. ZKHDW
  • D. ZIFDW

Practice MCQ 2 · Easy

A code writes the letters of each word in reverse order without changing any letter. For example, TRAIN becomes NIART. What is the code for CLOUD?

  • A. DUOLC
  • B. DULOC
  • C. DOUCL
  • D. UODLC

Practice MCQ 3 · Easy

A word is coded by adding the positions of its letters in the English alphabet, taking A = 1, B = 2, ..., Z = 26. What is the code for BRICK?

  • A. 41
  • B. 42
  • C. 45
  • D. 43

Practice MCQ 4 · Easy

In an artificial language, each word has a unique code token, and token order need not match word order: 'blue river flows' = 'ka mi tu' 'river water rises' = 'mi se no' 'blue skies glow' = 'ka pa li' Which token represents 'blue'?

  • A. mi
  • B. ka
  • C. tu
  • D. pa

Practice MCQ 5 · Easy

A code replaces each letter with its opposite in the English alphabet: A ↔ Z, B ↔ Y, C ↔ X, and so on. How is JUDGE coded?

  • A. QFWTV
  • B. QFVWT
  • C. PFWTV
  • D. QGWTU

Practice MCQ 6 · Moderate

A word is coded in two steps: first reverse its letters; then shift letters in odd-numbered positions one place forward and letters in even-numbered positions two places backward. Positions are counted from the left after reversal, and shifts wrap around the alphabet. For example, MARKET becomes UCLPBK. What is the code for PLANET?

  • A. UCOBMQ
  • B. RFMZJQ
  • C. UCOYMN
  • D. UCNYMO

Practice MCQ 7 · Moderate

Each word has a distinct, fixed token in an artificial language. Tokens within each statement are unordered: 'fair rules protect rights' = 'zo ki ma te' 'clear rules guide action' = 'lu ki pa se' 'fair action earns trust' = 'zo se nu di' 'rights guide fair action' = 'te pa zo se' Which sequence gives the tokens for 'protect clear rights', in that order?

  • A. ma pa te
  • B. te lu ma
  • C. ma lu zo
  • D. ma lu te

Practice MCQ 8 · Moderate

Digits are initially replaced using this table: 0 → P, 1 → Q, 2 → R, 3 → S, 4 → T, 5 → U, 6 → V, 7 → W, 8 → X, 9 → Y. For a six-digit input, apply both of the following rules in the stated order: 1. If the first input digit is odd and the last input digit is even, interchange the first and last code symbols. 2. If the third and fourth input digits are identical, replace both corresponding code symbols with #. What is the final code for 731146?

  • A. WS##TV
  • B. VS##TW
  • C. VT##SW
  • D. VSQQTW

Practice MCQ 9 · Moderate

The numerical code of a word is aS + bL, where S is the sum of its letters' alphabet positions, L is its number of letters, and a and b are fixed positive integers. If MINT is coded as 124 and OAK as 63, what is the code for PINE?

  • A. 94
  • B. 97
  • C. 100
  • D. 103

Practice MCQ 10 · Moderate

A six-letter word is encoded by first interchanging letters in positions 1 and 2, 3 and 4, and 5 and 6. The letters in the resulting positions 1 through 6 are then shifted forward by 1, 2, 3, 4, 5 and 6 places respectively, with alphabetic wraparound. Which word produces BIGVSK?

  • A. GARDEN
  • B. DANGER
  • C. RANGED
  • D. GANDER

Practice MCQ 11 · Difficult

An eight-letter string is encoded as follows. Only A, E, I, O and U count as vowels. 1. If the original string has at least three vowels, shift its odd-position letters forward by two places and its even-position letters backward by one place. Otherwise, shift its odd-position letters backward by one place and its even-position letters forward by two places. All shifts wrap around the alphabet. 2. Write the transformed letters in positions 1, 3, 5, 7, followed by those in positions 2, 4, 6, 8. 3. Reverse the entire result. The final code is RDQNAPWL. Which of the following could be the original string? I. JOURNEYS II. MLXOQBBP III. JOURNALS

  • A. I only
  • B. I and II only
  • C. II and III only
  • D. I, II and III

Practice MCQ 12 · Difficult

Four words—red, blue, green and gold—are represented by four distinct tokens—ka, mi, tu and se. Token order within a row is irrelevant. Exactly one of the following five rows is incorrect; the other four follow the same one-to-one substitution: 1. red blue = ka mi 2. blue green = mi tu 3. green gold = tu se 4. gold red = se ka 5. red green = ka se After identifying the incorrect row, which sequence represents 'gold blue red', in that order?

  • A. tu mi ka
  • B. se ka mi
  • C. ka mi se
  • D. se mi ka

Practice MCQ 13 · Difficult

A four-digit PIN has digits a, b, c and d, with a nonzero. Its code consists, in order, of the units digits of a + b, b + c, c + d and d + a. A separate checksum records the ordinary sum a + b + c + d. A PIN has code 1353 and checksum 26. If its first digit is greater than its second digit, how many different PINs satisfy all these conditions?

  • A. 2
  • B. 3
  • C. 4
  • D. 5

Practice MCQ 14 · Difficult

An eight-letter message is encoded using A = 1, B = 2, ..., Z = 26. Let its original letter values be p1, p2, ..., p8. 1. The first intermediate value is p1. For each later position i, the intermediate value is p(i−1) + pi, reduced to the range 1–26 by subtracting 26 if necessary. 2. Convert these intermediate values to letters. 3. Write the intermediate letters in positions 1, 3, 5, 7, followed by the intermediate letters in positions 8, 6, 4, 2. If the final code is TWTMWNFL, what are the original letters in positions 2, 5 and 8, respectively?

  • A. R, U, E
  • B. T, S, E
  • C. R, S, E
  • D. R, E, E

Practice MCQ 15 · Difficult

Letters are coded by their ordinary alphabet positions without leading zeroes or separators: A = 1, B = 2, ..., Z = 26. The digit string 12112121 is known to represent exactly five letters. How many different five-letter strings can it represent if each string must contain exactly two vowel occurrences and those two vowels must be different? Only A, E, I, O and U count as vowels; the decoded strings need not be dictionary words.

  • A. 1
  • B. 3
  • C. 4
  • D. 2

Further reading

  • UPSC: Civil Services Examination notification, Preliminary Examination scheme and General Studies Paper II syllabus, upsc.gov.in.
  • UPSC: Previous Question Papers, Civil Services Preliminary Examination, General Studies Paper II, upsc.gov.in.
  • International ISBN Agency: ISBN Users' Manual and guidance on the ISBN-13 check digit, isbn-international.org.
  • The Unicode Consortium: The Unicode Standard and introductory material, unicode.org.

Preparing for UPSC Civil Services? Get classroom teaching, answer-writing evaluation and mentorship at Pragnya IAS Academy, Ashok Nagar — see why aspirants choose us for IAS coaching in Hyderabad.

Talk to a counsellor

Tell us your preparation stage and preferred programme — a counsellor will call back with batch timings and a study plan.

Or call 98804 87071 · Mon–Sat 9 am–7 pm

Free UPSC daily current affairs quiz — 10 questions, new every day at 8 am IST.

Call nowWhatsApp