Data packets

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

Data packets

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. How does a large file travel across a network?
A It is sent as one giant block
B It is split into small packets
2. Which information is attached to a packet?
A Only the file name and the colour of the cable
B Sender, destination and order number
3. Why does each packet have an order number?
A So the packets can be put back in the right order
B So the packets can be made bigger
4. Do all packets from one message have to take the same route?
A No, packets can take different routes
B Yes, they must all take the same route
5. Where are the packets put back together?
A At the destination
B At each router along the way

Match the Pairs

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

Left columnRight column
1packet A{from: 'Maya', to: 'School', order: 2, data: 'llo'}
2packet 3 of 5 BThe packets must be put back in order using their order numbers before the message is read, so it should be read as 1, 2, 3.
3Each packet carries the sender, the destination, an order number and a piece of the data CThe order number tells the destination where this piece fits when the data is reassembled
4Packets can take different routes but are reassembled in order at the destination DA small chunk of data with the sender, destination and order number attached
5A whole 5 MB photo is sent as one single piece through the network EData is not sent as one big piece. It is split into small packets that travel separately and are reassembled at the destination.
6Packets 3, 1, 2 arrive, so the message is read as 3, 1, 2 Farrive: 3, 1, 2 -> sort by order -> 1, 2, 3

Definitions

packet

Fill in the Blanks

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

1.
packet = {data: "Hi", order: 1, ______: "PC1", destination: "PC2"}
2.
packet = {data: "lo", sender: "PC1", destination: "PC2", _____: 2}
3.
packets = _____(message) send(packets[1], route_a) send(packets[2], route_b)
4.
arrived = [packet3, packet1, packet2] message = ____(arrived, by=order)
5.
if received == total: message = ____(sorted_packets)

Spot the Error

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

Question 1
A pkt = {"num": 1, "to" "PC"}
B print(pkt["num"])
C print(pkt["to"])
Question 2
A arrived = [3, 1, 2]
B arrived.reverse()
C print(arrived)
Question 3
A message = HELLO WORLD
B first = message[0:5]
C second = message[5:11]
Question 4
A routes = ["A", "B"]
B for route in routes
C print("Via", route)
Question 5
A def make_packet(data, n, to):
B me = "Laptop"
C return [n, me, data]

Answer Key

Data packets
Section A: Quick Questions
Q1
B — It is split into small packets
Q2
B — Sender, destination and order number
Q3
A — So the packets can be put back in the right order
Q4
A — No, packets can take different routes
Q5
A — At the destination
Section B: Match the Pairs
Q1
packet → A small chunk of data with the sender, destination and order number attached
Q2
packet 3 of 5 → The order number tells the destination where this piece fits when the data is reassembled
Q3
Each packet carries the sender, the destination, an order number and a piece of the data → {from: 'Maya', to: 'School', order: 2, data: 'llo'}
Q4
Packets can take different routes but are reassembled in order at the destination → arrive: 3, 1, 2 -> sort by order -> 1, 2, 3
Q5
A whole 5 MB photo is sent as one single piece through the network → Data is not sent as one big piece. It is split into small packets that travel separately and are reassembled at the destination.
Q6
Packets 3, 1, 2 arrive, so the message is read as 3, 1, 2 → The packets must be put back in order using their order numbers before the message is read, so it should be read as 1, 2, 3.
Section C: Definitions
Q1
packet — A small chunk of data with the sender, destination and order number attached. Packets travel a network by different routes and are put back in order at the destination.
Section D: Fill in the Blanks
Q1
packet = {data: "Hi", order: 1, sender: "PC1", destination: "PC2"}
Q2
packet = {data: "lo", sender: "PC1", destination: "PC2", order: 2}
Q3
packets = split(message) send(packets[1], route_a) send(packets[2], route_b)
Q4
arrived = [packet3, packet1, packet2] message = sort(arrived, by=order)
Q5
if received == total: message = join(sorted_packets)
Section E: Spot the Error
Q1
A — A dictionary needs a colon between each key and its value. The destination should be written as "to": "PC" so it is attached to the packet.
Q2
B — Packets must be put back in order using their order numbers. reverse() only flips the list to [2, 1, 3]. It should be arrived.sort() to get [1, 2, 3].
Q3
A — Text data must be inside quotes to be a string. It should be message = "HELLO WORLD" before it is split into packets.
Q4
B — A for loop line must end with a colon. It should be for route in routes: so each packet can be shown taking a different route.
Q5
C — The packet is missing its destination. Every packet needs the order number, sender, destination and data, so the line should be return [n, me, to, data].