🎓 BookMCQ
← Back to 25. Introduction to Application Layer

📝 Iterative Communication Using UDP (13 MCQs)

One-Request-at-a-Time Datagram Service

Iterative UDP communication uses a single server process that handles one datagram request at a time. The server waits for a packet, processes its contents, sends a reply to the sender, and returns to the receive operation. UDP has no connection-establishment phase, so each request carries enough destination and application information for independent handling. Its single receive loop avoids allocating a dedicated connection for each client.

Datagram Sockets and Client Address Information

A UDP server creates a datagram socket and normally binds it to a known local port. A client sends a datagram to that address and port. The server's receive operation supplies the sender's address and port, allowing the reply to be directed back without maintaining a TCP-style connection state. The bound socket can therefore receive requests from many remote endpoints.

Receive, Process and Reply Loop

The server repeatedly calls a receive operation, validates the request, performs its task, and sends a response to the recorded sender endpoint. A client sends a request and waits for a reply, often with a timeout. The server loop then waits for another datagram, even when requests arrive from different clients.

A UDP Echo-Service Exchange

A client sends the text PING to a server at 192.0.2.20 port 7000. The server receives the datagram together with the client's source address and port, copies the payload into a reply, and sends it to that endpoint. The client receives PING as a separate datagram if delivery succeeds.

When Iterative UDP Is Suitable

The approach fits small request-response services where processing is brief and clients can tolerate or manage possible loss. It avoids per-client connection establishment and allows a single loop to serve many clients sequentially. If a request requires a slow operation, one client can delay every later request waiting in the receive queue.

UDP Iteration Misconceptions

'UDP servers call listen and accept' is incorrect because those calls belong to TCP connection handling. 'Each datagram belongs to a permanent session' is false because UDP is connectionless. 'A send operation proves the client received the reply' also fails: UDP provides no delivery acknowledgment or automatic retransmission. The application must decide whether an unanswered request should be repeated.

Tracing the Datagram Request-Response Cycle

For examinations, identify socket creation, server binding, client destination selection, receive-from, and send-to operations. Track both source and destination ports and explain how the server finds the reply address. Distinguish sequential request processing from reliable delivery, and state what timeout or retry logic a UDP client may need. Also distinguish the local port from the client's returned source port.

UDP Iterative Communication Terms

  • Datagram - Individually addressed unit of UDP data.
  • recvfrom - Receives data and reports the sender endpoint.
  • sendto - Sends data to a specified destination.
  • bind - Reserves a local socket address.
  • Timeout - Maximum wait before an operation is abandoned.
  • Iterative server - Processes requests sequentially in one service loop.
4
Easy
6
Medium
3
Hard

📝 All Iterative Communication Using UDP MCQs

Q1. If a client sends a UDP packet to a server expecting an iterative response, and the server does not send a reply, what is the most likely cause?

A.The packet was lost in the network ✅
B.The server is using TCP instead of UDP
C.The client timed out before sending
D.The server deliberately ignored the request
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Because UDP does not provide delivery guarantees, the most common reason a client receives no reply is that the packet was lost in transit or the server’s response never arrived. UDP lacks retransmission mechanisms, so unlike TCP the absence of a response usually indicates network loss rather than a protocol error.

Q2. Suppose a UDP‑based iterative protocol sends packets of size SS and the network MTU is MM. If S>MS > M, what effect does fragmentation have on the reliability of the iterative exchange?

A.Fragmentation guarantees delivery of each fragment
B.Fragments are reassembled only at the source
C.Loss of any fragment causes the whole packet to be discarded ✅
D.Fragmentation reduces latency
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When a UDP packet exceeds the network MTU, it is fragmented into smaller pieces. The receiver can only reassemble the packet if all fragments arrive; loss of any fragment causes the entire packet to be discarded. Therefore, fragmentation reduces reliability because a single lost fragment results in the loss of the whole message.

Q3. In an iterative UDP communication, a client retransmits after timeout TT. If the server processes each request in 0.8T0.8T, what inference can be drawn about duplicate processing?

A.The server will never see duplicate requests
B.The server may process some requests twice, leading to potential duplication ✅
C.The client’s timeout is too short to allow processing
D.UDP guarantees exactly‑once delivery
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: If the server finishes processing in 0.8 T, the client’s timeout T may expire before the response arrives, prompting a retransmission. The server could then handle the same request twice, leading to duplicate effects unless the operation is designed to be idempotent. Hence, duplicate processing is a realistic possibility.

Q4. A UDP iterative system uses sequence numbers modulo 256. After receiving packets with numbers 250, 251, 252, 0, 1, what logical deduction about wrap‑around handling is required?

A.Sequence numbers should be reset to zero manually
B.Packets 0 and 1 are out of order and should be discarded
C.The sender should increase the modulo base
D.The receiver must recognize that 0 and 1 follow 252 due to wrap‑around ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Sequence numbers modulo 256 wrap from 255 back to 0. Receiving 250, 251, 252 followed by 0 and 1 indicates that the sender has crossed the wrap‑around point. The receiver must treat 0 and 1 as the logical successors of 252, recognizing the modulo arithmetic to maintain correct ordering.

Q5. Compare UDP iterative communication with TCP's request‑response model in terms of connection state.

