Packet trailer

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

Packet trailer

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which part of a packet comes last?
A The trailer
B The header
2. What does the packet trailer do?
A Stores the destination address
B Marks the end of the packet
3. True or false: a packet trailer can hold error checking information.
A False
B True
4. Which item belongs in the packet trailer?
A An end of packet marker
B The packet number
5. Which shows the packet parts in the correct order?
A Header, payload, trailer
B Header, trailer, payload

Match the Pairs

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

Left columnRight column
1packet trailer AThe last part of a packet, which marks where the packet ends
2trailer: end_marker, check_value Bif check_value(payload) != trailer.check: resend()
3The trailer is the last part of a packet, after the header and the payload Cpacket = header + payload + trailer
4The trailer can hold error checking information that the receiver compares with the data it received DA trailer holding an end of packet marker and error checking information
5packet = trailer + payload + header EThe trailer is placed at the start of the packet. It should be the last part, after the payload, so the packet is header + payload + trailer.
6trailer = destination address, packet number FThe destination address and packet number belong in the header, not the trailer. The trailer holds the end marker and error checking information.

Definitions

packet trailer

Fill in the Blanks

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

1.
packet = [header, payload, _______]
2.
endPart = packet._______
3.
IF packet._______ = "END" THEN OUTPUT "Packet has ended" ENDIF
4.
trailer = [endMarker, __________]
5.
IF _______.errorCheck = "OK" THEN OUTPUT "Data arrived correctly" ENDIF

Spot the Error

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

Question 1
A last_part ← payload
B trailer.marks ← end_of_packet
C OUTPUT last_part
Question 2
A order ← [head, data, trailer]
B last ← order[1]
C OUTPUT last
Question 3
A READ trailer
B IF trailer found THEN
C end_reached ← FALSE
Question 4
A READ part
B IF part = payload THEN
C OUTPUT "End of packet"
D ENDIF
Question 5
A trailer ← check_value
B received ← calc(payload)
C IF received ≠ trailer THEN
D OUTPUT "Data OK"

Answer Key

Packet trailer
Section A: Quick Questions
Q1
A — The trailer
Q2
B — Marks the end of the packet
Q3
B — True
Q4
A — An end of packet marker
Q5
A — Header, payload, trailer
Section B: Match the Pairs
Q1
packet trailer → The last part of a packet, which marks where the packet ends
Q2
trailer: end_marker, check_value → A trailer holding an end of packet marker and error checking information
Q3
The trailer is the last part of a packet, after the header and the payload → packet = header + payload + trailer
Q4
The trailer can hold error checking information that the receiver compares with the data it received → if check_value(payload) != trailer.check: resend()
Q5
packet = trailer + payload + header → The trailer is placed at the start of the packet. It should be the last part, after the payload, so the packet is header + payload + trailer.
Q6
trailer = destination address, packet number → The destination address and packet number belong in the header, not the trailer. The trailer holds the end marker and error checking information.
Section C: Definitions
Q1
packet trailer — The last part of a packet. It marks where the packet ends and can hold error checking information, so the receiving device can check the data arrived correctly.
Section D: Fill in the Blanks
Q1
packet = [header, payload, trailer]
Q2
endPart = packet.trailer
Q3
IF packet.trailer = "END" THEN OUTPUT "Packet has ended" ENDIF
Q4
trailer = [endMarker, errorCheck]
Q5
IF trailer.errorCheck = "OK" THEN OUTPUT "Data arrived correctly" ENDIF
Section E: Spot the Error
Q1
A — The trailer is the last part of a packet. The payload is the data in the middle, so line 1 should be last_part ← trailer.
Q2
B — The trailer is the third and final part of the packet, so the last part is order[3]. order[1] would give the header.
Q3
C — Once the trailer is found, the end of the packet has been reached, so end_reached should be set to TRUE.
Q4
B — The trailer marks the end of the packet, not the payload. The test should be IF part = trailer THEN.
Q5
C — The data is only OK if the check value calculated on arrival matches the one in the trailer. The test should use = not ≠.