# Q2A · Error detection and correction

Subject: Computer Networks

Exam: TEE

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

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/mocks/tee-mock-c--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=1110000, C3=0011100, 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 | 1110000 |
| C3 | 0011100 |

## 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 | 1110000 | 1110000 | 3 |
| C1 vs C3 | 0000000 | 0011100 | 0011100 | 3 |
| C2 vs C3 | 1110000 | 0011100 | 1101100 | 4 |

#### Step 2. Take the minimum

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

#### Step 3. Calculate the guarantees

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

#### Step 4. Justify geometrically

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

**Final answer:** dmin=3; detect up to 2 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.
