Coding‑Decoding – Study Notes for RRB‑Group‑D
(Reasoning Ability – Competitive Exam)
Why it matters
In RRB‑Group‑D, coding‑decoding questions test quick pattern recognition, logical deduction and mental math.
Mastery of this topic gives you an edge over 80 % of the candidates.
1. What is Coding‑Decoding?
- Coding: A set of letters, numbers or symbols is encoded into another set according to a fixed rule.
- Decoding: The reverse process – converting the encoded set back into the original (or to a new set that follows the same rule).
The key is that every digit/letter has a unique partner in the code.
2. Common Coding Schemes
| Scheme | Example | Rule (in words) | Formula (if any) |
|---|---|---|---|
| Simple Substitution | A → 2, B → 4, C → 6 | Multiply position by 2 | code = 2 × position |
| Positional Shift | A → C, B → D | Shift forward by 2 letters | code = ((pos + 2 − 1) mod 26) + 1 |
| Reverse Order | A → Z, B → Y | Reverse alphabet | code = 27 − pos |
| Mirror‑Pair | A → Z, B → Y, C → X | Mirror around the centre | code = 27 − pos |
| Alternating Pattern | A → 1, B → 3, C → 5 | Add 1, skip 2 | code = 2 × pos − 1 |
| Cyclic Shift | A → D, B → E, … | Shift by 3 | code = ((pos + 3 − 1) mod 26) + 1 |
| Mixed Numeric‑Alpha | 1 → A, 2 → C, 3 → E | Odd numbers → odd letters | code = 2 × pos − 1 |
| Custom Mapping | A → 5, B → 3, C → 8 | Given mapping table | No formula – memorize |
Tip: Look for simple arithmetic (×2, +3, −1, modulo) before assuming a complex rule.
3. Step‑by‑Step Decoding Process
-
Write down the given pair(s).
Example:A → 4, B → 8, C → 12. -
Identify the pattern
- Look at the gaps: 4, 8, 12 → increments of 4.
- Check if the relation is linear:
code = 4 × position.
-
Confirm with all given pairs.
If any pair breaks the rule, reconsider or look for a piecewise rule. -
Apply the rule to decode the unknown.
Example:D → ?→4 × 4 = 16. -
Cross‑check using reverse mapping (if needed).
Sometimes the question asks for the original before encoding.
4. Tricky Points & Common Pitfalls
| Pitfall | How to avoid |
|---|---|
| Assuming arithmetic when it's a simple letter shift | Check if the letters appear in the same order (A, B, C…) or reversed (Z, Y, X…). |
| Missing the “mod 26” wrap‑around | Remember that after Z comes A again when shifting. |
| Ignoring the possibility of two‑digit numbers | If numbers exceed 9, check if they represent two letters (e.g., 12 → L). |
| Overlooking the possibility of a mirror rule | Mirror rule often shows as A↔Z, B↔Y. |
| Confusing “coding” with “decoding” | Always read the question carefully: “Find the code of …” vs “Find the original of …”. |
5. Derivation of Common Formulae
-
Linear Scaling
Ifcode = k × position- Find
kby dividing the code by the position. - Example: 4 / 1 = 4, 8 / 2 = 4 →
k = 4.
- Find
-
Linear Shift
Ifcode = position + k- Compute
k = code – position. - Example:
C (3) → 7:k = 7 – 3 = 4.
- Compute
-
Modular Shift
code = ((position + k – 1) mod 26) + 1- Use this when the code wraps after Z.
- Example:
X (24) → C (3)withk = 5:
((24 + 5 – 1) mod 26) + 1 = (28 mod 26) + 1 = 2 + 1 = 3.
-
Mirror (Reverse) Coding
code = 27 – position- Because 1 ↔ 26, 2 ↔ 25, …
- Example:
A (1) → Z (26):27 – 1 = 26.
6. Quick Mental Math Tricks
| Situation | Trick |
|---|---|
| Multiplying by 2 | Double the number mentally. |
| Adding or subtracting 1 | Shift letter forward/backward. |
| Modulo 26 | If sum > 26, subtract 26. |
| Mirror rule | Subtract position from 27. |
| Odd‑even mapping | Odd positions → odd letters (A, C, E,…). |
7. Practice Question (Hard)
Question
In a coding system, the following mappings are given:
H → 6, E → 3, L → 12, O → 15, W → 23, R → 18, D → 4.(a) Write the code for the word “HELLO”.
(b) Decode the number 20 back to its letter.
(c) What is the code for the word “WORLD”?
Answer
(a)
- H (8) → 6 →
code = 6- E (5