New UPSC Foundation, Optional and TSPSC/APPSC batches are open — book a free demo class.Today'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 UPSC question has been asked directly on this micro-topic yet. Use the practice questions below.

Practice questions

Practice MCQ 1

In a code, letters at odd-numbered positions are shifted two places forward and letters at even-numbered positions one place backward. Positions are counted from the left, starting at 1, and the alphabet wraps around. How is ZEBRA coded?

  • A. BDDQC
  • B. BFDQC
  • C. YDDQC
  • D. BDDRC

Practice MCQ 2

In a consistent one-to-one word code, token order is unspecified. 'clean rivers matter' is coded as 'zo ki pa'; 'rivers support life' as 'ki tu ne'; and 'clean life thrives' as 'pa ne ra'. Which token means 'matter'?

  • A. ki
  • B. pa
  • C. zo
  • D. ne

Practice MCQ 3

A word is coded by multiplying the sum of its letters' alphabet positions by its number of letters, using A = 1 through Z = 26. Thus, CAT is coded as 72. What is the code for FROG?

  • A. 46
  • B. 138
  • C. 180
  • D. 184
Mains practice · As a descriptive reasoning exercise, explain why a coding rule that fits one example need not be uniquely valid. Discuss how validation, explicit conventions and recognition of information loss improve decoding accuracy. (150 words)
  • This is a learning exercise, not a claim that coding-decoding is a standard descriptive Mains topic.
  • A limited example can fit several competing transformations.
  • Test the proposed rule against all examples and character positions.
  • Specify alphabet values, wraparound, grouping and operation order.
  • Contrast reversible substitution with a many-to-one alphabet-position sum.
  • Identify unresolved ambiguity instead of asserting an unsupported mapping.

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.

Book a free demo class

Talk to a counsellor about the right batch, timings and preparation plan. No fee to attend a demo session.

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.

Take the Daily Quiz
Call nowWhatsApp