← IGCSE Computer Science Paper 1

Packet number in a packet header

A number in the packet header showing the packet's position in the whole message (e.g. packet 3 of 10), so packets that arrive out of order can be put back in the right order.

Understanding Packet number in a packet header in IGCSE Computer Science Paper 1

What it does: The packets arrive as 3, 1, 2 but sorting by packet number restores the correct order 1, 2, 3. The header holds control information such as the packet number, while the payload holds the actual data. The packet number shows where the packet belongs in the whole message, for example packet 3 of 10.

Common mistakes: A packet number shows the packet's position in the message, so it cannot be bigger than the total. In a 10-packet message the numbers run from 1 to 10. Packet 11 cannot exist, so the line should be packet_number ← 3. Every packet has the same destination address, so sorting by it cannot restore the order. The packets must be sorted by packet_number.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 110–120) and word search (Modules 86–120).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does the packet number in a packet header tell the receiving computer?
The size of the router that sent itThe packet's position in the whole message
Matches
Packets arrive 4, 2, 1, 3, so the message is read in the order they arrived
↓
The message must not be read in arrival order. The packet numbers should be used to reorder the packets as 1, 2, 3, 4 first.
Applying
Meanings
Term
packet number
Meaning
A number in the packet header showing the packet's position in the whole message (e.g. packet 3 of 10), so packets that arrive out of order can be put back in the right order.
Practice
packetNumber ← 3
Testing
Gaps
← 3
Check Answer
Spots
1HEADER
2 packet_number ← 11

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Woodpecker' badge — Tap Tap Tap, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does the packet number in a packet header tell the receiving computer?
A. The size of the router that sent it
B. The packet's position in the whole message ✓
The packet number shows where the packet belongs in the whole message, for example packet 3 of 10.
2. Which part of a packet stores the packet number?
A. The header ✓
B. The payload
The packet number is part of the header, along with the destination and originator's addresses. The payload holds the actual data.
3. A header says 'packet 3 of 10'. What does this mean?
A. This packet contains 3 bytes of data out of 10
B. This is the third packet out of ten in the message ✓
'3 of 10' gives the packet's position (3rd) and the total number of packets in the message (10), not its size.
4. Why do packets need a packet number?
A. Packets can arrive out of order and must be put back in order ✓
B. Packets always arrive in order so the number checks the speed
Packets can take different routes, so they may arrive out of order. The packet number lets the destination reorder them.
5. Packets 1, 4, 2 and 3 arrive at the destination. How does the computer put them in the right order?
A. It uses the packet numbers in the headers ✓
B. It uses the order in which they arrived
The arrival order can't be trusted because packets take different routes. The packet numbers show the correct order.

Match the Pairs

packet_number = 3 → This packet is the third packet in the message, so it goes after packets 1 and 2 when the message is rebuilt
packet 3 of 10 → The packet number and the total number of packets, so the receiver knows this is the third of ten and how many to expect
Packets can arrive out of order, so the packet number is used to put them back in the correct order → arrived = [3, 1, 2] sorted(arrived) # [1, 2, 3]
The packet number is stored in the packet header, not in the payload → header = {"packet_number": 3} payload = "data"
Packets arrive 4, 2, 1, 3, so the message is read in the order they arrived → The message must not be read in arrival order. The packet numbers should be used to reorder the packets as 1, 2, 3, 4 first.
Packet number = 3 means the packet contains 3 bytes of data → The packet number shows the packet's position in the message, not the size of its data. It means this is the third packet.

Key Term

packet number
A number in the packet header showing the packet's position in the whole message (e.g. packet 3 of 10), so packets that arrive out of order can be put back in the right order.

Fill in the Blanks

1. packetNumber ← 3 totalPackets ← 10
Hint: Type the variable name that holds the packet's position in the whole message.
2. OUTPUT packetNumber, "of", totalPackets
Hint: Type the pseudocode keyword that displays values, so we can see which packet this is (e.g. 3 of 10).
3. packets ← [3, 1, 2] SORT packets BY packetNumber ASCENDING
Hint: Type the keyword for the direction (smallest to largest) that puts packets back in their original order.
4. IF packetNumber = 3 THEN OUTPUT "Packet 3 arrived" ENDIF
Hint: Type the comparison operator that checks whether the packet number equals a value.
5. totalPackets ← 10 FOR packetNumber ← 1 TO totalPackets NEXT packetNumber
Hint: Type the variable that holds how many packets are in the message, so the loop counts every packet number.

Spot the Error

Question 1
A HEADER
B packet_number ← 11
C total_packets ← 10
D END HEADER
Line B — A packet number shows the packet's position in the message, so it cannot be bigger than the total. In a 10-packet message the numbers run from 1 to 10. Packet 11 cannot exist, so the line should be packet_number ← 3.
Question 2
A received ← []
B FOR EACH packet arriving
C APPEND packet TO received
D SORT received BY destination
Line D — Every packet has the same destination address, so sorting by it cannot restore the order. The packets must be sorted by packet_number.
Question 3
A header ← NEW HEADER
B header.address ← 3
C header.total ← 10
Line B — The position of the packet is stored in the packet number field, not an address field. The line should be header.number ← 3.
Question 4
A FOR n ← 1 TO 10
B packet.number ← n
C packet.total ← n
D SEND packet
Line C — The total is the same for every packet in the message, so it must stay 10. Only packet.number changes with n. The line should be packet.total ← 10.
Question 5
A next ← 1
B WHILE next <= 10
C SHOW packet next
D next ← next - 1
Line D — To put the packets back in order, the counter must go up by one each time (1, 2, 3 ... 10). Subtracting would go backwards and the loop would never finish. It should be next ← next + 1.

Student with a class code? Join your class →