Computer Networks practice questions with answers
Practise computer networks questions at your own pace: TCP and UDP, DNS, HTTP, the OSI model, subnetting and TLS. Pick an answer to see whether you are right and why. Nothing is timed or ranked here; for that, play the Daily Quiz at 4 PM IST.
Which protocol guarantees ordered, reliable delivery?
easy
- UDP
- TCP
- IP
- ICMP
Answer: B. TCP
Explanation: TCP uses sequence numbers, acknowledgements and retransmission. UDP is connectionless and best-effort, which suits live video and games.
What does DNS do?
easy
- Encrypts web traffic
- Translates domain names such as hack4hack.com into IP addresses
- Assigns IP addresses to devices
- Routes packets between networks
Answer: B. Translates domain names such as hack4hack.com into IP addresses
Explanation: DHCP assigns addresses; routers route packets; TLS encrypts.
What is the default port for HTTPS?
easy
- 80
- 443
- 22
- 8080
Answer: B. 443
Explanation: HTTP uses 80, HTTPS 443, SSH 22.
Which HTTP status code means "Not Found"?
easy
- 200
- 301
- 404
- 500
Answer: C. 404
Explanation: 2xx success, 3xx redirection, 4xx client errors (404 not found, 401 unauthorised), 5xx server errors.
In what order does the TCP three-way handshake send its packets?
medium
- SYN, ACK, FIN
- SYN, SYN-ACK, ACK
- ACK, SYN, SYN-ACK
- HELLO, OK, START
Answer: B. SYN, SYN-ACK, ACK
Explanation: The client sends SYN, the server answers SYN-ACK, the client confirms with ACK. Both sides then know each other's starting sequence numbers.
How many usable host addresses are in a /24 IPv4 subnet?
medium
- 256
- 254
- 255
- 24
Answer: B. 254
Explanation: 2⁸ = 256 addresses, minus the network address and the broadcast address.
At which OSI layer do routers mainly work?
medium
- Layer 2 (data link)
- Layer 3 (network)
- Layer 4 (transport)
- Layer 7 (application)
Answer: B. Layer 3 (network)
Explanation: Routers forward packets by IP address (layer 3). Switches forward frames by MAC address (layer 2).
What happens when you type a URL and press Enter? Which comes first?
medium
- The TLS handshake
- A DNS lookup to find the server's IP address
- The HTTP response
- Rendering the page
Answer: B. A DNS lookup to find the server's IP address
Explanation: DNS resolution, then a TCP connection, then the TLS handshake (for HTTPS), then the HTTP request and response, then rendering.
What does TCP congestion control (e.g. slow start) do?
hard
- Encrypts packets
- Adjusts the sending rate to avoid overloading the network, growing the window until loss signals congestion
- Assigns ports
- Compresses headers
Answer: B. Adjusts the sending rate to avoid overloading the network, growing the window until loss signals congestion
Explanation: Flow control protects the receiver; congestion control protects the network. Slow start grows the window exponentially, then more carefully.
What is the main improvement of HTTP/2 over HTTP/1.1?
hard
- It uses UDP
- Multiplexing many requests over one connection, with header compression
- It removes the need for TLS
- It caches responses forever
Answer: B. Multiplexing many requests over one connection, with header compression
Explanation: HTTP/1.1 effectively handles one request at a time per connection. HTTP/3 goes further and runs over QUIC, on UDP.
What does NAT (network address translation) allow?
hard
- Faster DNS
- Many devices on a private network to share one public IP address
- Encryption between routers
- Load balancing by default
Answer: B. Many devices on a private network to share one public IP address
Explanation: The router rewrites addresses and ports and remembers which internal device each connection belongs to.
Which statements about TLS are true? (Select all that apply)
hard
- It encrypts traffic between client and server
- Certificates let the client verify the server's identity
- It uses asymmetric cryptography to agree on symmetric session keys
- It hides which IP address you connect to
Answer: A. It encrypts traffic between client and server; B. Certificates let the client verify the server's identity; C. It uses asymmetric cryptography to agree on symmetric session keys
Explanation: The IP address (and usually the domain name, via SNI) is still visible; TLS protects the content.