0% found this document useful (0 votes)
8 views

Spring 2024 - CS601 - 2

2024

Uploaded by

ishrat.taimur23
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Spring 2024 - CS601 - 2

2024

Uploaded by

ishrat.taimur23
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment No.

02 Total Marks: 20
Semester: Spring 2024
CS601: Data Communication Due Date: 24-June-2024

Instructions:
Please read the following instructions carefully before submitting assignment:
You need to use MS Word document to prepare and submit the assignment on VU-LMS.
It should be clear that your assignment will not get any credit if:

 The assignment is submitted after due date.


 The assignment is not in the required format (doc or docx).
 The submitted assignment does not open or file is corrupt.
 Assignment is copied (partial or full) from any source (websites, forums, students, etc.).

Objective:

To enhance the learning capabilities of the students about:

 Checksum
 Hamming Distance
 Minimum Hamming Distance

Question No.1

Suppose two devices need to communicate with each other in such a way that the data sent by the sender could be
verified at the receiver side for accuracy. For this purpose, both the sender and the receiver agreed upon the use of
Checksum algorithm at both sides.

The data packet contains the following 8-bit segments:


11011011101010101111000000001111

Tasks:

1. Calculate the 8-bit checksum for the given data packet at the sender side only.
2. Provide the complete message with the checksum for transmission by the sender.
Solution:

Data Packet: 11011011 10101010 11110000 00001111

1. Checksum Calculation (One's Complement Method):


1. Add all data segments (ignoring overflow):

11011011 (first segment)


+ 10101010 (second segment)
+ 11110000 (third segment)
+ 00001111 (fourth segment)
-----------
10101000 (sum, ignoring overflow)
2. One's complement of the sum:

10101000 (sum)
----------
01010111 (one's complement)
1. Complete Message with Checksum:

Append the calculated checksum (01010111) to the end of the data packet:

11011011 10101010 11110000 00001111 01010111 (checksum)

Therefore, the complete message to be transmitted by the sender is:

1101101110101010111100000000111101010111

Question No. 2

Find the hamming distance for the given pair of words. Also find out the minimum Hamming distance from the
given set of words.
Pair of Words Hamming Distance(d)
(11001, 01100)
(10110, 01011)
(11100, 11110)
(01101, 11101)
Minimum Hamming distance
Solution:

1. Pairwise Hamming Distance:

(11001, 01100):
1.
1. XOR each corresponding bit: 1 ^ 0 = 1, 1 ^ 1 = 0, 0 ^ 0 = 0, 0 ^ 1 = 1, 1 ^ 0 = 1
2. Count the number of 1s: 1 + 0 + 0 + 1 + 1 = 3 (Hamming Distance)
2. (10110, 01011):
1. XOR each bit: 1 ^ 0 = 1, 0 ^ 1 = 1, 1 ^ 0 = 1, 1 ^ 1 = 0, 0 ^ 1 = 1
2. Count the number of 1s: 1 + 1 + 1 + 0 + 1 = 4 (Hamming Distance)
3. (11100, 11110):
1. XOR each bit: 1 ^ 1 = 0, 1 ^ 1 = 0, 1 ^ 1 = 0, 0 ^ 1 = 1
2. Count the number of 1s: 0 + 0 + 0 + 1 = 1 (Hamming Distance)
4. (01101, 11101):
1. XOR each bit: 0 ^ 1 = 1, 1 ^ 1 = 0, 1 ^ 1 = 0, 0 ^ 1 = 1, 1 ^ 1 = 0
2. Count the number of 1s: 1 + 0 + 0 + 1 + 0 = 2 (Hamming Distance)
2. Minimum Hamming Distance:

Based on the calculations above, the minimum Hamming distance is 1 (occurs between the third pair of words:
11100 and 11110).

You might also like