T TestsWorld
← All topic guides

Coding-Decoding: formulas, shortcuts & solved examples

What it is

Coding-decoding questions show you a word or sentence written in a secret code and ask you to apply the same rule to a new word. The rule might shift letters, reverse the alphabet, replace letters with numbers, or map whole words to code words. Your job is to find the rule from the example and apply it carefully.

Key rules

Alphabet positions

A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, H = 8, I = 9, J = 10, K = 11, L = 12, M = 13, N = 14, O = 15, P = 16, Q = 17, R = 18, S = 19, T = 20, U = 21, V = 22, W = 23, X = 24, Y = 25, Z = 26.

Reverse positions

The opposite of a letter at position n is the letter at position 27 − n. So A pairs with Z, B with Y, C with X, and M with N. A quick memory aid is "EVOL" for E–V and O–L.

Common code types

  • Uniform shift: each letter moves forward or back by the same number of places.
  • Alternating shift: the letters move +1, −1, +1, −1, and so on, or follow another repeating pattern.
  • Reverse alphabet: each letter is replaced by its opposite.
  • Number codes: each letter is replaced by its position number, or the positions are added up or multiplied.
  • Sentence codes: each word maps to one code word, and the order of code words may be shuffled.

Shortcuts

Shortcut 1: Write the differences

Under each letter of the original word, write the position difference to its coded letter. The pattern (+1 +1 +1, or +1 −1 +1) usually becomes clear within the first three letters.

Shortcut 2: Common words, common codes

In sentence coding, find a word that appears in two sentences and the code word they share. That pair is a match. Repeat this until every word is decoded.

Shortcut 3: Wrap around the alphabet

After Z, the alphabet starts again at A. Y + 3 is B. Treat positions modulo 26 so that shifts near the end of the alphabet don't trip you up.

Solved examples

Example 1

In a certain code, COMPUTER is written by moving each letter one place forward. How is COMPUTER written in this code?

C→D, O→P, M→N, P→Q, U→V, T→U, E→F, R→S Answer: DPNQVUFS.

Example 2

In a reverse-alphabet code, each letter is replaced by its opposite letter. How is CAT written?

C (3) → 27 − 3 = 24 → X A (1) → 26 → Z T (20) → 7 → G Answer: XZG.

Example 3

If BAD is coded as 7, what is the code for FACE?

Add the letter positions: B + A + D = 2 + 1 + 4 = 7. This matches, so the code is the sum of the letter positions. FACE = 6 + 1 + 3 + 5 = 15 Answer: 15.

Example 4

In a code language, "red rose" is written as "pa ni," "rose blooms" as "ni ta," and "red flag" as "pa ko." What is the code for "rose," and what is the code for "flag"?

"rose" appears in the first two phrases, and their only common code word is "ni." So rose = ni. "red" appears in the first and third phrases, and their only common code word is "pa." So red = pa. That leaves "ko" for "flag" in the third phrase, and "ta" for "blooms" in the second. Answer: rose = ni, flag = ko.

Bonus pattern

If TIGER is coded as UHHDS, the shifts are +1, −1, +1, −1, +1. Applying the same pattern to LIONS gives M, H, P, M, T, so LIONS is written as MHPMT.

Common mistakes

  1. Assuming a uniform shift too early. Check at least three letters before you decide on the rule. Alternating and increasing shifts look uniform at first glance.
  2. Not wrapping around. Moving past Z without starting again at A produces symbols that aren't letters. Use modulo 26.
  3. Getting reverse pairs wrong. The reverse of a letter at position n is at 27 − n, not 26 − n. Being off by one changes every letter in the answer.
  4. Assuming code words keep the same order as the sentence. In sentence codes, the code words are often shuffled. Match words using what the sentences have in common, not the position of the words.
  5. Applying the rule to the wrong word. Read the question again. Sometimes it gives you a coded word and asks you to decode it, which means you apply the rule in reverse.

Practice now: https://www.testsworld.com/mocks

Ready to practise Coding-Decoding?
Take a free mock test

Related guides