Network switch

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

Network switch

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A network switch sends data only to the device it is meant for.
A False
B True
2. Which device connects computers on the same network?
A Network switch
B Monitor
3. What do you plug a network cable into on a switch?
A A keyboard
B A port
4. Which device links different networks together?
A Router
B Switch
5. A school computer lab has 30 wired computers on one network. What helps connect them to each other?
A A switch
B A webcam

Match the Pairs

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

Left columnRight column
1switch.port(3) Arouter.link(school_lan, internet)
2switch.send(data, to="Printer") Bswitch.connect(lab_pc1, lab_pc2, lab_printer)
3A switch connects devices on the same network, such as computers in a school lab CA socket on the switch where one device is plugged in with a cable
4A router links different networks, but a switch only links devices within one network DThe switch passes data only to the device it is meant for, not to every device
5switch.send(data, to="everyone") EA switch does not send data to every device. It sends data only to the device it is meant for.
6switch.link(school_lan, internet) FA switch does not link different networks. Linking a school network to the internet is the job of a router.

Definitions

network switch

Fill in the Blanks

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

1.
connect(laptop, ______)
2.
switch.forward(data, ____)
3.
______.link(school_lan, internet)
4.
for device in ports: if device __ target: send(data, device)
5.
connect(pc, _____, switch)

Spot the Error

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

Question 1
A devices = 4
B ports = 8
C free_ports = ports + devices
D print(free_ports)
Question 2
A packet = get_packet()
B dest = packet.to
C port = ports[dest]
D send_all(ports, packet)
Question 3
A switch = Switch()
B switch.connect(laptop, 1
C switch.connect(printer, 2)
Question 4
A if dest in lan:
B use_switch(dest)
C else:
D use_switch(dest)
Question 5
A print('Switch ports:')
B 8 = ports
C print(ports)

Answer Key

Network switch
Section A: Quick Questions
Q1
B — True
Q2
A — Network switch
Q3
B — A port
Q4
A — Router
Q5
A — A switch
Section B: Match the Pairs
Q1
switch.port(3) → A socket on the switch where one device is plugged in with a cable
Q2
switch.send(data, to="Printer") → The switch passes data only to the device it is meant for, not to every device
Q3
A switch connects devices on the same network, such as computers in a school lab → switch.connect(lab_pc1, lab_pc2, lab_printer)
Q4
A router links different networks, but a switch only links devices within one network → router.link(school_lan, internet)
Q5
switch.send(data, to="everyone") → A switch does not send data to every device. It sends data only to the device it is meant for.
Q6
switch.link(school_lan, internet) → A switch does not link different networks. Linking a school network to the internet is the job of a router.
Section C: Definitions
Q1
network switch — A device that connects computers on the same network and sends data only to the device it is meant for, using its ports. A router links different networks.
Section D: Fill in the Blanks
Q1
connect(laptop, switch)
Q2
switch.forward(data, port)
Q3
router.link(school_lan, internet)
Q4
for device in ports: if device == target: send(data, device)
Q5
connect(pc, cable, switch)
Section E: Spot the Error
Q1
C — Free ports are the ports left after devices are plugged in, so you subtract devices from ports. It should be ports - devices.
Q2
D — A switch sends data only to the port of the device it is meant for. Sending to every port is not how a switch works. It should be send(port, packet).
Q3
B — The closing bracket is missing, so the call is a syntax error. It should be switch.connect(laptop, 1).
Q4
D — A switch only connects devices on the same network. Data for a different network must go through a router, so the else branch should be use_router(dest).
Q5
B — A variable name goes on the left of = and the value goes on the right. It should be ports = 8.