Coding-Decoding for UP Police Constable Reasoning

intermediate 18 min read

Concept

Coding-Decoding is a reasoning topic where a word or number is transformed using a hidden rule, and you must apply that same rule to find the code for a new word — or decode a given code back to the original word.

Think of it like a lock and key. The "code pattern" is the lock mechanism. Once you identify the mechanism from the given example, you use the same mechanism on the new input to get the output. The exam never changes the mechanism mid-question.

Here is a useful real-world analogy: imagine a spy sending messages where every letter is replaced by the one two places ahead in the alphabet. If the spy writes "CNGKF" for "AKHID," you figure out the shift, then decode any other message the same way. Every coding-decoding question in the exam works on this exact principle — find the rule once, apply it consistently.

In the UP Police Constable exam, coding-decoding questions appear in the Reasoning section and test your ability to spot patterns quickly. The patterns you will encounter fall into five main families:

  1. Letter-shift coding — each letter shifts by a fixed or varying number of positions (forward or backward in the alphabet).
  2. Atbash / mirror coding — A maps to Z, B to Y, C to X, and so on (the alphabet is reversed).
  3. Word reversal — the entire word is simply written backwards.
  4. Number coding — letters are replaced by their alphabetical position values, sometimes summed or manipulated.
  5. Sentence / number-group coding — a phrase like "sky is blue" is replaced by "642," and you identify which number codes which word by finding overlaps across multiple coded sentences.

The key skill is not memorising patterns — it is training yourself to test multiple hypotheses in under 30 seconds and confirm or eliminate each one. By the time you finish this page, you will have a decision tree that tells you exactly which hypothesis to test first.


Deep Dive

Family 1 — Letter-Shift Coding

Write the alphabet A–Z and assign positions 1–26. In forward-shift coding, each letter moves a fixed number of steps ahead. In backward-shift coding, it moves back.

Example: A + 3 = D, B + 3 = E, Z + 3 = C (wrap around from Z to A).

Wrap-around rule: If a letter goes beyond Z, subtract 26. If it goes before A, add 26. Exam questions will often state this explicitly as "continue from A" or "continue from Z."

Varying-shift patterns are more common in UP Police papers. Here the shift changes by position: position 1 shifts by +2, position 2 by +3, position 3 by +1, etc. To crack these, list the shift for each position separately from the given example, then replicate.

How to find the shift quickly: write the original letter and the coded letter side by side, then compute coded_position − original_position for each letter. If all differences are equal — fixed shift. If they differ — note the pattern of differences.

Family 2 — Atbash / Mirror Coding

The rule here: position of letter + position of its code = 27. So A(1) ↔ Z(26), B(2) ↔ Y(25), M(13) ↔ N(14).

Recognition test: take any letter and its code. Add their alphabetical positions. If the sum is consistently 27, it is Atbash.

This is the fastest pattern to confirm — just check two or three letter pairs. If they all sum to 27, you are done.

Family 3 — Word Reversal

The entire word is spelled backwards. RAIN → NIAR. CLOUD → DUOLC.

Confirmation: check if the last letter of the code is the first letter of the original.

When a question asks about a specific position in the coded word, reverse the word first, then count from the direction specified. Do not rush the direction — "second from right" and "second from left" are common traps.

Family 4 — Number Coding (Sum of Positions)

Each letter is replaced by its alphabetical position (A=1, B=2, ... Z=26), and then those values are summed. So PIZZA = P(16) + I(9) + Z(26) + Z(26) + A(1) = 78.

Recognition: if the code is a single number and the given examples are consistent with position-sum, this is your pattern. Add positions quickly using mental math — group letters near 10 (J=10, I=9, K=11) as anchors.

Family 5 — Sentence / Number-Group Coding

You are given two or three coded sentences and their English equivalents. You must find which number corresponds to which word by identifying overlaps.

Method: find a word that appears in two different English sentences. The number that appears in both corresponding codes is the code for that word.

Example: "642" = sky is blue, "417" = blue and beautiful. The word "blue" appears in both. The number "4" appears in both codes. Therefore 4 = blue.

When three sentences are given, use the same intersection technique — always look for the word that appears in exactly two sentences and find its matching number.

Mixed / Conditional Letter Rules

A variation common in recent papers: vowels follow one rule, consonants follow another. For example, vowels shift +1 (A→B, E→F) while consonants shift −1 (B→A, C→B, T→S). Always identify the vowels (A, E, I, O, U) and consonants separately before applying rules.


Memory Tricks & Shortcuts

pattern27-Sum Atbash Check

When you see a coded word and suspect mirror/Atbash coding, take the first letter of the original and the first letter of the code. Add their alphabetical positions. If the sum is 27, confirm with one more pair — you're done. No need to decode all letters first.

Micro-example: WINDOW → DRMWLD. W=23, D=4. 23+4=27. Confirmed Atbash in 5 seconds. Standard approach (trying shifts for each letter): 40+ seconds. Atbash check: under 10 seconds.

patternReverse-and-Count for Word Reversal

Write the coded word. Number its letters from left. Then immediately rewrite from right to left — that is your original word. For position-based sub-questions ("second letter from right in coded word"), do NOT reverse — just count from the right end directly on the coded word.

Micro-example: Coded word DUOLC (5 letters). Second from right: D(5)-U(4)-O(3)-L(2)-C(1). Second from right = L. This avoids the common error of reversing first and then miscounting. Saves 1-2 re-reads per question.

eliminationIntersection Method for Number-Group Coding

List all words from sentence A. List all words from sentence B. Circle the common word. Now list all numbers from code A. List all numbers from code B. Circle the common number. Common word = common number. No guessing needed.

Micro-example: "642"=sky is blue, "52"=is calm. Common word: "is". Common number: "2". Therefore 2=is. Standard method (trial and error): 4-5 steps. Intersection method: 2 steps.

patternAnchor-Letter Position Recall

Memorise five anchor positions: E=5, J=10, O=15, T=20, Y=25. Any other letter = nearest anchor ± small offset.

Micro-example: R = T(20) − 2 = 18. N = O(15) − 1 = 14. For number-sum questions, use anchors to compute letter values in under 3 seconds each instead of counting A-B-C-D from scratch (saves 5-8 seconds per word on 5-letter words).

eliminationVowel-Consonant Split for Conditional Codes

Before reading the transformation rule, underline all vowels (A,E,I,O,U) in the original word and circle the consonants. Apply the two rules to the two groups separately. This prevents the most common error of applying one rule to the entire word.

Micro-example: ABACTERIAL — underline A,A,E,I,A; circle B,C,T,R,L. Apply vowel rule (+1) and consonant rule (−1) to separate groups. Time saving: eliminates 1 re-do when you catch a mid-word error.


Fast-Solving Framework

When you open a coding-decoding question in the exam hall, run this decision tree in sequence:

Step 1 — What type is the input? If it is a single number as the code, go to number coding (sum of positions). If it is a group of numbers with multiple sentences, go to intersection method. If the code is a word or letter string, continue.

Step 2 — Check Atbash first (fastest to confirm): add positions of first letter of original + first letter of code. If sum = 27, confirm with one more pair. Done in under 10 seconds.

Step 3 — Check reversal: is the last letter of the code the same as the first letter of the original? If yes, it is reversal. Done in 5 seconds.

Step 4 — Compute position differences for each letter pair. Write them as a sequence. Are they all equal (fixed shift)? Or do they follow a pattern (+2,+3,+1,+3,+2)?

Step 5 — Check for vowel/consonant split: if no uniform pattern emerges in Step 4, separate vowels from consonants and check if each group follows its own shift rule.

Apply the confirmed rule to the new word. Double-check your wrap-around arithmetic (Z→A, A→Z). Mark. Move on.


Solved PYQs

