Identifying loss, gain and change in an example

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Identifying loss, gain and change in an example

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Sent: 10110010. Received: 1011010. What type of error is this?
A Data loss
B Data gain
2. Sent: 01101100. Received: 01111100. What type of error is this?
A Data loss
B Data change
3. Sent the word: CAT. Received the word: CART. What type of error is this?
A Data change
B Data gain
4. Sent the word: HELLO. Received the word: HELO. What type of error is this?
A Data loss
B Data change
5. Sent the word: DOG. Received the word: DIG. What type of error is this?
A Data change
B Data gain

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Sent: 10110010 Received: 1011010 AThe received word is longer, with an extra character, so this is data gain, not data change.
2Sent: CAT Received: CATS BSent: HELLO Received: HELO
3The length is the same but one value is different, so the error is data change CBoth patterns are 4 bits long and only the last bit differs, so this is data change, not data loss.
4Count first: 5 characters sent but only 4 received, so the error is data loss DData gain: an extra character has appeared that was not sent
5Sent: 1010 Received: 1011 (data loss) EData loss: the received pattern is shorter, so a bit has gone missing
6Sent: DOG Received: DOGS (data change) FSent: 1100 Received: 1110

Definitions

compare sent and received

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
IF LENGTH(received) _ LENGTH(sent) THEN error ← "loss" ENDIF
2.
IF LENGTH(received) _ LENGTH(sent) THEN error ← "gain" ENDIF
3.
IF LENGTH(sent) = LENGTH(received) THEN IF sent __ received THEN error ← "change"
4.
sent ← "10110010" received ← "10110110" IF sent <> ________ THEN OUTPUT "change"
5.
sent ← "CAT" received ← "CART" n ← ______(received) - LENGTH(sent)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A sent = "10110010"
B recieved = "1011010"
C if len(received) < len(sent):
D print("loss")
Question 2
A sent = "HELLO"
B received = "HELLO!"
C if len(received) < len(sent):
D print("gain")
Question 3
A sent = "01101100"
B received = "01001100"
C if sent == received:
D print("change")
Question 4
A sent = DOG
B received = "DIG"
C if len(sent) == len(received):
D print("change")
Question 5
A sent = "1100"
B received == "110011"
C if len(received) > len(sent):
D print("gain")

Answer Key

Identifying loss, gain and change in an example
Section A: Quick Questions
Q1
A — Data loss
Q2
B — Data change
Q3
B — Data gain
Q4
A — Data loss
Q5
A — Data change
Section B: Match the Pairs
Q1
Sent: 10110010 Received: 1011010 → Data loss: the received pattern is shorter, so a bit has gone missing
Q2
Sent: CAT Received: CATS → Data gain: an extra character has appeared that was not sent
Q3
The length is the same but one value is different, so the error is data change → Sent: 1100 Received: 1110
Q4
Count first: 5 characters sent but only 4 received, so the error is data loss → Sent: HELLO Received: HELO
Q5
Sent: 1010 Received: 1011 (data loss) → Both patterns are 4 bits long and only the last bit differs, so this is data change, not data loss.
Q6
Sent: DOG Received: DOGS (data change) → The received word is longer, with an extra character, so this is data gain, not data change.
Section C: Definitions
Q1
compare sent and received — Compare the data sent with the data received. Fewer bits or characters means loss, extra ones means gain, and the same length with different values means change.
Section D: Fill in the Blanks
Q1
IF LENGTH(received) < LENGTH(sent) THEN error ← "loss" ENDIF
Q2
IF LENGTH(received) > LENGTH(sent) THEN error ← "gain" ENDIF
Q3
IF LENGTH(sent) = LENGTH(received) THEN IF sent <> received THEN error ← "change"
Q4
sent ← "10110010" received ← "10110110" IF sent <> received THEN OUTPUT "change"
Q5
sent ← "CAT" received ← "CART" n ← LENGTH(received) - LENGTH(sent)
Section E: Spot the Error
Q1
B — The variable is misspelled as recieved, so line 3 would fail because received does not exist. It should be received = "1011010".
Q2
C — Gain means extra characters arrived, so the received data must be longer than the sent data. The test should use > not <.
Q3
C — The two patterns have the same length but different values, which is a change. The test must be sent != received. With == it would only be true when nothing went wrong.
Q4
A — The word is a string, so it needs quotes. It should be sent = "DOG". Without quotes Python treats DOG as an undefined variable.
Q5
B — A double equals sign compares values, but this line needs to store the received bits. It should use a single = : received = "110011".