🎓 BookMCQ
← Back to 25. Introduction to Application Layer

📝 Transport layer services for applications (12 MCQs)

Process-to-Process Delivery for Application Programs

The transport layer carries data between application processes running on different hosts. IP delivers packets between host interfaces, while transport protocols identify destination processes through port numbers. TCP offers a reliable ordered byte stream; UDP offers message-oriented datagrams with limited transport mechanisms. Applications select the service that matches their communication requirements. This process-level delivery is distinct from host-to-host IP forwarding.

Ports, Multiplexing and Transport Service Choices

A transport endpoint is commonly identified by an IP address and port number. Multiplexing lets one host support many application conversations, while demultiplexing directs received data to the appropriate socket. TCP and UDP use separate transport namespaces, so the same numeric port can identify different TCP and UDP services. A socket uses this endpoint information to receive the intended traffic.

Data Transfer from an Application to a Peer

An application writes bytes to a TCP socket or submits a datagram through a UDP socket. The transport layer adds its header, then passes the segment or datagram to IP. At the destination, the transport header is examined and the payload is delivered to the socket selected by the endpoint information.

Selecting TCP or UDP for a Service

A file-transfer client typically uses TCP because missing or reordered bytes must be handled by the transport. A simple DNS query may use UDP to avoid connection setup for a small request and reply. The application must still handle timeouts or retries where required, because UDP does not guarantee delivery or ordering.

Flow Control, Reliability and Application Needs

TCP includes sequencing, acknowledgment, retransmission, receiver flow control, and congestion control. UDP does not provide these mechanisms as transport guarantees, leaving any required recovery to the application. Both protocols use ports for process delivery, but their data models differ: TCP exposes a continuous byte stream and UDP preserves datagram boundaries.

Transport-Layer Service Misconceptions

'IP ports identify computers' is incorrect because IP addresses identify hosts or interfaces and ports identify transport endpoints. 'UDP guarantees packet delivery' is false because datagrams may be lost or reordered. 'TCP preserves application message boundaries' is also false because TCP presents an ordered byte stream rather than individual messages.

Comparing Transport Guarantees and Port Demultiplexing

Be able to compare TCP and UDP by connection behavior, reliability, ordering, data boundaries, and control mechanisms. Interpret source and destination ports, distinguish a segment from an IP packet, and trace how a receiving host selects a socket. Explain which transport features an application must implement itself when it chooses UDP.

Transport Service and Endpoint Terms

  • Port number - Identifies a transport-layer application endpoint.
  • Multiplexing - Combines data from multiple application processes.
  • Demultiplexing - Delivers received data to the correct socket.
  • TCP - Provides a reliable ordered byte stream.
  • UDP - Provides connectionless message-oriented datagrams.
  • Flow control - Limits sending to protect receiver capacity.
4
Easy
5
Medium
3
Hard

📝 All Transport layer services for applications MCQs

Q1. An application requires guaranteed, ordered delivery of data. Which transport‑layer protocol should it use?

A.TCP ✅
B.UDP
C.ICMP
D.IP
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: TCP implements reliability through acknowledgments, retransmission of lost segments, and sequencing numbers that preserve the original order. These features ensure that the receiving application gets exactly the data sent, without duplication or reordering, making TCP the appropriate choice for applications that cannot tolerate missing or out‑of‑order packets.

Q2. If a client disables Nagle’s algorithm on a TCP socket, what is the most likely immediate effect on the transmission of many small packets?

A.Increased latency due to larger packets
B.No change in latency
C.Packets are combined into larger segments
D.Reduced latency because packets are sent immediately ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Disabling Nagle’s algorithm removes the rule that forces the sender to wait for an ACK before transmitting a new small segment. Consequently, each tiny piece of data is placed on the wire as soon as it is generated, cutting the waiting time and reducing overall latency for interactive traffic.

Q3. A service uses UDP broadcast to discover peers on a local network. What can be inferred about the potential impact on overall network traffic?

A.It may cause excess traffic and collisions ✅
B.Broadcast traffic is ignored by routers
C.It reduces network load
D.It guarantees delivery
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: UDP broadcast sends a packet to every host on the subnet, which can generate a large number of duplicate frames when many devices respond. This additional traffic may increase collision probability on shared media and consume bandwidth, potentially degrading performance for other applications on the same network.

