Error detection: parity, checksums & check digits

Computer Science · Data representation

Question 1 of 10

0

    A serial line sends the 7-bit data 0000001. It uses even parity with the parity bit added as an 8th bit. What value must the parity bit have (0 or 1)?

    Decimals (0.75 or 0,75), fractions (3/4) and mixed numbers (1 1/2) are accepted. Do not use thousands separators.

    How to type your answer
    • Fractions: 3/4. Mixed numbers: 1 1/2.
    • Decimals with a point or a comma: 0.75 or 0,75.
    • Negative numbers start with a minus: -3/4.
    • Percentages need the % sign: 75%.

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Error detection: parity, checksums & check digits explained

    When data is stored or sent, it can be corrupted by noise, damage or a faulty connection. Error detection methods add a small amount of extra information so that the receiver can spot a mistake. They can detect many errors, but most cannot correct them, so the data is usually sent again. A parity bit is an extra bit added to a binary value so that the total number of 1s is either even (even parity) or odd (odd parity). If the count at the receiver does not match the expected parity, an error has occurred. A single parity bit detects any single-bit error, but it does not detect two errors that cancel each other out.

    A checksum is a value calculated from a whole block of data, such as the sum of its bytes, and sent with it. The receiver recalculates the value and compares the two. Check digits are a similar idea for numbers such as book codes. The ISBN-13 check digit is found by multiplying the first 12 digits alternately by 1 and 3, adding the results, and choosing the digit that makes the total a multiple of 10.

    Worked example

    Find the ISBN-13 check digit for 978-0-306-40615-?.

    1. Multiply the digits 9 7 8 0 3 0 6 4 0 6 1 5 alternately by 1 and 3: the total is 93.
    2. The nearest multiple of 10 above 93 is 100, so the check digit is 100−93=7100 - 93 = 7, giving 978-0-306-40615-7.

    What you will practise

    New numbers every time you practise. Levels: Easy, Medium, Hard. Each answer is followed by a worked explanation.

    Example questions

    • Easy

      A simple checksum is the sum of all the data digits, modulo 10. Calculate the checksum for the data 9, 3, 3, 2. Give your answer as a single digit.

    • Medium

      The first 12 digits of an ISBN-13 are 866406198976. The digits are weighted 1, 3, 1, 3, … from the left, and the check digit makes the total weighted sum (including the check digit, weight 1) a multiple of 10. What is the check digit?

    • Hard

      A membership number has 7 digits followed by a check digit. The digits are multiplied by the weights 8, 7, 6, 5, 4, 3, 2 from the left, the products are added, and the check digit is the remainder when the total is divided by 9. What is the check digit for 3362725?