Skip to content
thecscience
THECSICENCE

Learn everything about computer science

  • Home
  • Human values
  • NCERT Solutions
  • HackerRank solutions
    • HackerRank Algorithms problems solutions
    • HackerRank C solutions
    • HackerRank C++ solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
thecscience
THECSICENCE

Learn everything about computer science

What is Error Detecting Codes

YASH PAL, July 6, 2021November 25, 2024

Error Detecting codes – When we used to store some data on a magnetic surface. then there might be a chance of errors due to bad spots on the surface. errors may also be caused by some electrical issues while we transfer the data between units. thus for solving this problem, we use error-detecting codes.

what is error detection code
Error Detection Code

It is necessary to have some methods to detect such kinds of errors while transferring the data. because errors can change our data and can transfer the wrong information to the target user. so the main principle that is used to detect errors in coded data is to add some extra bits in the code of each character of information to aid error detection.

Forms of Data Preprocessing

The common method is that we can append a bit called parity check bit to each information code. and this parity bit is appended to the 7 bits of the code of each character. so that the total number of 1s in the character code is even.

So we have two bits 0 and 1 for the machine code. and if the total number of ones (1) is even in the character code then we append the 0 to the end of the character code. and if the total number of ones (1) is odd then we can add 1 and the end of the character bit code.

For example, the ASCII value of the letter E is 1000101 which is 7 bits of character E. so here we can see that the total number of 1 in the bit code of 7 is 3 and that is odd. so we need to append 1 at the end of the code. so the new code value of the letter E is 10001011 which is 8 bits long.

Similarly, the ASCII value of A is 1000001 and here the number of ones(1) is even so we need to add zero (0) at the end of code bits. so the new error-detecting code for A is 10000010. so now all the characters have 9 bits code including the parity check bit.

So whenever a character is read from the storage or any other location of the device then first it checks for the number of ones(1). and it needs to be even. and if the number of ones(1) is odd then at least one bit is wrong in the character. and this type of error is called a single error.

Another thing is that using this technique we can only counter or find the one-bit error in the code. but we cannot find or detect the two-bit errors in the code.

so instead of appending the parity bit to make the total number of ones(1) even we can use it to make the total number of ones(1) odd. this type of bit is called the odd parity check bit. and remember that this functionality also only detects a single error in a code.

There are some types of code that can use more than one check bit to not only detect but also correct the errors in the code. and these types of codes are called error-correcting codes.

Also, read

  • Computer Fundamentals
  • Representation of characters in computer
  • Input and Output Units
  • Computer memory Hierarchy
computer fundamentals engineering subjects computer fundamentalsengineering subjects

Post navigation

Previous post
Next post

Leave a Reply

You must be logged in to post a comment.

  • HackerRank Dynamic Array Problem Solution
  • HackerRank 2D Array – DS Problem Solution
  • Hackerrank Array – DS Problem Solution
  • Von Neumann and Harvard Machine Architecture
  • Development of Computers
©2025 THECSICENCE | WordPress Theme by SuperbThemes