Network Engineer Interview Question

What is the difference between TCP and UDP, and when is each used?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

TCP is connection-oriented: it sets up a session with a three-way handshake, numbers and acknowledges data, retransmits what is lost and controls flow, so data arrives complete and in order. UDP just sends datagrams with no handshake, ordering or retransmission, so it is lighter and adds less delay. TCP suits web traffic, email and file transfer; UDP suits DNS queries, voice and video, where late data is worse than lost data.

Why interviewers ask this

The transport layer underpins firewall rules, troubleshooting and application performance, so interviewers check it early. They want the handshake, the reliability mechanisms and the reason applications choose one or the other. Extra credit comes from practical detail, such as DNS using TCP for zone transfers and large responses, or why voice uses UDP and relies on quality of service rather than retransmission.

How to structure your answer

  • Describe the TCP handshake and reliability features.
  • Describe the lightweight, connectionless UDP model.
  • Give typical applications for each and why.
  • Add a practical detail, such as DNS using both.

Example answer

Spoken example, first person

TCP is connection-oriented. Before any data moves, the two ends do a three-way handshake, SYN, SYN-ACK and ACK, agreeing starting sequence numbers. After that, every byte is numbered and acknowledged, lost segments are retransmitted, windowing stops a fast sender overwhelming a slow receiver, and congestion control backs off when the network is struggling. The result is a reliable, ordered stream, which is what you want for web traffic, email and file transfers. UDP skips all of that. It sends individual datagrams with a small header of source and destination ports, a length and a checksum, and it does not track whether they arrive. That sounds worse, but for real-time voice or video, a retransmitted packet would arrive too late to be useful, so it is better to drop it and carry on. DNS queries use UDP because they are small and a simple retry is quicker than a handshake, although DNS switches to TCP for zone transfers and large responses. For firewalls, TCP state is easy to track from the flags, while UDP state relies on timeouts.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What happens during the TCP four-way close?
  • How does TCP windowing affect throughput on a long-distance link?
  • Why might a firewall drop a long-lived but idle UDP flow?

Related network engineer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot