Data gain

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

Data gain

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A student sends the 4-byte message 01001000 01101001 00100001 00101110, but 5 bytes arrive. Which transmission error is this?
A Data gain
B Data loss
2. Which statement correctly describes data gain?
A Extra bits or bytes that were not sent are added to the data
B Some bits or bytes of the data go missing on the way
3. A file is sent as 1000 bytes. The receiver counts 1003 bytes. What has happened?
A Data change: 3 bytes were altered
B Data gain: 3 extra bytes were added
4. Sent: 10110010 01100001. Received: 10110010 01100001 11111111. Which is true?
A An extra byte has been added, so this is data gain
B A byte has been lost, so this is data loss
5. How can you spot data gain by comparing the sent and received messages?
A The received message is shorter than the sent message
B The received message is longer than the sent message

Match the Pairs

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

Left columnRight column
1Sent: 01000001 | Received: 0100000111 AThe length is the same and one bit has flipped, so this is data change, not data gain.
2Sent: HELLO (5 bytes) | Received: HELLOX (6 bytes) BData gain: extra bits that were never sent have been added, so the data arrives longer
3Data gain means the message arrives longer than it was sent CbytesReceived > bytesSent
4A packet sent with 3 bytes arrives with an extra byte added, giving 4 bytes Dsent = 3 bytes, received = 4 bytes
5Sent: 5 bytes | Received: 4 bytes | Error: data gain EData gain: one extra byte was added to the message
6Sent: 1011 | Received: 1111 | Error: data gain FFewer bytes arrived than were sent, so this is data loss, not data gain.

Definitions

data gain

Fill in the Blanks

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

1.
IF receivedLength _ sentLength THEN OUTPUT "Data gain" ENDIF
2.
IF receivedLength > sentLength THEN ______ "Data gain" ENDIF
3.
extraBytes ← receivedLength _ sentLength OUTPUT extraBytes
4.
IF extraBytes > 0 THEN OUTPUT "Data gain" _____
5.
IF ______(received) > LENGTH(sent) THEN OUTPUT "Data gain" ENDIF

Spot the Error

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

Question 1
A sent ← 5
B received ← 6
C extra ← received - sent
D IF extra < 0 THEN
E OUTPUT "Data gain"
F ENDIF
Question 2
A sentBytes ← 4
B receivedBytes ← 5
C IF receivedBytes = sentBytes THEN
D OUTPUT "Data gain"
E ENDIF
Question 3
A sent ← "01000001
B received ← "010000011"
C gain ← LENGTH(received) - LENGTH(sent)
D OUTPUT gain
Question 4
A PROCEDURE CheckGain(s, r)
B IF LENGTH(r) > LENGTH(s) THEN
C RETURN TRUE
D ENDIF
E ENDFUNCTION
Question 5
A sLen ← 2
B rLen ← 3
C extra ← sLen - rLen
D OUTPUT extra, " extra bytes"

Answer Key

Data gain
Section A: Quick Questions
Q1
A — Data gain
Q2
A — Extra bits or bytes that were not sent are added to the data
Q3
B — Data gain: 3 extra bytes were added
Q4
A — An extra byte has been added, so this is data gain
Q5
B — The received message is longer than the sent message
Section B: Match the Pairs
Q1
Sent: 01000001 | Received: 0100000111 → Data gain: extra bits that were never sent have been added, so the data arrives longer
Q2
Sent: HELLO (5 bytes) | Received: HELLOX (6 bytes) → Data gain: one extra byte was added to the message
Q3
Data gain means the message arrives longer than it was sent → bytesReceived > bytesSent
Q4
A packet sent with 3 bytes arrives with an extra byte added, giving 4 bytes → sent = 3 bytes, received = 4 bytes
Q5
Sent: 5 bytes | Received: 4 bytes | Error: data gain → Fewer bytes arrived than were sent, so this is data loss, not data gain.
Q6
Sent: 1011 | Received: 1111 | Error: data gain → The length is the same and one bit has flipped, so this is data change, not data gain.
Section C: Definitions
Q1
data gain — Data gain is when extra bits or bytes that were not sent are added to the data, so the message arrives longer than it was sent. It is a type of transmission error.
Section D: Fill in the Blanks
Q1
IF receivedLength > sentLength THEN OUTPUT "Data gain" ENDIF
Q2
IF receivedLength > sentLength THEN OUTPUT "Data gain" ENDIF
Q3
extraBytes ← receivedLength - sentLength OUTPUT extraBytes
Q4
IF extraBytes > 0 THEN OUTPUT "Data gain" ENDIF
Q5
IF LENGTH(received) > LENGTH(sent) THEN OUTPUT "Data gain" ENDIF
Section E: Spot the Error
Q1
D — Data gain means the message arrives longer than it was sent, so extra must be greater than 0. A negative value would mean data loss. It should be IF extra > 0 THEN.
Q2
C — If the two byte counts are equal, the message is the same length and nothing has been gained. Data gain is when more bytes arrive than were sent, so the test should use >.
Q3
A — The string is missing its closing quote. It should be sent ← "01000001", the 8 bits that were sent. The received string has 9 bits, so one extra bit has been gained.
Q4
A — The block ends with ENDFUNCTION and uses RETURN, so it must start with FUNCTION, not PROCEDURE. It should be FUNCTION CheckGain(s, r).
Q5
C — The number of extra bytes is the received length minus the sent length. Subtracting the other way round gives -1. It should be extra ← rLen - sLen.