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 is the difference between TCP and UDP?

    TCP is connection-based and reliable, with ordering, retransmission and flow control, so it suits web pages, email and file transfer. UDP just sends datagrams with no guarantees, so it is faster and lighter and suits video calls, games, DNS and live streaming.

    BeginnerIn-depth3 min read
  2. Can UDP datagrams arrive out of order, duplicated, or not at all?

    Yes to all three. UDP makes no promises about order, duplicates, or delivery. Each datagram is independent and can take a different route, so the application must tolerate or handle these cases.

    BeginnerQuick answer1 min read
  3. What does a UDP header contain, and how big is it?

    A UDP header is 8 bytes with four 16-bit fields: source port, destination port, length, and checksum. A TCP header is at least 20 bytes. That small size is part of why UDP is light.

    BeginnerQuick answer1 min read
  4. When would you choose UDP over TCP? Give real examples.

    Choose UDP when speed and low delay matter more than perfect delivery, or when the app wants its own control: live video calls, online games, DNS lookups, and streaming. Old data is useless in real time, so waiting for a retransmission is worse than skipping it.

    BeginnerQuick answer1 min read
  5. 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
  6. 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
  7. 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
  8. 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