🎓 BookMCQ
← Back to 24. Transport Layer Protocols

📝 User Datagram Protocol (UDP) overview (9 MCQs)

Connectionless Datagram Service Above IP

UDP is a transport-layer protocol in the TCP/IP suite and corresponds to OSI Layer 4. It provides connectionless, message-oriented delivery using source and destination ports, a length field, and a checksum. Each UDP message is carried as a datagram inside IP. UDP does not establish a connection or guarantee delivery, ordering, duplicate suppression, or retransmission. It defines the boundary between application processes and packet delivery.

Why a Lightweight Transport Protocol Is Useful

Some applications exchange short messages or time-sensitive data for which connection establishment and in-order retransmission can add unwanted delay. TCP's reliable byte stream may also obscure application message boundaries. UDP offers a smaller transport header and preserves datagram boundaries, leaving any required reliability, timing, or sequencing logic to the application.

Datagram Construction and Receiver Delivery

The sender places application data after an eight-byte UDP header containing source port, destination port, length, and checksum. IP carries the datagram to the destination host. The receiver checks the UDP length and checksum where applicable, then uses the destination port to deliver the message to the appropriate socket; no UDP handshake is required.

A DNS Query Sent as a UDP Datagram

A resolver can send a DNS query from a temporary source port such as 53000 to destination port 53. The UDP length includes its eight-byte header and the DNS message. The server replies to the client's source port. If the datagram is lost, UDP itself does not retransmit it; the DNS client may retry.

Low Overhead with Application-Level Responsibility

UDP's fixed eight-byte header and lack of connection state suit DNS, DHCP, real-time media, and many game updates. However, packets can be lost, duplicated, or reordered, and applications must handle any required recovery. UDP also does not provide transport congestion control, so applications must account for network load to avoid harmful transmission rates.

Correcting Common Assumptions About UDP

'UDP guarantees fast delivery' is false: it avoids setup and recovery overhead but cannot control path delay. 'UDP has no error detection' is false: it includes a checksum, mandatory in normal IPv6 use. 'UDP sends a continuous byte stream' is false: it preserves separate datagram message boundaries. These distinctions separate similar mechanisms that are often confused.

Exam Focus: UDP Header, Semantics and Applications

Identify UDP as connectionless and message-oriented, and recall its eight-byte header and four 16-bit fields. Explain why UDP does not provide acknowledgments or retransmission, and distinguish transport checksum validation from recovery. Match applications to UDP when message boundaries or low setup overhead are important, while noting application-level responsibilities. Use the assumptions stated in each question when calculating.

Key Terms for User Datagram Protocol (UDP) Overview

  • Datagram - Independent UDP message unit.
  • Source port - Identifies the sending endpoint.
  • Destination port - Identifies the receiving endpoint.
  • UDP length - Counts header and payload bytes.
  • Checksum - Detects transmission corruption.
  • Socket - Application interface to UDP communication.
3
Easy
4
Medium
2
Hard

📝 All User Datagram Protocol (UDP) overview MCQs

Q1. A client needs to send a 20‑byte message to a server and can tolerate occasional loss. Which reason best explains why UDP is preferable to TCP in this case?

A.UDP adds flow control, reducing latency
B.UDP’s 8‑byte header incurs less overhead than TCP’s 20‑byte header ✅
C.UDP guarantees delivery of small messages
D.UDP provides built‑in encryption
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: UDP’s header is only 8 bytes while TCP’s minimum header is 20 bytes, so the relative overhead for a 20‑byte payload is much smaller, reducing transmission time and processing delay. Because the application tolerates loss, the lack of reliability mechanisms in UDP further speeds delivery.

Q2. If a UDP datagram’s checksum field is set to zero, what can be inferred about the sender’s intention regarding error detection?

A.Sender requests the receiver to ignore errors
B.Sender assumes the underlying IP layer will handle errors
C.Sender indicates that the datagram contains no data
D.Sender signals that checksum calculation was omitted due to performance ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: A zero value in the UDP checksum field indicates that the sender has deliberately omitted the checksum calculation. This signals that error detection is not required, allowing the packet to be processed more quickly, though any corrupted bits will go unnoticed by the receiver.

