# Q2A · Error detection and correction

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/mocks/tee-mock-a/q2a

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/mocks/tee-mock-a--q2a/

TEE · 100 attempted marks · solutions for every choice · current syllabus 702AI0C023

### TEE practice mock · Q2A. Explain block coding and redundancy. For the binary codewords C1=0000000, C2=1111000, C3=0011110, find every pairwise Hamming distance, the minimum distance, and the guaranteed error detection/correction limits. [10 mock marks]

#### Answer

Block coding maps each k-bit dataword to an n-bit codeword, adding n−k redundant bits. Only selected codewords are valid; their separation determines error-detection/correction capability.

## Given

| Codeword | Bits |
| --- | --- |
| C1 | 0000000 |
| C2 | 1111000 |
| C3 | 0011110 |

## To find

All pair distances, dmin and the maximum guaranteed numbers of errors.

## Formula and why



$$
d(a,b)=\mathrm{weight}(a\oplus b)
$$





$$
s=d_{\min}-1,\quad t=\lfloor(d_{\min}-1)/2\rfloor
$$



XOR exposes differing positions. Use the closest codeword pair, because it is the weakest separation in the code.

## Step-by-step solution

#### Step 1. XOR every distinct pair

| Pair | First | Second | XOR | Distance |
| --- | --- | --- | --- | --- |
| C1 vs C2 | 0000000 | 1111000 | 1111000 | 4 |
| C1 vs C3 | 0000000 | 0011110 | 0011110 | 4 |
| C2 vs C3 | 1111000 | 0011110 | 1100110 | 4 |

#### Step 2. Take the minimum

dmin = min(4, 4, 4) = 4.

#### Step 3. Calculate the guarantees

Detect = 4−1 = 3; correct = floor((4−1)/2) = 1.

#### Step 4. Justify geometrically

4 bit changes can reach another valid codeword, so only 3 are guaranteed detectable. Correction regions require 2t < 4.

**Final answer:** dmin=4; detect up to 3 errors; correct up to 1 errors.

#### What this result means

A distance of one particular pair does not set the whole-code capability unless it is the minimum.
