Past exam question: 2078 Bhadra, Q5
Open in the Padhaiko appQuestion
Demonstrate how checksum is used to detect errors while sending a data word of 12, 15, 15, 10, 5, 2.
Solution
Checksum Principle Using 1's Complement Arithmetic: The internet checksum algorithm (used in IP, TCP, and UDP) operates by:
- Treating data words as integers of fixed bit-width (here, 4-bit nibbles, since data values fit in 4 bits: ).
- Computing the sum of all words using 1's complement addition (any end-around carry from the most significant bit is added back into the least significant bit).
- The checksum is the 1's complement (bitwise NOT) of this accumulated sum.
- The sender transmits the data words along with the checksum.
- The receiver adds all received data words plus the checksum in 1's complement. If the result is all 1s (or zero after inverting), the data is accepted as error-free.
Transmitter Checksum Generation (4-bit Words): The given data items in decimal and 4-bit binary are:
- Calculate the standard decimal sum:
- Convert sum to binary:
- Wrap around the carry bits (1's complement fold):
- The 4-bit sum is with carry ().
- Add carry to lower 4 bits:
- Compute Checksum (1's complement inversion):
Transmitted payload: .
Receiver Error Detection Verification:
- Case 1: No Transmission Error: The receiver sums all incoming items including the checksum:
Fold carry bits:
Take 1's complement:
Since the inverted sum is strictly (uninverted sum is all 1s), the receiver confirms no error and accepts the transmission.
- Case 2: Error Detected: Suppose is corrupted from to during transit.
Fold carry:
Take 1's complement:
Since the result is non-zero, the receiver detects the transmission error and rejects the corrupted frame.
Answer:
Using 4-bit 1's complement arithmetic for :
- Total sum .
- Adding the carry () to the lower 4 bits () yields ().
- Checksum ().
- Receiver sums all data words plus checksum: , which inverts to , confirming error-free transmission.