Hack4Hack

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.

  1. Which protocol guarantees ordered, reliable delivery?

    easy

    1. UDP
    2. TCP
    3. IP
    4. ICMP

    Answer: B. TCP

    Explanation: TCP uses sequence numbers, acknowledgements and retransmission. UDP is connectionless and best-effort, which suits live video and games.

  2. What does DNS do?

    easy

    1. Encrypts web traffic
    2. Translates domain names such as hack4hack.com into IP addresses
    3. Assigns IP addresses to devices
    4. 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.

  3. What is the default port for HTTPS?

    easy

    1. 80
    2. 443
    3. 22
    4. 8080

    Answer: B. 443

    Explanation: HTTP uses 80, HTTPS 443, SSH 22.

  4. Which HTTP status code means "Not Found"?

    easy

    1. 200
    2. 301
    3. 404
    4. 500

    Answer: C. 404

    Explanation: 2xx success, 3xx redirection, 4xx client errors (404 not found, 401 unauthorised), 5xx server errors.

  5. In what order does the TCP three-way handshake send its packets?

    medium

    1. SYN, ACK, FIN
    2. SYN, SYN-ACK, ACK
    3. ACK, SYN, SYN-ACK
    4. 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.

  6. How many usable host addresses are in a /24 IPv4 subnet?

    medium

    1. 256
    2. 254
    3. 255
    4. 24

    Answer: B. 254

    Explanation: 2⁸ = 256 addresses, minus the network address and the broadcast address.

  7. At which OSI layer do routers mainly work?

    medium

    1. Layer 2 (data link)
    2. Layer 3 (network)
    3. Layer 4 (transport)
    4. 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).

  8. What happens when you type a URL and press Enter? Which comes first?

    medium

    1. The TLS handshake
    2. A DNS lookup to find the server's IP address
    3. The HTTP response
    4. 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.

  9. What does TCP congestion control (e.g. slow start) do?

    hard

    1. Encrypts packets
    2. Adjusts the sending rate to avoid overloading the network, growing the window until loss signals congestion
    3. Assigns ports
    4. 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.

  10. What is the main improvement of HTTP/2 over HTTP/1.1?

    hard

    1. It uses UDP
    2. Multiplexing many requests over one connection, with header compression
    3. It removes the need for TLS
    4. 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.

  11. What does NAT (network address translation) allow?

    hard

    1. Faster DNS
    2. Many devices on a private network to share one public IP address
    3. Encryption between routers
    4. 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.

  12. Which statements about TLS are true? (Select all that apply)

    hard

    1. It encrypts traffic between client and server
    2. Certificates let the client verify the server's identity
    3. It uses asymmetric cryptography to agree on symmetric session keys
    4. 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.

Play the Daily Quiz at 4 PM IST