Interview Q&A / Computer Networks

INTERVIEW Q&A · 55 QUESTIONS

Computer Networks interview questions

What happens when you open a website, TCP vs UDP, DNS and HTTP.

  1. What are the main differences between HTTP/1.1 and HTTP/2?

    HTTP/2 uses a binary format, multiplexes many requests over a single TCP connection, compresses headers with HPACK and allows prioritisation. HTTP/1.1 is plain text and handles one request at a time per connection, so browsers open several connections instead.

    IntermediateQuick answer1 min read
  2. What are unicast, broadcast and multicast, and why can TCP not use the last two?

    Unicast sends to one receiver, broadcast to every host on the local network, and multicast to a group that has joined. TCP needs a two-way connection with one peer, so it only supports unicast; broadcast and multicast use UDP.

    IntermediateQuick answer1 min read
  3. What changes in a packet as it passes through routers?

    The IP source and destination stay the same (without NAT), but each router decrements the TTL by 1 and the Ethernet frame is rebuilt with new source and destination MAC addresses for the next link.

    IntermediateQuick answer1 min read
  4. What is a socket, and how can one server handle thousands of clients on port 443?

    A socket is one endpoint of a connection: an IP address plus a port plus a protocol. A TCP connection is identified by the four-tuple of source IP, source port, destination IP and destination port, so many clients can share the server's port 443 because each tuple is unique.

    IntermediateQuick answer1 min read
  5. What is MTU, and what happens when a packet is bigger than it?

    MTU is the largest packet a link can carry; Ethernet's is usually 1500 bytes. IPv4 routers may split a bigger packet into fragments, or drop it and send an ICMP message if the Don't Fragment bit is set. IPv6 routers never fragment.

    IntermediateQuick answer1 min read
  6. What is route summarization? Summarize 192.168.0.0/24 and 192.168.1.0/24.

    Summarization replaces several contiguous routes with one shorter-prefix route. 192.168.0.0/24 and 192.168.1.0/24 combine into 192.168.0.0/23, which covers 192.168.0.0 to 192.168.1.255, so routers keep one entry instead of two.

    IntermediateQuick answer1 min read
  7. What is the difference between a recursive and an iterative DNS query?

    In a recursive query, the client asks a resolver to do all the work and return a final answer. In an iterative query, the server replies with its best referral and the asker follows it to the next server. Your device asks recursively; the resolver then asks iteratively.

    IntermediateQuick answer1 min read
  8. What is the difference between distance vector and link state routing protocols?

    Distance vector protocols like RIP share their routing table with neighbours and trust what they hear (routing by rumour). Link state protocols like OSPF flood the full network map to everyone, and each router computes shortest paths itself with Dijkstra's algorithm.

    IntermediateQuick answer1 min read
  9. What is the difference between TCP flow control and congestion control?

    Flow control stops a fast sender from overwhelming a slow receiver, using the receiver's advertised window. Congestion control stops senders from overwhelming the network in between, using a congestion window the sender maintains itself. The sender obeys the smaller of the two.

    IntermediateQuick answer1 min read
  10. What is VLSM? Allocate subnets for 100, 50 and 20 hosts from 192.168.5.0/24.

    VLSM (variable length subnet masking) lets each subnet use the mask that fits its size instead of one size for all. Allocate largest first: /25 for 100 hosts, /26 for 50, /27 for 20, and a /30 for a router link.

    IntermediateQuick answer1 min read
  11. Why does DNS mostly use UDP, and when does it switch to TCP?

    A DNS lookup is one small question and one small answer, so UDP avoids the cost of a handshake. DNS falls back to TCP when the answer is too large for a UDP response (truncated flag set), for zone transfers, and for DNS over TLS.

    IntermediateQuick answer1 min read
  12. UDP is unreliable. How can an application still get reliable delivery over it?

    The application adds what it needs on top: sequence numbers to order and detect gaps, acknowledgements and retransmission for missing data, and timers. QUIC, used by HTTP/3, does exactly this over UDP, along with congestion control and encryption.

    AdvancedQuick answer1 min read
  13. What is BGP, and why is it called the routing protocol of the internet?

    BGP (Border Gateway Protocol) exchanges routes between autonomous systems, the independently run networks that make up the internet, such as ISPs and large companies. It chooses paths by policy and AS path length, not simply the shortest link.

    AdvancedQuick answer1 min read
  14. What is DNS cache poisoning, and how is it prevented?

    An attacker tricks a resolver into caching a forged answer, such as a bank's name mapped to the attacker's IP. Later users of that resolver are sent to the fake site. Defences include random source ports and query IDs, and DNSSEC, which signs records.

    AdvancedQuick answer1 min read
  15. What is head-of-line blocking, and how do HTTP/2 and HTTP/3 deal with it?

    Head-of-line blocking is when one slow or lost item holds up everything queued behind it. HTTP/1.1 blocks at the request level, HTTP/2 fixes that with multiplexing but still blocks at the TCP level on packet loss, and HTTP/3 over QUIC removes even that.

    AdvancedQuick answer1 min read
  16. What is HTTP/3, and why does it run over QUIC instead of TCP?

    HTTP/3 is HTTP carried over QUIC, a protocol built on UDP that has its own reliable streams, congestion control and built-in TLS 1.3. It avoids TCP head-of-line blocking, connects faster, and survives network changes such as moving from Wi-Fi to mobile data.

    AdvancedQuick answer1 min read
  17. Why can you not put a CNAME record on the root domain, such as example.com?

    A CNAME means this name is an alias for another name, so no other record may exist at it. The root of a zone must also hold NS and SOA records, so a CNAME there would conflict. Providers offer ALIAS, ANAME or CNAME flattening as a workaround.

    AdvancedQuick answer1 min read