Why this question — Tests your ability to identify the Atbash cipher, the most frequently appearing mirror-code pattern in UP Police papers.

Previous Year Questionपिछले वर्ष का प्रश्न2026
In a certain code language, if WINDOW is coded as DRMWLD and PLANET is coded as KOZMVG, then SATURN will be coded as ______ in the same code language.
किसी विशिष्ट कोड भाषा में, यदि WINDOW को DRMWLD और PLANET को KOZMVG के रूप में कोडित किया जाता है, तो उसी कोड भाषा में SATURN को ______ के रूप में कोडित किया जाएगा।
  1. NRUTAS
  2. TASNRU
  3. NRQSAT
  4. HZGFIM
  1. NRUTAS
  2. TASNRU
  3. HZGFIM
  4. NRQSAT
Solutionसमाधान
The pattern is Atbash cipher (A↔Z, B↔Y, etc.). SATURN: S→H, A→Z, T→G, U→F, R→I, N→M = HZGFIM.

Solving path: Take W and D — alphabetical positions 23 and 4. Sum = 27. That is Atbash. Confirm with I(9) and R(18): 9+18=27. Confirmed. Now apply to SATURN: S(19)→H(8), A(1)→Z(26), T(20)→G(7), U(21)→F(6), R(18)→I(9), N(14)→M(13). Code = HZGFIM. Match option D.


Why this question — Tests number-group coding and the intersection method, which appears in UP Police papers with 2–3 sentence setups.

Previous Year Questionपिछले वर्ष का प्रश्न2026
In a certain code, '642' means 'sky is blue', '52' means 'is calm' and '417' means 'blue and beautiful'. What number will indicate the word 'blue'?
एक विशिष्ट कोड में '642' का अर्थ 'sky is blue', '52' का अर्थ 'is calm' और '417' का अर्थ 'blue and beautiful' है। कौन-सी संख्या 'blue' शब्द को दर्शाएगी?
  1. 4
  2. 6
  3. 7
  4. 5
  1. 4
  2. 7
  3. 5
  4. 6
Solutionसमाधान
'642' = sky is blue; '417' = blue and beautiful. The common code between these two is '4', which corresponds to 'blue'.

Solving path: "642" contains sky, is, blue. "417" contains blue, and, beautiful. The only common word is "blue." The only common number between 642 and 417 is "4." Therefore 4 = blue. Answer: option A.


Why this question — Tests number-to-letter decoding using two given examples to establish the key.

Previous Year Questionपिछले वर्ष का प्रश्न2026
If JACKET is coded as 146542 and COAT is coded as 6942, then what word does the code 6965 represent in the same code language?
यदि JACKET को 146542 के रूप में कोडित किया जाता है और COAT को 6942 के रूप में कोडित किया जाता है, तो उसी कोड भाषा में कोड 6965 किस शब्द को निरूपित करता है?
  1. CKCO
  2. KOKC
  3. COCK
  4. KCKO
  1. KCKO
  2. KOKC
  3. CKCO
  4. COCK
Solutionसमाधान
From JACKET=146542: J=1,A=4,C=6,K=5,E=4,T=2. From COAT=6942: C=6,O=9,A=4,T=2. So 6=C, 9=O, 6=C, 5=K → COCK. Wait: 6965 → C,O,C,K? But K=5 not in JACKET. Checking: C=6, O=9, C=6, K=5 → but 6965: 6=C, 9=O, 6=C, 5=K → COCK. The code 6965 decodes as C-O-C-K = COCK.

Solving path: From JACKET=146542: J=1, A=4, C=6, K=5, E=4, T=2. From COAT=6942: C=6, O=9, A=4, T=2 — consistent with JACKET values. Now decode 6965: 6=C, 9=O, 6=C, 5=K → COCK. Answer: option C.


Why this question — Tests word-reversal coding with a position-based sub-question, a classic trap for rushed readers.

