In this blog, you will learn everything about coding and decoding. We will discuss what coding and decoding is and the different types of coding and decoding problems. We will also provide you with questions to help you practice.
Table of Contents:
What is Coding?
Coding refers to the process of encrypting a word, letter, or sentence based on a specific set of rules. In other words, the process hides the actual meaning of the text. It means that only the intended person can decipher it. This ensures that the communication between the sender and the receiver is not comprehended by a third person.
Want to go into the field of Software Development? Enroll in this Software Development Course by Intellipaat.
What is Decoding?
Decoding is the process of understanding or interpreting the meaning of an encrypted message and converting it into its original form. When the intended person receives the message, he decodes it to comprehend the information. It involves recognizing the pattern and applying that pattern to reveal the actual message or information. This concept of reasoning is designed to measure the logical ability of a person.
Check out these Top Interview Questions to ace your Software Engineering Interview.
Types of Coding and Decoding Problems
In reasoning, there can be multiple types of coding and decoding problems, such as letter coding, number coding, substitutional coding, etc. All of these types are discussed in detail in the following sections:
1. Letter Coding: In this type of coding, alphabets are replaced with some other alphabets by using some pattern. Different operations like addition, subtraction, multiplication, and division are applied to the numerical position of the alphabet to get a new position that represents a different alphabet. For example, the numerical position of the alphabet ‘C’ is 3. If we add 2 to 3 it makes five which refers to the alphabet ‘E’. Now, let’s see the example of such questions:
Q- If “LOCK” is written as “ORFN” in a certain language. How will “KEY” be written in that language?
Ans. Here, we will compare the first letters of “LOCK” and “ORFN” to find the pattern, i.e., “L” and “O”. We see that L and O have a gap of 2 positions. Now, we will compare the second and third letters of both words to make sure that every letter follows the same pattern, and this will be done as follows:
O—-+2—→R
C—-+2—→F
K—-+2—→N
As we can see, every letter follows the same pattern. We will apply this pattern to the word ”KEY” as shown below:
K—-+2—→N
E—-+2—→H
Y—-+2—→B
So the answer to this question will be “NHB”.
2. Number Coding: In this type of coding, the numbers are phrased into letters or vice versa. For example:
Q. If “BIRD” is coded as 310195, then how will the word “EAGLE” be written?
Ans. We will check the positional value or the numerical position of all the alphabets one by one, i.e.,
B=2
I=9
R=18
D=4
We see that the given number is 310195. This number is obtained by adding 1 to the positional value of each alphabet, i.e.,
B(2)—-+1—→3
I(9)—-+1—→10
R(18)—-+1—→19
D(4)—-+1—→5
Now, we will apply this same pattern to the word “EAGLE”. It will be:
E(5)—-+1—→6
A(1)—-+1—→2
G(7)—-+1—→8
L(9)—-+1—→10
E(5)—-+1—→6
So, the answer to this question would be 628106.
3. Substitution Coding: Here, words are substituted with other words. We have to follow the substitution pattern and identify which word refers to which one. For example, consider the following question:
Q. If ‘Cat’ is known as ‘Dog’, ‘Dog’ is known as ‘Cow’, ‘Cow’ is known as ‘Deer’, and ‘Deer’ is known as ‘Rabbit’, what would be the name of ‘Cow’?
Ans. Here, the ‘Cow’ is known as ‘Deer’, so the answer will be ‘Deer’.
Get 100% Hike!
Master Most in Demand Skills Now!
4. Mixed Letter Coding: In this type of coding, three or four phrases are given at a time, and the code for these phrases is provided. All these phrases contain some common words with a common code. The common code in both phrases will refer to that word. Consider the following example to understand it clearly:
In a certain code language:
- ‘new banking system’ is written as ‘ss tp na’
- ‘systems in bank’ is written as ‘bk at ss’
- ‘officer in uniform’ is written as ‘or mu at’
- ‘new bank officer’ is written as ‘or bk na’
What will be the code for the word ‘in’?
Ans. Here, the second and third phrases contain the word “in”. The common code word in both of these phrases is “at”. As there is no other common word in these two phrases, we can conclude that “at” refers to “in”.
5. Mixed Number Coding: It is similar to mixed letter coding, but here we have numbers instead of letters. Consider the following example:
In a certain language:
- ‘792’ means ‘leaves are green’,
- ‘785’ means ‘green is good’
- ‘936’ means ‘they are paying’.
What is the number code for ‘leaves’?
Ans. In this question, “leaves” is present in only the first phrase, and there are two other words also. The word “are” is common in phrases 1 and 3, and the common number in these two phrases is 9, which means it refers to the common word “are”.
Another word is “green”, which is common in phrases 1 and 2. And the common number in these two phrases is 7, which means green refers to 7.
Now the only word left in the 1st phrase is “leaves”, and the only number left is 2. Therefore, the answer to this question will be 2.
6. LSN Coding: LSN stands for Letter-Substitution-Number. In this coding, the words are coded with letters, symbols, and numbers by using different operations. We need to find out the correct logic that is used for those letters, numbers, and symbols. For example, consider the following question:
In some code language:
- ‘pen pencil’ is referred to as ‘$%’
- ‘eraser sharpener’ is referred to as ‘@#’
- ‘pencil eraser’ is referred to as‘$@’
Then, what is the code for ‘sharpener’?
Ans. Here, ‘sharpener’ is present in only one phrase, and ‘eraser’ is present in phrases 2 and 3. The common symbol in phrases 2 and 3 is ‘@’ which refers to the common word ‘eraser’. As we have found the symbol for ‘eraser’, the only remaining word is ‘sharpener’, so it must refer to the remaining symbol i.e. #.
7. Conditional Coding: Here some conditions will be given, and we need to apply those conditions to the given questions to find the answer. For example:
In the following questions, you are provided with a set of numerals followed by four groups labeled (a), (b), (c), and (d), each containing symbol/letter combinations. The task is to determine the correct code for the given numerals based on the provided codes and conditions. Evaluate each combination (a), (b), (c), and (d) and choose the one that accurately represents the code for the given numerals. If none of the provided combinations is correct, select (e) as your answer.
Number | 9 | 0 | 1 | 8 | 6 | 4 | 2 | 5 | 7 | 3 |
Symbol/letter | M | R | % | K | F | A | @ | B | E | * |
- If the initial digit and the final digit are odd, they will be coded as ‘X.’
- If both the first digit and the last digit are even, they are to be coded as ‘&.’
- In the case where the last digit is 0, it should be coded as ‘#.’
Q. Decode this 364819 using the above-given language.
Ans: In cases where the specified condition is not met, the coding is carried out using the following mappings:
3 is coded as *
6 is coded as F
4 is coded as A
8 is coded as K
1 is coded as %
9 is coded as M
However, if condition (i) is applicable, wherein the first and last digits are both odd, the coding for 3 and 9 is modified. In this scenario, 3 is coded as X, and 9 is also coded as X. Therefore, for the given sequence 364819, the modified coding is represented as XFAK%X.
8. Binary Coding: Here, the decimal numbers are coded as binary numbers, i.e., 0 and 1.
For example:
Q. Write the 1000 in decimal.
Ans. To write this number in decimal, we need to multiply the number with 2^0, 2^1, 2^2, 2^3, and so on, starting from the left of the number, i.e,:
1*2^3+0*2^2+0*2^1+0*2^0 = 8+1+1+1 = 11
Q. Convert 17 into a binary number.
Ans. For converting a decimal number into a binary number, we need to follow the method of successive divisions. We start by dividing the number by 2, keeping the quotient, and the remainder becomes the next dividend. Again, the process is repeated. This process is repeated until the number is no longer divisible.
17 ÷ 2 = 8 with a remainder of 1
8 ÷ 2 = 4 with a remainder of 0
4 ÷ 2 = 2 with a remainder of 0
2 ÷ 2 = 1 with a remainder of 0
1 ÷ 2 = 0 with a remainder of 1
The answer to this question is 10001.
Methods to Solve Coding and Decoding Problems
To solve the coding and decoding questions efficiently, you shouldcarefully observe the provided sequence of alphabets or numbers in the given question. Analyze the arrangement to identify any discernible pattern or sequence, which may involve ascending or descending order, alternate arrangements, or other systematic methods.
Seek to understand the underlying rule governing the arrangement. Once identified, articulate this rule clearly by using simple and formal language. This systematic approach is necessary for decoding the arrangement and solving the problems.
To solve the letter and number coding problems, you should be aware of the positional values of the English alphabet, which are given below.
A=1 or 26 | N=14 or 13 |
B=2 or 25 | O=15 or 12 |
C=3 or 24 | P=16 or 11 |
D=4 or 23 | Q=17 or 10 |
E=5 or 22 | R=18 or 9 |
F=6 or 21 | S=19 or 8 |
G=7 or 20 | T=20 or 7 |
H=8 or 19 | U=21 or 6 |
I=9 or 18 | V=22 or 5 |
J=10 or 17 | W=23 or 4 |
K=11 or 16 | X= 24 or 3 |
L=12 or 15 | Y=25 or 2 |
M=13 or 14 | Z= 26 or 1 |
Check out this blog on the best software development courses to learn.
Sample Problems of Coding and Decoding
Q. If ‘CAT’ is coded as ‘FDW’, how is ‘DOG’ coded?
a) GRI
b) GPH
c) EPG
d) GJR
Q. In a certain code, COMPUTER is written as PMOCRETU, how is THURSDAY written in that code?
a) RUTYSDAH
b) RUHTYADS
c) RUHTSYAD
d) RUTHYDAS
Q. If HARYANA is written as 8197151, how will DELHI be written?
a) 45129
b) 12459
c) 45389
d) 51249
Q. In a certain code language ‘you are fine’ is written as ‘no la so’. How is ‘fine’ written in that code language?
i. ‘A fine dramatic story’ is written as ‘la jo ni da’.
ii. Fine creative art’ is written as ‘ga la yo’.
i. New wonderful fine illusion’ is written as ‘chi su la tic’.
a) Only I
b) Only II
c) Only III
e) Any of I, Il and III is sufficient
Q. How many such pairs of letters are there in the word PLAGIARISM, each of which has as many letters between them in the word as they have in the English alphabet?
a) Two
b) One
c) None
d) Three
e) More than three
Q. The positions of the first and fourth letters of the word AUGUST are interchange; similarly, the positions of the second and fifth letters and the third and sixth letters are interchanged. Then how many such pairs of letters are there in the new word after re-arrangement, which has as many letters between them as in the English alphabet series?
a) Two
b) One
c) Four
d) Five
e) More than five
Directions (11 – 15): Study the following information to answer the given questions: ‘Share your success’ is written as ‘ve ka ro’,
‘Success story epic’ is written as ‘se ve di’,
‘Story telling inspires’ is written as ‘ba di la’ and
‘Inspire your life’ is written as ‘ro ba yo’
Q1. What is the code for ‘Inspire’?
a)ba
b)di
c)la
d)yo
e)ro
Q2. What does the ‘di ro ve ka’ stand for?
a) Epic story inspires
b) Telling your life
c) Share your success story
d) Telling your life story
e) Can’t be determined
Q3. Which of the following ‘Describe your epic life story’?
a)ro se mn yo di
b)ro se ya di ka
c)se ya di ka xi
d)ro se mn ya ve
e)ka la ve di oy
Q4. What is the code for ‘share’?
a) ve
b) ba
c)ro
d) di
e) ka
Q5. What is the code for ‘life’?
a) ba
b) ro
c) yo
d) ya
e) Cannot be determined
Conclusion
In conclusion, coding and decoding represent integral components of aptitude assessments, requiring individuals to comprehend patterns, sequences, and relationships within given sets of information. Apart from this, in software like WhatsApp, where we have end-to-end encrypted communication, coding and decoding principles are used. Multiple algorithms are developed to encrypt and decrypt the messages. To build secure software, the concept of coding and decoding is essential.
FAQs
What is the coding and decoding process?
Coding is the process of encrypting words or numbers using specific patterns. Whereas, decoding involves decrypting these numbers or words to reveal the actual information.
How are words coded?
To encode a word, we replace the letters of the word with some other letters while following a pattern or specific rules.
Is coding and decoding important for competitive exams?
Yes, it is a part of logical reasoning, and questions related to this topic are included in almost every aptitude test.