Q3. Given a UDP packet with source port 53 and destination port 49152, which statement most likely describes the packet’s flow?

A.Server → Client (DNS response) ✅
B.Client → Server (DNS query)
C.Server → Server (replication)
D.Client → Client (peer‑to‑peer)
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Port 53 is the well‑known port for DNS services, typically used by a server to send responses. Port numbers above 49152 belong to the dynamic/private range used by client processes. Therefore a packet from source 53 to destination 49152 most likely represents a DNS reply from server to client.

Q4. Which statement correctly compares the header sizes of UDP and TCP?

A.Both have 8‑byte headers
B.UDP header is 20 bytes, TCP header is 8 bytes
C.TCP header is 20 bytes, UDP header is 8 bytes ✅
D.Both have variable‑length headers
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: TCP’s header is at least 20 bytes because it includes fields for sequence numbers, acknowledgments, flags, and options, whereas UDP’s header is a fixed 8 bytes containing only source/destination ports, length, and checksum. Consequently, UDP incurs less per‑packet overhead, which is advantageous for small or time‑critical messages.

Q5. Why is UDP generally preferred for DNS queries despite being unreliable?

A.DNS messages are always under 512 bytes, fitting in one UDP datagram ✅
B.DNS requires ordered delivery
C.TCP cannot carry DNS data
D.UDP provides built‑in authentication
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Traditional DNS queries fit within a single UDP datagram, as the protocol limits messages to 512 bytes without EDNS0 extensions. Using UDP avoids the three‑way handshake of TCP, reducing latency. Although UDP is unreliable, the small size and low error probability make it suitable for most DNS transactions.

Q6. A video streaming service must deliver high‑definition frames with minimal latency. Which transport choice best balances reliability and latency, and why?

A.TCP, because its retransmission ensures all frames arrive
B.UDP, because its lack of retransmission avoids delay
C.TCP with selective acknowledgments, to reduce latency
D.UDP with application‑level error correction, to compensate for loss ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: High‑definition video demands low latency, so retransmitting lost packets via TCP would cause playback stalls. Using UDP eliminates retransmission delays, but raw loss can degrade quality. By adding application‑level error‑correction codes, the receiver can recover from occasional packet loss, achieving a balance between timeliness and reliability.

Q7. If a process binds to port 161 on a host, which protocol is it most likely implementing, and what type of messages does it handle?

A.NTP, handling time synchronization
B.SNMP‑server, handling management information ✅
C.HTTP, handling web requests
D.DHCP, handling address allocation
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Port 161 is assigned to the SNMP agent (server) that listens for management requests. An SNMP‑server process receives GET, SET, and TRAP messages to monitor or configure network devices. Therefore a process bound to port 161 is most likely implementing the Simple Network Management Protocol server functionality.

Q8. A sender transmits three UDP datagrams of 100 bytes each with checksums calculated. The second datagram’s checksum is corrupted in transit. What will the receiver most likely do?

A.Accept all three datagrams, ignoring checksum errors
B.Request retransmission of the corrupted datagram via UDP
C.Discard only the corrupted datagram and deliver the other two to the application ✅
D.Terminate the session
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: UDP checksums are verified by the receiver; if a checksum fails, the datagram is considered corrupted. The standard UDP behavior is to silently discard the erroneous packet while delivering the correctly received ones to the application. No retransmission or session termination occurs because UDP provides no reliability mechanisms.

Q9. How many bytes are fixed in the UDP header?

A.4
B.8 ✅
C.12
D.16
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The UDP header consists of four 16‑bit fields: source port, destination port, length, and checksum. Each field occupies 2 bytes, giving a total fixed size of 4×2=84 \times 2 = 8 bytes. This minimal header contributes to UDP’s low overhead compared with other transport protocols.

🔗 Related Topics (MCQs)