GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • Fundamentals & OOPs
  • Data structures and algorithms
  • Aptitude
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 27 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
AptitudeLogical reasoning · Patterns and Codes

Coding and Decoding

Find the hidden rule that turns words into codes (shifts, opposite letters, numbers, substituted words and symbols) and apply it.

6 min read 45 questions
Practice questions
CATDBU+1

On this page

1/10
  1. 011. What coding and decoding tests
  2. 022. Letter positions and opposite letters
  3. 033. Letter shifting
  4. 044. Reverse-alphabet and rearrangement codes
  5. 055. Word-to-number codes
  6. 066. Sentence codes and "is called" chains
  7. 077. Symbol codes and conditions
  8. 088. Shortcuts and traps
  9. 099. Revision sheet
  10. 10Practice
Back to top

1. What coding and decoding tests

In a coding question a word, a number or a sentence is rewritten by a hidden rule. You are shown one or two examples and must find the rule and apply it to a new word (coding), or run it backwards to recover the original (decoding).

Tests like these questions because nothing needs to be memorised except the alphabet. What is measured is whether you compare the example with its code carefully, letter by letter, before jumping to an answer.

  • Letter codes: each letter is moved along the alphabet, swapped with its opposite, or the word is rearranged.
  • Number codes: letters become their positions, and a word becomes a number built from them.
  • Substitution codes: whole words are replaced by other words ("sky is called sea", or sentences in a made-up language).
  • Symbol codes: a table gives a digit or symbol for each letter, sometimes with extra conditions.

2. Letter positions and opposite letters

Every method in this chapter rests on knowing each letter's position: A = 1, B = 2, … Z = 26.

A1B2C3D4E5F6G7H8I9J10K11L12M13N14O15P16Q17R18S19T20U21V22W23X24Y25Z26
Anchor letters E, J, O, T, Y sit at 5, 10, 15, 20, 25. Any other letter is one or two steps from an anchor.

The opposite of a letter is the letter at the same place counted from the other end: A↔Z, B↔Y, C↔X. The positions of opposite letters always add up to 27, so the opposite of the letter at position p is at 27 − p.

ABCDEFGHIJKLMZYXWVUTSRQPON
Opposite letters: each letter in the top row pairs with the one below it.

Pairs worth remembering: A–Z, E–V, H–S, I–R, L–O, M–N. For anything else use 27 − p: the opposite of K (11) is at 16, which is P.

3. Letter shifting

The most common code moves every letter a fixed number of places. Write the word above its code and note the move for each letter.

Worked example. ROAD is written as URDG. How is LAMP written?

WordROADCodeURDGWordLAMPCode????
Line the word up with its code, then do the same for the new word.

R→U (+3), O→R (+3), A→D (+3), D→G (+3): every letter moves 3 forward. So LAMP becomes L→O, A→D, M→P, P→S, that is ODPS.

Shifts that change with position

If the moves are not all equal, list them. TIGER → UKJIW gives +1, +2, +3, +4, +5: the shift grows by 1 at each position. Other favourites are +1, −1, +1, −1 (alternating) and +2, +4, +6.

The alphabet is a circle. Going forward past Z you continue from A, and going backward past A you continue from Z: Y and Z moved 3 forward become B and C.

4. Reverse-alphabet and rearrangement codes

Opposite-letter code. Each letter is replaced by its opposite. GOLD becomes G (7) → T (20), O (15) → L (12), L (12) → O (15), D (4) → W (23), that is TLOW. You can spot this code because position + position = 27 for every letter.

Reversal. The letters of the word are written backwards, often together with a shift. STAR → SBUT: position by position the shifts are +0, +8, −6, +2, which looks random. Reverse the word first (RATS) and the pattern is clear: every letter is +1.

  • If the code contains the same letters as the word, the letters were only rearranged: find the new order.
  • If the shifts look random, compare the code with the word written backwards.
  • If the shifts are large and unequal, test for opposites (do the positions add up to 27?).

5. Word-to-number codes

Here a whole word becomes a single number. Write the position of every letter, then test the usual rules in this order.

RuleCAB givesHIDE gives
Sum of positions626
Sum × number of letters18104
First position × last position640
Sum of positions counted from Z (Z = 1 … A = 26)7582
Consonant positions − vowel positions4-2

Worked example. CAB = 6 and FED = 15. Find HIDE. CAB: 3 + 1 + 2 = 6. FED: 6 + 5 + 4 = 15. Both fit the plain sum, so HIDE = 8 + 9 + 4 + 5 = 26.

A rule must fit every example given. If the plain sum fits the first word but not the second, drop it and try the next rule.

6. Sentence codes and "is called" chains

Sentences in a code language

Each word has its own code word, but the code words are jumbled inside a sentence. Compare two sentences: the word they share must match the code they share.

No.SentenceCode1sun is brightma ti ko2moon is palene ru ma3bright moon risesdo ti ru
Three sentences and their codes.
  1. Sentences 1 and 2 share only "is" and only the code "ma", so is = ma.
  2. Sentences 1 and 3 share only "bright" and "ti", so bright = ti.
  3. Sentence 1 has one word and one code left: sun = ko. This last step is elimination.

"Is called" chains

In "white is called blue, blue is called red, red is called green", a question such as "what is the colour of blood?" has two steps. First answer in real life (blood is red). Then read what red is called (green). The answer is green, not the colour that is called red.

7. Symbol codes and conditions

A table gives a digit or symbol for each letter. Without conditions, coding is plain look-up: go through the letters in order and copy each code. The only mistakes possible are reading the wrong column or changing the order.

Bank-style questions add conditions about the first and last letters, for example "if the first letter is a vowel and the last is a consonant, interchange their codes". Work in this order:

  1. Mark the first and last letters as vowel or consonant.
  2. Decide which condition applies. Often none does, and that is a valid case.
  3. Code the middle letters straight from the table.
  4. Code the two ends as the condition says.

8. Shortcuts and traps

  • Check the first and last letters of each option before coding the whole word. Two letters usually remove three options.
  • Write the shift for every position, not just the first two. A code that starts +1, +2 may continue +3, +4 or go back to +1.
  • For decoding, reverse the rule: if coding moved letters forward, decoding moves them backward.
  • In sentence codes, start with the word that appears in the most sentences.

Traps

  • Coding when asked to decode, or the other way round. Read which of the two is given.
  • Counting from 0. A is 1, not 0. A sum that is too small by the number of letters is this mistake.
  • Forgetting to wrap past Z or before A.
  • Reading the chain backwards in "is called" questions.
  • Assuming the code words keep the order of the sentence. They do not, unless the question says so.

9. Revision sheet

Code typeHow to crack it
Fixed shiftword over code; one shift fits all letters
Changing shiftlist the shifts; look for +1, +2, +3 or +k, −k
Opposite letterspositions add up to 27
Reversalcompare the code with the word written backwards
Word to numberpositions → sum, sum × letters, first × last, count from Z
Sentence codeshared word = shared code; then eliminate
"Is called" chainreal answer first, then what that is called
Symbol tablelook up in order; apply first-and-last conditions last

Anchors: E 5, J 10, O 15, T 20, Y 25. Opposites: A–Z, E–V, H–S, I–R, L–O, M–N.

Practice

45 questions in 3 sets. Every answer comes with its explanation, and each question you get right earns XP.

  • Easy · 15
  • Medium · 15
  • Hard · 15
Start practising
PreviousNumber and Letter SeriesNextAnalogy
Log inStart free