Packet switching

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

Packet switching

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement about packet switching is correct?
A A message is always sent as one single block
B A message is split into packets that are sent separately
2. How is each packet routed in packet switching?
A All packets must follow the same fixed route
B Each packet is routed on its own
3. What passes packets across the network from one point to the next?
A Routers pass packets on from router to router
B The receiving computer picks every packet's route
4. What happens to the packets when they reach the destination?
A They are joined back together in the right order
B They are kept apart and read separately
5. Which is the correct order of the packet switching process?
A Split into packets, send separately, rejoin at destination
B Send as one block, split at destination, rejoin at router

Match the Pairs

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

Left columnRight column
1packet switching APacket switching splits the message into separate packets. It does not send one block, and each packet is routed on its own.
2Packet 3 of 8 reaches the destination BData is split into packets that are sent separately across a network, each routed on its own from router to router.
3In packet switching, a message is broken into packets before it is sent Cmessage -> [packet 1][packet 2][packet 3]
4Each packet is passed from router to router and is routed on its own DOne of the separate packets has arrived, and it will be joined back together with the others in the right order.
5Packet switching sends the whole message as one single block along one fixed route. EPacket 2: Router A -> Router C -> Router D
6Packets arrive at the destination and stay in separate pieces, so the message is never rebuilt. FThe packets are joined back together in the right order at the destination to rebuild the original message.

Definitions

packet switching

Fill in the Blanks

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

1.
packets ← _____(message, 4)
2.
FOR EACH p IN packets ____(p, router)
3.
ordered ← ____(received, packetNumber)
4.
message ← ____(ordered)
5.
total ← LENGTH(packets) IF count = _____ THEN message ← JOIN(ordered)

Spot the Error

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

Question 1
A message ← "HELLO WORLD"
B packets ← SPLIT(message, 4)
C FOR EACH p IN message
D SEND(p)
Question 2
A p1 ← "HELL"
B p2 ← "O WO"
C SEND(p1 + p2, route1)
D SEND(p2, route2)
Question 3
A packet ← RECEIVE()
B next ← BEST_ROUTE(packet)
C FORWARD(message, next)
Question 4
A received ← FIRST_PACKET()
B SORT(received, BY number)
C message ← JOIN(received)
D OUTPUT message
Question 5
A message ← "GOOD MORNING"
B packets ← JOIN(message, 4)
C OUTPUT LENGTH(packets)

Answer Key

Packet switching
Section A: Quick Questions
Q1
B — A message is split into packets that are sent separately
Q2
B — Each packet is routed on its own
Q3
A — Routers pass packets on from router to router
Q4
A — They are joined back together in the right order
Q5
A — Split into packets, send separately, rejoin at destination
Section B: Match the Pairs
Q1
packet switching → Data is split into packets that are sent separately across a network, each routed on its own from router to router.
Q2
Packet 3 of 8 reaches the destination → One of the separate packets has arrived, and it will be joined back together with the others in the right order.
Q3
In packet switching, a message is broken into packets before it is sent → message -> [packet 1][packet 2][packet 3]
Q4
Each packet is passed from router to router and is routed on its own → Packet 2: Router A -> Router C -> Router D
Q5
Packet switching sends the whole message as one single block along one fixed route. → Packet switching splits the message into separate packets. It does not send one block, and each packet is routed on its own.
Q6
Packets arrive at the destination and stay in separate pieces, so the message is never rebuilt. → The packets are joined back together in the right order at the destination to rebuild the original message.
Section C: Definitions
Q1
packet switching — Data is split into packets that are sent separately, each routed on its own from router to router, then joined back together in the right order at the destination.
Section D: Fill in the Blanks
Q1
packets ← SPLIT(message, 4)
Q2
FOR EACH p IN packets SEND(p, router)
Q3
ordered ← SORT(received, packetNumber)
Q4
message ← JOIN(ordered)
Q5
total ← LENGTH(packets) IF count = total THEN message ← JOIN(ordered)
Section E: Spot the Error
Q1
C — In packet switching the loop must go through the packets, not the whole message. It should be FOR EACH p IN packets, so each packet is sent separately.
Q2
C — Packets are sent separately, not stuck together. Line 3 should be SEND(p1, route1), and p2 is sent on its own in the next line.
Q3
C — A router passes on one packet at a time and never sees the whole message. It should forward the packet: FORWARD(packet, next).
Q4
A — The destination needs all the packets to join the message back together. It should collect them all with ALL_PACKETS(), not only the first packet.
Q5
B — At the sender the message is broken into packets, so it must use SPLIT, not JOIN. The correct line is packets ← SPLIT(message, 4).