Computer networks: practice questions with explanations
Free Computer networks multiple-choice practice questions with hints and explanations, at three levels: key terms and facts, applying the concepts, cases and analysis.
A network is a group of devices that exchange data: laptops, phones, servers, printers. The devices on it are called hosts.
A network inside one building or campus is a LAN (local area network). A network across cities or countries is a WAN (wide area network). The internet connects millions of networks.
Data does not travel as one long stream. It is cut into small pieces called packets, and each packet finds its own way to the destination.
Devices can only understand each other if they follow the same rules. Such a set of rules for the format and order of messages is a protocol. TCP, IP and HTTP are protocols.
Most services follow the client–server model: a client, such as your browser, sends a request, and a server sends back the answer.
Two words describe how fast a connection is. Bandwidth is the maximum data rate, for example 100 Mbit/s. Latency is the delay before the data arrives, measured in milliseconds.
Self-check A satellite link carries 50 Mbit/s, but every reply takes 600 ms to arrive. Which statement is right?
Bandwidth and latency are the same thing here
It has high bandwidth and high latency
It has low bandwidth because it is slow
It has low latency because it carries a lot of data
Answer: It has high bandwidth and high latency. Bandwidth is capacity (50 Mbit/s is plenty) and latency is delay (600 ms is a lot). The two are independent, so a link can have both high bandwidth and high latency.
2Layers and encapsulation
Networking is split into layers. Each layer solves one problem and uses the layer below it. The OSI model has 7 layers; the TCP/IP model used on the internet groups them into 4 or 5.
1 Physical: sends raw bits as electrical, light or radio signals over cables and air.
2 Data link: delivers frames between devices on the same local network, using MAC addresses. Ethernet and Wi-Fi live here.
3 Network: delivers packets across networks, using IP addresses. Routers work here.
4 Transport: delivers data between programs, using port numbers. TCP sends segments; UDP sends datagrams.
5–7 Session, presentation, application: the services people use, such as HTTP for the web, DNS for names and SMTP for email.
When data is sent, every layer adds its own header in front of the data from the layer above. This is called encapsulation. The receiver removes the headers in reverse order.
TCP sets up a connection first (the three-way handshake SYN, SYN-ACK, ACK). It numbers the data, waits for acknowledgements and resends what is lost. It is reliable and ordered.
UDP sends without a connection and without resending. It is faster and is used where delay matters more than a lost packet: live video, games, and short DNS queries.
Self-check At which OSI layer does a normal switch work?
Layer 1, physical
Layer 2, data link
Layer 3, network
Layer 4, transport
Answer: Layer 2, data link. A switch forwards frames using MAC addresses, and MAC addresses belong to the data link layer. A router, which uses IP addresses, works at layer 3.
3Addresses, devices and helper protocols
Three kinds of address work together, one per layer:
MAC address (layer 2): a 48-bit hardware address of a network card. It is used only inside the local network.
IP address (layer 3): an IPv4 address has 32 bits, an IPv6 address 128 bits. It says where a host is on the internet.
Port number (layer 4): picks the program on the host. Well-known ports run from 0 to 1023: HTTP 80, HTTPS 443, SSH 22, DNS 53, SMTP 25.
The devices follow the same layers. A hub (layer 1) copies every signal to all ports. A switch (layer 2) sends a frame only to the port of the destination MAC address. A router (layer 3) forwards packets between networks.
A few helper protocols make this work:
DHCP gives a host its IP address, mask, default gateway and DNS server when it joins the network.
DNS translates a name such as example.com into an IP address, like a phone book.
ARP finds the MAC address that belongs to an IP address on the local network.
ICMP carries error and test messages. The ping command uses ICMP echo requests.
NAT lets many devices with private addresses (10.x, 172.16–31.x, 192.168.x) share one public address.
The default gateway is the router a host sends every packet to when the destination is outside its own subnet.
Self-check Which protocol finds the MAC address that belongs to a known IP address on the local network?
ARP
DHCP
DNS
ICMP
Answer: ARP. ARP asks “who has this IP address?” and the owner replies with its MAC address. DNS turns names into IP addresses, which is a different translation.
4The method step by step
Most questions, from definitions to troubleshooting cases, can be answered with the same steps.
Find the layer. Is the question about signals, frames and MAC addresses, packets and IP addresses, ports and connections, or an application?
Name the device or protocol that works at that layer: hub, switch or router; Ethernet, IP, TCP or UDP; DNS, DHCP or HTTP.
For a fault, list what still works and what fails. Something that works proves every layer below it is fine.
Look for the lowest layer that can explain everything that fails. That is the most likely cause.
Check your answer against the other facts in the question: it must explain all of them.
For short calculations: transmission delay is packet size divided by link rate, and propagation delay is distance divided by signal speed.
ttrans = L / R tprop = d / v
5A worked example
Follow every step. Try to predict the next one before you open it.
Worked example
A user can ping 8.8.8.8, a server on the internet, but cannot open any website by name. Where is the problem most likely?
1
List what works
A ping to an internet address gets replies. So the cable or Wi-Fi works (layer 1 and 2), the host has a valid IP address, and the default gateway and routing work (layer 3).
2
List what fails
Websites opened by name fail. Before a browser can contact www.example.com, it has to turn that name into an IP address.
3
Find the protocol
Translating names into IP addresses is the job of DNS, an application-layer protocol.
4
Rule out the alternatives
A wrong default gateway would also stop the ping to 8.8.8.8. A broken cable would stop everything. Neither fits the facts.
5
Check the answer
A DNS fault explains all the facts: traffic by IP address works, traffic by name does not. The fix is a correct DNS server setting, usually given by DHCP.
Answer
The problem is name resolution: the host’s DNS setting or DNS server.
6Common mistakes
Mixing up DNS and DHCP. DNS translates names into addresses; DHCP hands out addresses.
Mixing up a switch and a router. A switch uses MAC addresses inside one network; a router uses IP addresses between networks.
Thinking UDP is “bad TCP”. It is chosen on purpose when low delay matters more than resending lost data.
Confusing bandwidth (capacity) with latency (delay).
Putting port numbers at the network layer. Ports belong to the transport layer; IP addresses to the network layer.
Forgetting the default gateway. Without it, a host reaches its own subnet but nothing beyond it.
Self-check A PC can reach printers on its own subnet but nothing beyond it. Its IP address and mask are correct. What is the most likely fault?
A broken network cable
A missing or wrong default gateway
A wrong DNS server
A wrong MAC address
Answer: A missing or wrong default gateway. Local traffic works, so the cable, the MAC address and the IP settings are fine. Every packet to another network goes to the default gateway, so that is what is missing. A DNS fault would not stop traffic to an IP address.
7How exam questions look
Easy: key terms and facts. The number of OSI layers, what DNS or DHCP does, default port numbers, the size of an IPv4 address.
Medium: applying the concepts. The layer of a device, why a protocol is chosen, what ARP, NAT or the TCP handshake does, small subnet and delay calculations.
Hard: cases and analysis. Troubleshooting scenarios, TCP behaviour under loss and congestion, routing protocols, attacks such as ARP spoofing or SYN floods, and TLS.
Every question has four options. Eliminate the options that belong to the wrong layer first; often only one is left.
Two wrong answers are now crossed out. One of the remaining two is right.
Show the answer and explanation
Why this is the answer
IPv4 addresses are 32 bits, written as four decimal octets. IPv6 addresses are 128 bits.
Answer
A · 32
Example 2Medium
What is the IPv6 loopback address?
A::
B::1
Cfe80::1
Dff02::1
Show hints
The shortened form of an address that is all zeros except the last bit.
Two wrong answers are now crossed out. One of the remaining two is right.
Show the answer and explanation
Why this is the answer
::1 is the loopback address. :: is the unspecified address, fe80::/10 is link-local and ff02::1 is the all-nodes multicast group.
Answer
B · ::1
Example 3Hard
How does fragmentation differ in IPv6 compared with IPv4?
AIPv6 does not allow packets larger than 576 bytes
BIPv6 fragments at the transport layer inside TCP
CIPv6 routers fragment every packet larger than 64 bytes before forwarding it on the path
DRouters never fragment IPv6 packets; only the source can, using path MTU discovery
Show hints
Think about who does the work: endpoints or routers.
Two wrong answers are now crossed out. One of the remaining two is right.
Show the answer and explanation
Why this is the answer
An IPv6 router drops an oversized packet and returns ICMPv6 Packet Too Big. The source then sends smaller packets or uses a fragment extension header.
Answer
D · Routers never fragment IPv6 packets; only the source can, using path MTU discovery
Questions and answers
What is Computer networks?
A network is a group of devices that exchange data: laptops, phones, servers, printers. The devices on it are called hosts.
A network inside one building or campus is a LAN (local area network). A network across cities or countries is a WAN (wide area network). The internet connects millions of networks.
How do I learn Computer networks step by step?
What a computer network is
Layers and encapsulation
Addresses, devices and helper protocols
The method step by step
A worked example
Common mistakes
How exam questions look
What do the Computer networks exercises cover?
Easy: key terms and facts
Medium: applying the concepts
Hard: cases and analysis
Every question has four options, and only one is right. Stuck? Open a small hint first, and the full explanation only when you need it.
How practising works
Every question has four options, and only one is right.
Stuck? Open a small hint first, and the full explanation only when you need it.
Your progress, mistakes and saved problems are kept, so you can review before the exam.