Q4. Which statement correctly contrasts TCP and UDP regarding connection orientation?

A.TCP is connectionless, UDP is connection‑oriented
B.Both are connectionless
C.TCP establishes a connection before data transfer, UDP does not ✅
D.UDP establishes a connection, TCP does not
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: TCP performs a three‑way handshake to create a reliable session before any user data is exchanged, guaranteeing order and delivery. In contrast, UDP sends datagrams without establishing any stateful connection, offering a lightweight, best‑effort service that lacks built‑in reliability.

Q5. For real‑time video streaming, which transport‑layer characteristic is most advantageous?

A.Guaranteed delivery
B.Heavy flow control
C.In‑order retransmission
D.Low‑latency best‑effort delivery ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Real‑time video tolerates occasional loss but cannot afford the delay introduced by retransmissions or strict flow control. A transport that delivers packets quickly without waiting for acknowledgments, such as UDP’s best‑effort service, provides the low latency required for smooth playback.

Q6. How does the use of port numbers enable multiplexing and demultiplexing of multiple application streams over a single IP address?

A.Ports distinguish separate sockets belonging to different processes ✅
B.Each port maps to a unique MAC address
C.Ports identify the destination host
D.Ports encrypt the payload
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Port numbers serve as identifiers for individual socket endpoints, allowing the operating system to direct incoming segments to the correct application process. By assigning distinct ports, many concurrent connections can share the same IP address, achieving multiplexing on the sender side and demultiplexing on the receiver side.

Q7. Which mechanism prevents a fast sender from overwhelming a slower receiver in TCP?

A.Congestion control
B.Checksum verification
C.Packet fragmentation
D.Flow control using the receive window ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: TCP’s flow‑control mechanism uses the receive window field to tell the sender how much buffer space is available at the receiver. The sender must limit its transmission to this advertised window size, ensuring that the receiver can process incoming data without being overrun.

Q8. What is the primary relationship between TCP congestion control and achievable throughput on a congested network?

A.Congestion control increases throughput by sending more packets
B.It has no effect on throughput
C.It reduces throughput to avoid packet loss ✅
D.It guarantees maximum throughput regardless of congestion
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When congestion is detected, TCP reduces its sending rate by lowering the congestion window, which directly limits the amount of data in flight. This intentional throttling sacrifices throughput to prevent packet loss and maintain network stability, especially on heavily loaded links.

Q9. An application sends control messages that must be reliable and large data streams that must be timely. Which combination of transport protocols best fits this design?

A.Use TCP for both control and data
B.Use UDP for both
C.Use TCP for control messages and UDP for large data streams ✅
D.Use UDP for control and TCP for data
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Control messages benefit from TCP’s reliability, ensuring they reach the destination intact and in order. Large data streams, such as media, prioritize low latency over perfect reliability; using UDP avoids retransmission delays, delivering data promptly even if occasional packets are lost.

Q10. In network programming, what is a socket?

A.An endpoint for sending or receiving data through a transport protocol ✅
B.A physical network cable
C.A type of router
D.A DNS record
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A socket abstracts the underlying transport protocol, providing a programming interface that represents one end of a communication channel. Applications bind sockets to local addresses and ports, then use them to send or receive data across the network, making sockets fundamental to client‑server interactions.

Q11. During TCP’s three‑way handshake, how are initial sequence numbers established?

A.Both sides use the same fixed number
B.Sequence numbers are negotiated after data transfer
C.ISN is derived from the IP address
D.Each side sends a random ISN in its SYN segment ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Each participant generates a random Initial Sequence Number (ISN) and includes it in its SYN segment. The peer acknowledges this number in the SYN‑ACK, and the original initiator acknowledges the peer’s ISN in the final ACK. This exchange ensures both sides start with independent, unpredictable sequence spaces.

Q12. Compared to TCP’s built‑in reliability, what is a drawback of implementing retransmission at the application layer instead?

A.It duplicates effort and may conflict with TCP’s mechanisms ✅
B.It reduces overall latency
C.It eliminates the need for checksums
D.It simplifies connection management
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Adding retransmission logic at the application level repeats work already performed by TCP, leading to unnecessary overhead and potential interference with TCP’s acknowledgment and timeout handling. This redundancy can cause inefficiencies, increased complexity, and possible protocol conflicts.

🔗 Related Topics (MCQs)