Previous Year Questionपिछले वर्ष का प्रश्न2026
In a certain code language, 'RAIN' is written as 'NIAR' and 'SNOW' is written as 'WONS'. Following the same pattern, for the word 'CLOUD', what will be the second letter from the right in the coded word and the third letter from the left end in the original word respectively?
एक विशिष्ट कोड भाषा में, 'RAIN' को 'NIAR' और 'SNOW' को 'WONS' लिखा जाता है। इसी पैटर्न का पालन करते हुए, 'CLOUD' शब्द के लिए, सांकेतिक शब्द में दाईं ओर से दूसरा अक्षर और मूल शब्द में बाईं ओर से तीसरा अक्षर क्रमशः क्या होगा?
  1. U and L
  2. D and L
  3. D and O
  4. L and O
  1. D और L
  2. U और L
  3. D और O
  4. L और O
Solutionसमाधान
The code reverses the word: CLOUD → DUOLC. Second letter from right in DUOLC = U. Third letter from left in CLOUD = O. Wait — U and O doesn't match any option exactly. Second from right of DUOLC: D-U-O-L-C, position from right: C(1),L(2),O(3),U(4),D(5). Second from right = L. Third from left of CLOUD = O. So L and O = option D. But answer key shows B (U and L). Rechecking: coded word DUOLC, second from right = L; original CLOUD third from left = O. Answer is (D) L and O.

Solving path: RAIN→NIAR (reversed). SNOW→WONS (reversed). Pattern confirmed: reversal. CLOUD reversed = DUOLC. Now: "second letter from the right in the coded word" — coded word is DUOLC. From the right: C(1st), L(2nd), O(3rd), U(4th), D(5th). Second from right = L. "Third letter from the left in the original word" — original is CLOUD: C(1st), L(2nd), O(3rd). Third from left = O. Answer = L and O. Match option D. Note: the answer key in different paper sets has varied — always recheck the position counting carefully.


Why this question — Tests sequential assignment coding, a less common but exam-relevant pattern where letters within a word get re-coded by their order of appearance.

Previous Year Questionपिछले वर्ष का प्रश्न2026
In a certain code language, each letter of a word is replaced by another letter following a specific pattern. For example, 'BADAM' is coded as 'ABCBD' and 'SEED' is coded as 'EFFC'. Using the same pattern, what is the code for 'BASED'?
एक विशिष्ट कोड भाषा में, किसी शब्द के प्रत्येक अक्षर को एक विशेष पैटर्न के अनुसार दूसरे अक्षर से प्रतिस्थापित किया जाता है। उदाहरण के लिए, 'BADAM' को 'ABCBD' और 'SEED' को 'EFFC' के रूप में कोडित किया जाता है। इसी पैटर्न का उपयोग करते हुए, 'BASED' का कोड क्या होगा?
  1. AABFC
  2. ACEFC
  3. ABDFC
  4. ABEFC
  1. ABEFC
  2. ACEFC
  3. ABDFC
  4. AABFC
Solutionसमाधान
From BADAM→ABCBD: B→A, A→B, D→C, A→B, M→D (each letter maps to next in sequence A,B,C...). From SEED→EFFC: S→E, E→F, E→F, D→C. Pattern: assign sequential letters. BASED: B→A, A→B, S→E, E→F, D→C = ABEFC.

Solving path: Observe BADAM→ABCBD and SEED→EFFC. In BADAM, the letters in order of first appearance are B,A,D,M — assign them A,B,C,D. So B=A, A=B, D=C, M=D. Re-encode BADAM: B→A, A→B, D→C, A→B, M→D = ABCBD. Confirmed. For SEED: S,E,D are the distinct letters in order of appearance — assign S=E, E=F, D=C (continuing the master alphabet assignment). SEED: S→E, E→F, E→F, D→C = EFFC. Confirmed. Now BASED: B→A, A→B, S→E, E→F, D→C = ABEFC. Answer: option D.


Common Mistakes


Related Topics

Practice on SarkariRise

Sign up + get 3 free mocks →