Packet Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Packet.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

A small unit of data transmitted over a network, containing both the data payload (the actual information) and routing information in headers (source address, destination address, sequence number). Large messages are split into many packets, sent independently, and reassembled at the destination.

Sending data over a network is like sending a book by mail โ€” you break it into chapters (packets), label each one with the destination, and reassemble at the other end.

Read the full concept explanation โ†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Packet switching means data is broken into pieces that can travel independently โ€” making networks resilient and efficient.

Common stuck point: Packets from the same message can take different routes and arrive out of order โ€” the receiving device reassembles them.

Sense of Study hint: When learning about packets, think of sending a long letter by cutting it into numbered postcards. Each postcard has the destination address and a sequence number. They might travel different postal routes, but the recipient uses the sequence numbers to reassemble the original letter in order.

Worked Examples

Example 1

easy
What is a data packet and why is data sent in packets rather than as one continuous stream?

Answer

Packets are small data chunks with addressing headers. Splitting data into packets enables sharing of network capacity and efficient error recovery.

First step

1
Step 1: A packet is a small chunk of data with a header containing information like source address, destination address, and sequence number.

Full solution

  1. 2
    Step 2: Splitting data into packets allows multiple communications to share the same network connection (like cars sharing a road).
  2. 3
    Step 3: If one packet is lost, only that small piece needs retransmitting โ€” not the entire file. This makes data transfer more efficient and reliable.
Packet switching is the foundation of internet communication. It allows millions of users to share network infrastructure simultaneously, unlike circuit switching (telephone) which dedicates a line to each call.

Example 2

medium
Describe what information a packet header contains and why each piece is needed.

Example 3

medium
A 6800-byte file is sent via 1500-byte payloads. How many packets, and how many bytes does the last carry?

Example 4

hard
Compare circuit switching (phone line) vs packet switching (internet) when a link fails mid-message. Why does packet switching survive?

Example 5

hard
For a 100,000-byte file with 1500-byte payload and 40-byte header per packet, compute number of packets and total bytes on wire.

Example 6

challenge
A video call drops 2% of packets but stays usable. Compare this to a file download losing 2% of packets โ€” why does the file still arrive perfect while the video glitches?

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

medium
A 1 MB file is split into 1000 packets. Packet 500 is lost during transmission. Describe what happens next.

Example 2

hard
Explain why packets from the same file might take different routes across the internet and arrive out of order. How does the receiving computer handle this?

Example 3

easy
A packet has two main parts: the actual data and the ____ that holds routing info.

Example 4

easy
Why are large messages split into packets instead of sent as one big block?

Example 5

easy
Do all packets of one message always take the same route? Yes or no.

Example 6

easy
What field lets the receiver reassemble packets in the right order?

Example 7

easy
Is there a maximum size for a single packet? Yes or no.

Example 8

easy
If a packet is lost, does TCP automatically resend it? Yes or no.

Example 9

easy
Reassembling packets into the original message happens at which end: sender or destination?

Example 10

easy
The actual information a packet carries (not the header) is called the ____.

Example 11

medium
A 10000-byte message is sent in packets with max payload 1500 bytes. How many packets are needed?

Example 12

medium
Packets arrive in order 3, 1, 2. Using sequence numbers, what order does the receiver assemble them in?

Example 13

medium
A 4500-byte file uses 1500-byte payloads. If one of the 3 packets is lost and resent, how many packet transmissions occur in total?

Example 14

medium
Why might packets of one download arrive out of order even with no errors?

Example 15

medium
A header adds 40 bytes per packet. For 5 packets, how many total header bytes are sent?

Example 16

medium
If your video call drops a few packets, the picture glitches but the call continues. Which delivery style is this: reliable resend, or tolerate-and-continue?

Example 17

medium
A message split into 8 packets: 6 take route A, 2 take route B. Does the receiver still reconstruct the original message? Yes or no, and via what?

Example 18

medium
A 7000-byte message uses 1000-byte payloads. How many packets are needed?

Example 19

medium
Packets arrive numbered 2, 4, 1, 3. In what order does the receiver assemble them?

Example 20

challenge
Explain how packet switching makes a network more resilient than sending each message as one indivisible unit over one fixed path.

Example 21

challenge
A 1 MB file (1048576 bytes) is sent with 1024-byte payloads. How many packets, and why is the count exact here?

Example 22

challenge
Why does packet loss not necessarily mean the connection is broken? Describe the mechanism that hides the loss from the user.

Example 23

easy
True or false: every packet from one message must take the same path.

Example 24

easy
A packet contains payload plus what other major part?

Example 25

easy
Are packet headers needed at both sender and receiver? Why or why not?

Example 26

easy
If a packet is corrupted in transit, which header field most easily detects the error?

Example 27

easy
Where is a message reassembled from its packets?

Example 28

medium
A 12,000-byte message uses 1500-byte payloads. How many packets needed?

Example 29

medium
A 5000-byte message uses 1500-byte payloads. How many packets?

Example 30

medium
Header overhead is 50 bytes per packet. For 10 packets, total header bytes sent?

Example 31

medium
Packets arrive: 4, 2, 1, 3. After reassembly, in what order is the data delivered to the app?

Example 32

medium
In TCP, what does the sender do when a packet's ACK doesn't arrive in time?

Example 33

medium
A video stream prefers low latency over perfect reliability. Which protocol style is typical: TCP retransmit, or UDP best-effort?

Example 34

medium
A router decides on a per-packet basis where to send each. What general routing model is this?

Example 35

medium
Header is 40 bytes, payload is 1460 bytes. What fraction of the packet is overhead?

Example 36

medium
A 30,000-byte message with 1000-byte payloads is sent. How many packets?

Example 37

medium
Two header fields that the receiver uses for reassembly are the source address and the ____ number.

Example 38

hard
A 1 MB file (1,048,576 bytes) is split into 1500-byte payloads. How many packets?

Example 39

hard
Packets in a 100-packet message arrive with 3 lost. Using TCP, how many additional packets does the sender retransmit (minimum)?

Example 40

hard
A 50-packet stream sees packet 17 arrive twice. How does the receiver handle the duplicate?

Example 41

hard
A 2 MB file (2,097,152 bytes) split into 1024-byte payloads. How many packets?

Example 42

challenge
Why does shrinking MTU increase total bytes on the wire for the same payload? Quantify with header H per packet.

Related Concepts

Background Knowledge

These ideas may be useful before you work through the harder examples.

networkinternet