1. Home
  2. Interview Questions
  3. Aptitude
  4. How do you solve coding-decoding questions where letters shi…

Try answering first

In a real interview nobody shows you the answer. Think it through (or type it), then reveal the answers and rate yourself.

1 Answer

0 0
InterviewQuestions Team ✔ Expert answer ✔ Best answer ·

Short answer: Write down the alphabet position of every letter in the given word and its code, then find the difference for each letter. The differences reveal the rule: a fixed shift, an increasing shift, reversed order, or opposite letters. Apply the same rule to the new word, wrapping from Z back to A when needed.

Detailed explanation

Letter-shifting is the most common coding-decoding pattern in placement tests. Each letter of the original word is replaced by another letter according to a numeric rule. You find the rule quickly only if you can convert letters to numbers without counting on your fingers.

Step 1: Know the positions. A=1 and Z=26. A useful memory aid is EJOTY, which gives the letters at 5, 10, 15, 20 and 25. From these anchors you can reach any letter in one or two steps.

Step 2: Line up word and code. Write the original letters above the coded letters and note the difference (code minus original) for each pair.

Step 3: Identify the pattern. Common rules are:

  • Fixed shift: every letter moves the same amount, for example +2 throughout.
  • Varying shift: the shift changes in a sequence such as +1, +2, +3 or +1, -1, +1, -1.
  • Reversal: the word is reversed first and then shifted. If the differences look random, check this.
  • Opposite letters: each letter is replaced by its mirror in the alphabet. Opposite pairs add up to 27: A-Z, B-Y, C-X, M-N.

Step 4: Handle wrap-around. If a shift goes past Z, subtract 26. For example, W (23) + 4 = 27, and 27 - 26 = 1, which is A. Going below A works the other way: add 26.

Step 5: Verify before applying. Check the rule against every letter of the example, not just the first two. Option choices are usually built to trap people who stop after two letters.

Example

Question: If GARDEN is written as HCUHJT, how is FLOWER written in that code?

Letter : G  A  R  D  E  N
Pos    : 7  1  18 4  5  14
Code   : H  C  U  H  J  T
Pos    : 8  3  21 8  10 20
Shift  : +1 +2 +3 +4 +5 +6

The rule is an increasing shift of +1, +2, +3, +4, +5, +6. Now apply it to FLOWER:

F(6)+1  = 7  = G
L(12)+2 = 14 = N
O(15)+3 = 18 = R
W(23)+4 = 27 -> 27-26 = 1 = A
E(5)+5  = 10 = J
R(18)+6 = 24 = X

Answer: GNRAJX.

Opposite-letter check: CAT becomes XZG, because C(3) pairs with X(24), A(1) with Z(26) and T(20) with G(7). Each pair adds to 27.

Reversal check: MONKEY is coded as XDJMNL. Reverse it to get YEKNOM, then shift each letter by -1: X D J M N L. The differences looked random until the word was reversed.

Common mistakes

  • Forgetting wrap-around. Candidates write W+4 as a non-existent 27th letter or pick a wrong option.
  • Confirming the rule on only the first two letters. Many options match the first few letters and differ only at the end.
  • Counting letters on fingers under time pressure, which leads to off-by-one errors. Memorise the EJOTY anchors instead.
  • Not testing reversal or opposite-letter rules when the differences look irregular.

Follow-up questions

  • If a code uses a +1, -1 alternating shift, how would you decode a given coded word back to the original?
  • How would you solve a question where letters are coded as numbers, such as their position values or squares of them?
  • What changes in your approach when the letters are shuffled as well as shifted?

Interview tip: Write position numbers above the letters before you look for a pattern. It takes ten seconds and saves most of the errors.

Reviewed by the Interview Questions editorial team · Last updated

How well did you know this?

Rate yourself to track progress, build your streak and get “didn't know” questions in your revision list.

Your Answer

More easy Aptitude questions

All easy questions →

Related Questions

‹
Q3 of 9 · Aptitude
Next ›

Interview Questions

Free interview questions and answers, MCQ practice, online tests, mock interviews and group discussions — everything you need to crack your next interview.
📍 Dasardot LLC
1309 Coffeen Avenue STE 1200
Sheridan, Wyoming 82801
USA