← IGCSE Computer Science Paper 1

A router assigns IP addresses

A router on a local network gives each device that joins its own IP address automatically, so nobody sets it up by hand. Every device gets a different address.

Understanding A router assigns IP addresses in IGCSE Computer Science Paper 1

What it does: The router assigns the address automatically, so the device does not type in its own address. The router hands out IP addresses to the devices that join the network. Every device on the network needs its own unique IP address, or data would not reach the right device. Automatic assignment saves time and avoids mistakes such as two devices being given the same address.

Common mistakes: Assignment in this pseudocode uses the arrow <-, not =. The line should be laptop.ip <- ip, which stores the address the router gave the laptop. An IF statement needs THEN at the end of its first line. It should be IF newDevice.joined = TRUE THEN, so the router assigns an address when a new device joins.

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 342–354) and word search (Modules 325–354).

Take this worksheet further — free with Cloodit

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

Learning
Duo
A new phone joins the school Wi-Fi. What happens to its IP address?
The router gives it an IP address automaticallyThe student must type in an IP address by hand
Matches
Technician types 192.168.1.50 into every new tablet by hand
↓
On a local network the router assigns addresses automatically, so nobody needs to type them in by hand.
Applying
Meanings
Term
router assigns IP
Meaning
A router on a local network gives each device that joins its own IP address automatically, so nobody sets it up by hand. Every device gets a different address.
Practice
WHEN new device joins the LAN
Testing
Gaps
.assignIP(newLaptop)
Check Answer
Spots
3ip <- router.assignIP(laptop)
4laptop.ip = ip

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

The 'Reef Shark' badge — Reef Ruler, 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. A new phone joins the school Wi-Fi. What happens to its IP address?
A. The router gives it an IP address automatically ✓
B. The student must type in an IP address by hand
The router on the local network assigns an address to each device that joins, so no manual set-up is needed.
2. Which device on a home network gives out IP addresses to the other devices?
A. The monitor
B. The router ✓
The router hands out IP addresses to the devices that join the network.
3. A router gives out dynamic IP addresses. What does this mean?
A. The address is given automatically when a device joins ✓
B. The address is permanently fixed to the device by hand
Dynamic addresses are handed out automatically by the router. A fixed address set by hand is a static IP address.
4. A laptop and a tablet are both connected to the same router. Which statement is true?
A. Both devices share the same IP address
B. Each device is given a different IP address ✓
Every device on the network needs its own unique IP address, or data would not reach the right device.
5. Why does the router assign IP addresses automatically?
A. So users do not have to set up each device by hand ✓
B. So that every device has the same MAC address
Automatic assignment saves time and avoids mistakes such as two devices being given the same address.

Match the Pairs

Phone joins Wi-Fi -> router gives 192.168.1.23 → A new device joins the network and the router automatically gives it an IP address
Laptop = 192.168.1.24, Phone = 192.168.1.23 → Each device on the network is given a different IP address by the router
The router gives out dynamic IP addresses, so a device does not need to be set up by hand → ip_address = router.assign()
Every device that joins receives a different address from the router → next_address = last_address + 1
Technician types 192.168.1.50 into every new tablet by hand → On a local network the router assigns addresses automatically, so nobody needs to type them in by hand.
Router gives 192.168.1.30 to both the printer and the laptop → Two devices must never have the same IP address. The router gives each device a different address.

Key Term

router assigns IP
A router on a local network gives each device that joins its own IP address automatically, so nobody sets it up by hand. Every device gets a different address.

Fill in the Blanks

1. router.assignIP(newLaptop)
Hint: Type the name of the network hardware that hands an address to a joining device.
2. IF device.joined THEN router.assignIP(device) ENDIF
Hint: Type the keyword that starts the code to run when the condition is true.
3. ipPhone = router.assignIP(phone) ipLaptop = router.assignIP(laptop) OUTPUT ipPhone != ipLaptop
Hint: Type the operator meaning 'not equal', because each device gets a different address.
4. tabletIP = router.assignIP(tablet) OUTPUT tabletIP
Hint: Type the router's method name that gives a joining device an address automatically.
5. FOR EACH device IN network router.assignIP(device) NEXT device
Hint: Type the keyword that makes the loop visit every device on the network in turn.

Spot the Error

Question 1
A laptop <- NewDevice()
B laptop.joinNetwork()
C ip <- router.assignIP(laptop)
D laptop.ip = ip
Line D — Assignment in this pseudocode uses the arrow <-, not =. The line should be laptop.ip <- ip, which stores the address the router gave the laptop.
Question 2
A IF newDevice.joined = TRUE
B ip <- router.assignIP()
C newDevice.ip <- ip
D ENDIF
Line A — An IF statement needs THEN at the end of its first line. It should be IF newDevice.joined = TRUE THEN, so the router assigns an address when a new device joins.
Question 3
A router.mode <- "static"
B pc <- NewDevice("PC")
C ip <- router.assignIP(pc)
Line A — With static addressing, a person sets each address by hand. The router assigns addresses automatically in dynamic mode, so the line should be router.mode <- "dynamic".
Question 4
A FOR EACH device IN newDevices
B ip <- user.typeIP(device)
C device.ip <- ip
D NEXT device
Line B — The router gives each device its address automatically, so a user does not type it in by hand. The line should be ip <- router.assignIP(device).
Question 5
A tablet <- NewDevice("Tablet")
B tablet.ip <- tablet.assignIP()
C OUTPUT tablet.ip
Line B — The device does not give itself an address. The router on the network assigns it, so the line should be tablet.ip <- router.assignIP().

Student with a class code? Join your class →