A.Both maintain persistent connections
B.UDP is connectionless, while TCP maintains a stateful connection ✅
C.TCP does not guarantee order, UDP does
D.UDP requires a three‑way handshake, TCP does not
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: UDP is a connectionless protocol; it does not maintain any persistent state between endpoints. TCP, by contrast, establishes a stateful connection through a three‑way handshake and retains connection information for the duration of the session. Thus, iterative communication over UDP lacks the connection state inherent to TCP’s request‑response model.

Q6. Evaluate the impact of using a fixed timeout versus an adaptive timeout in UDP iterative queries on network efficiency.

A.Adaptive timeouts reduce unnecessary retransmissions by matching network conditions ✅
B.Fixed timeouts always improve throughput
C.Adaptive timeouts increase packet size
D.Fixed timeouts eliminate the need for sequence numbers
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: An adaptive timeout measures round‑trip times and adjusts the waiting period, reducing unnecessary retransmissions when the network is fast and increasing patience when latency grows. A fixed timeout cannot respond to changing conditions, often causing premature retries or excessive waiting, which lowers overall network efficiency.

Q7. Differentiate between client‑side and server‑side flow control mechanisms in UDP iterative protocols.

A.Client‑side control limits outbound rate; server‑side control limits inbound rate
B.Only client‑side control exists in UDP
C.Server‑side control uses TCP windows
D.Client‑side control adjusts packet size while server‑side control adjusts timeout ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Client‑side flow control typically regulates how fast the client sends packets, possibly by adjusting send intervals or packet sizes. Server‑side control can influence the client by varying the timeout or acknowledgment strategy. Combining both allows the system to balance outbound and inbound traffic without relying on TCP’s built‑in windows.

Q8. Analyze how increasing the number of parallel iterative UDP queries influences packet loss probability given a Bernoulli loss model with loss probability pp.

A.Loss probability remains pp regardless of parallelism
B.Overall loss probability decreases linearly with more queries
C.Overall loss probability becomes 1−(1−p)n1-(1-p)^n where nn is the number of parallel queries ✅
D.Parallel queries eliminate loss
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: With a Bernoulli loss model, each packet is lost independently with probability pp. Sending nn parallel queries means the probability that at least one packet arrives is 1−(1−p)n1-(1-p)^n. Consequently, the overall loss probability for the group becomes 1−(1−p)n1-(1-p)^n, showing that parallelism reduces the chance that all packets are lost.

Q9. Apply the principle of idempotence to UDP iterative requests; which design ensures safe retries?

A.Include a random payload each time
B.Change the destination port on each retry
C.Send a different command on each attempt
D.Use the same request identifier and make the operation idempotent ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Idempotent operations produce the same result regardless of how many times they are executed. By assigning a unique request identifier and ensuring the server’s operation is idempotent, retries caused by UDP’s lack of acknowledgment become safe, as duplicate requests do not alter the system state.

Q10. Explain the relationship between packet size, checksum coverage, and error detection probability in UDP iterative communication.

A.Larger packets have lower checksum coverage
B.Checksum covers the entire packet, so larger packets increase detection probability of multi‑bit errors ✅
C.Checksum only covers header fields
D.Error detection is independent of packet size
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The UDP checksum is calculated over the entire packet, including header and payload. Larger packets provide more bits for the checksum to cover, which generally increases the probability of detecting multi‑bit errors. Therefore, as packet size grows, the checksum’s ability to uncover errors improves, assuming the same checksum algorithm.

Q11. Synthesize a strategy that combines sequence numbers and timestamps to mitigate out‑of‑order delivery in UDP iterative exchanges.

A.Attach both a monotonically increasing sequence number and the send timestamp; discard packets with older timestamps or lower sequence numbers ✅
B.Use only timestamps and ignore sequence numbers
C.Rely on the network to reorder packets automatically
D.Send packets twice for redundancy
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A combined approach attaches a monotonically increasing sequence number and a precise send timestamp to each packet. Upon receipt, the receiver discards any packet whose sequence number is lower than the highest seen or whose timestamp is older than the most recent valid packet, thereby filtering out‑of‑order deliveries.

Q12. Propose a method to achieve reliable ordered delivery in an otherwise unreliable UDP iterative protocol without resorting to TCP, and justify its feasibility.

A.Add a checksum and hope for the best
B.Use UDP multicast to increase redundancy
C.Implement a simple stop‑and‑wait ARQ with sequence numbers and acknowledgments ✅
D.Switch to TCP entirely
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Implementing a stop‑and‑wait ARQ scheme over UDP adds sequence numbers and acknowledgments, allowing the sender to retransmit only unacknowledged packets. This method provides reliable, ordered delivery while preserving UDP’s lightweight nature, making it feasible for applications that need reliability without the overhead of a full TCP stack.

Q13. What does UDP stand for?

A.Universal Data Protocol
B.User Datagram Process
C.User Datagram Protocol ✅
D.Unreliable Data Package
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: UDP stands for User Datagram Protocol, a core Internet protocol that provides a simple, connectionless service for sending datagrams without guaranteeing delivery, ordering, or duplicate protection. It is defined in RFC 768 and is widely used for applications such as DNS, streaming media, and online gaming where low latency is more important than guaranteed delivery.

🔗 Related Topics (MCQs)