🎓 BookMCQ
← Back to 24. Transport Layer Protocols

📝 TCP services reliable delivery (21 MCQs)

Reliable Ordered Process-to-Process Service

TCP provides a reliable, full-duplex byte stream between application endpoints identified by IP addresses and ports. It detects corrupted segments with a checksum, numbers transmitted bytes, acknowledges contiguous data, and retransmits missing portions. The receiver presents bytes in order to the application, hiding packet loss, duplication, and network-layer reordering when recovery succeeds. It defines the boundary between application processes and packet delivery.

How Best-Effort IP Requires Transport Recovery

IP does not promise that packets arrive, arrive once, or arrive in sending order. A file or transaction application generally cannot accept silent gaps or duplicate bytes. TCP adds sequence tracking and acknowledgment feedback to convert packet-level delivery into a reliable stream, subject to connection failure and finite retry limits.

Acknowledgment and Retransmission Procedure

The sender numbers stream bytes and transmits segments. The receiver validates the checksum and acknowledges the next contiguous byte expected. If a segment is missing, acknowledgments may reveal a gap; the sender can retransmit after duplicate acknowledgments or a retransmission timeout. Received out-of-order bytes may be buffered until the missing range arrives.

Recovering a Missing Segment in a Byte Stream

Suppose a sender transmits bytes 1000–1999 and 2000–2999. The second segment arrives first, but bytes 1000–1999 are missing. The receiver may buffer the later bytes yet acknowledge 1000, the next contiguous byte expected. After retransmission fills the gap, cumulative acknowledgment can advance to 3000. This example makes the sequence and resulting decision explicit.

Delivery Guarantees and Their Boundaries

TCP is suitable for web pages, file transfers, and remote sessions requiring ordered bytes. Reliability costs headers, timers, acknowledgments, buffering, and possible waiting behind missing data. TCP does not guarantee a fixed delivery time, preserve individual application message boundaries, or make data durable at the remote application merely because a transport acknowledgment arrived.

Clarifying What an ACK Actually Confirms

'An ACK confirms an application processed the data' is false: it confirms TCP receipt of bytes. 'TCP retransmits every segment periodically' is false: retransmission is triggered by loss indications and timers. 'Reliable delivery means zero delay' is false: recovery improves completeness but may delay later bytes. These distinctions separate similar mechanisms that are often confused.

Exam Focus: Trace Cumulative Acknowledgments

Given segment sequence ranges, determine the next expected byte and the cumulative ACK value. Trace the result of loss, reordering, duplicate arrival, and retransmission. Distinguish TCP checksum detection from recovery, and explain why a transport acknowledgment proves receipt by the peer TCP stack rather than successful application processing. Use the assumptions stated in each question when calculating.

Key Terms for TCP Services and Reliable Delivery

  • Byte sequence - Numbers positions within a TCP stream.
  • Cumulative ACK - Identifies the next expected byte.
  • Checksum - Detects corruption in a segment.
  • Retransmission timeout - Triggers recovery after timeout.
  • Out-of-order data - Bytes received before an earlier range.
  • Reliable stream - Ordered data recovery.
7
Easy
7
Medium
7
Hard

📝 All TCP services reliable delivery MCQs

Q1. In the client‑server model, which layer is responsible for delivering data to the correct process on the destination host?

A.Network layer
B.Transport layer ✅
C.Application layer
D.Data link layer
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The transport layer adds a header containing the destination port number, which uniquely identifies the receiving process on the host. By examining this port, the transport protocol can demultiplex the incoming segment and hand it to the appropriate application, completing process‑to‑process communication.

Q2. If a TCP segment arrives at a host but the destination port number is not associated with any listening process, what is the most likely outcome?

A.Segment is forwarded to the network layer
B.Segment is discarded and a RST is sent ✅
C.Segment is stored in a buffer for later processing
D.Segment is delivered to the default process
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When no socket is bound to the received port, the TCP implementation follows the RFC specification and responds with a reset (RST) segment, informing the sender that the connection cannot be established. This prevents undefined behavior and frees resources promptly.

Q3. Consider two hosts where the network layer uses IPv4 addressing and the transport layer uses TCP. If the source host changes its IP address due to mobility while maintaining the same TCP connection, which mechanism must be employed to preserve the connection integrity?

A.NAT translation
B.TCP fast open
C.Mobile IP with care‑of address ✅
D.No mechanism; TCP cannot survive IP change
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Mobile IP introduces a care‑of address that can be advertised to the correspondent node, allowing the ongoing TCP connection to continue without tearing down. The transport layer maintains its sequence numbers while the network layer updates routing, ensuring continuity despite the IP change.

Q4. Compare the scope of addressing in the network layer versus the transport layer. Which statement best captures the difference?

A.Network layer addresses individual processes
B.Transport layer addresses whole hosts
C.Network layer addresses hosts while Transport layer addresses processes ✅
D.Both layers address only hosts
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The network layer (e.g., IP) uses host addresses to route packets across networks, but it does not distinguish between processes on a host. The transport layer (e.g., TCP) adds port numbers, enabling it to direct data to specific processes, thereby providing process‑level addressing.

Q5. Evaluate the impact of using a well‑known port (e.g., 80) versus an ephemeral port for a client application. Which of the following statements is most accurate?

A.Well‑known ports reduce security because they are predictable ✅
B.Ephemeral ports guarantee faster connection establishment
C.Well‑known ports allow the server to identify the client’s application
D.Ephemeral ports are reserved for server processes
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Well‑known ports are fixed and widely known, making them attractive targets for attackers who can scan for services. Although they simplify configuration, the predictability can be exploited, whereas ephemeral ports change per connection, reducing exposure to automated attacks.

Q6. A network administrator wants to differentiate between TCP and UDP traffic using only port numbers. Which analytical approach is valid, and why might it fail in modern networks?

A.Assume ports <1024 are TCP
B.Assume ports >1024 are UDP
C.Examine well‑known ports that are commonly assigned to TCP services ✅
D.Use the protocol field in the IP header
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Many well‑known ports (e.g., 53 for DNS) are historically associated with TCP, but contemporary services often use the same numbers for UDP as well. Relying solely on port assignments can misclassify traffic, especially when protocols share ports or dynamic services use traditionally TCP ports.

Q7. Apply the concept of multiplexing: How does TCP enable multiple simultaneous connections between the same pair of hosts?

A.By varying the IP addresses
B.By using distinct port number pairs ✅
C.By encrypting each connection differently
D.By changing the MAC addresses
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Each TCP connection is identified by a unique 4‑tuple: source IP, source port, destination IP, and destination port. By assigning different port numbers for each endpoint, the same two hosts can maintain many concurrent sessions without ambiguity.

Q8. Synthesize the role of the three‑way handshake in TCP. Which step ensures both sides agree on initial sequence numbers?

A.SYN
B.SYN‑ACK ✅
C.ACK
D.FIN
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: During the SYN‑ACK response, the server acknowledges the client's SYN and includes its own initial sequence number. This exchange confirms that both parties have received each other's sequence numbers, establishing synchronized state before data transmission begins.

Q9. When a TCP connection is closed gracefully, which sequence of FIN and ACK flags ensures that all pending data is transmitted before termination? Provide the correct order.

A.FIN‑ACK → ACK‑FIN → ACK
B.FIN → ACK → FIN → ACK ✅
C.ACK → FIN → FIN → ACK
D.FIN → FIN‑ACK → ACK → ACK
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The proper graceful shutdown follows a four‑step sequence: the first side sends FIN, the peer acknowledges with ACK, then the peer sends its own FIN, and finally the original side acknowledges with ACK. This ordering guarantees that any queued data is delivered before the channel is released.

Q10. Define what a port number is in the TCP/IP model.

A.Unique identifier for a host
B.Identifier for a process ✅
C.Identifier for a network interface
D.Identifier for a routing path
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A port number is a 16‑bit value used by transport‑layer protocols such as TCP and UDP to identify a specific process or application on a host, enabling the demultiplexing of incoming segments to the correct endpoint.

Q11. Which of the following is a well‑known TCP port for HTTP?

A.21
B.22
C.80 ✅
D.443
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Port 80 is officially assigned to HTTP traffic in the Internet Assigned Numbers Authority (IANA) registry. When a client connects to a web server without specifying a port, the TCP/IP stack defaults to this well‑known port for HTTP communication.

Q12. If a TCP segment is received with a destination port that matches a listening socket, what immediate action does the transport layer take?

A.Drop the segment
B.Queue it for later
C.Pass it to the application
D.Initiate a new connection ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: When a SYN segment arrives at a listening socket, the TCP layer initiates the connection establishment process, creating a new socket for the incoming connection while keeping the listening socket open for additional requests.

Q13. A server hosts both FTP (port 21) and SSH (port 22) services. If a client mistakenly connects to port 22 expecting FTP, what logical error leads to the failure?

A.Port number mismatch ✅
B.IP address mismatch
C.Protocol mismatch
D.Sequence number mismatch
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The client selected the wrong destination port; FTP expects communication on port 21, while port 22 is reserved for SSH. This mismatch prevents the FTP service from receiving the request, leading to an immediate failure.

Q14. Suppose a NAT device rewrites source port numbers for outgoing TCP connections. How can this affect the ability of a remote peer to correctly identify the original client process?

A.It preserves original process identity
B.It obscures process identity causing ambiguity ✅
C.It changes the destination IP
D.It modifies the TCP checksum only
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: NAT translation modifies the source port, breaking the direct mapping between the remote peer's view and the original client process. As a result, the peer cannot reliably infer which local process initiated the connection, potentially causing misrouting of responses.

Q15. Contrast the use of TCP's flow control window with UDP's lack of flow control. Which outcome best describes the difference under heavy network load?

A.TCP will drop packets
B.UDP will adjust rate
C.TCP will throttle transmission ✅
D.UDP will guarantee delivery
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: TCP monitors the receiver’s advertised window and reduces its sending rate when the window shrinks, preventing buffer overflow. UDP lacks such a mechanism, so it continues to send at the application rate, which can cause packet loss under congestion.

Q16. Evaluate why using a single well‑known port for multiple distinct services on the same host is generally discouraged. Which statement best explains the drawback?

A.It simplifies firewall rules
B.It causes port exhaustion
C.It creates ambiguity for demultiplexing ✅
D.It improves security
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When several services share one port, the transport layer cannot uniquely determine which application should receive incoming data, leading to ambiguous demultiplexing and potential protocol conflicts. Separate ports preserve clear boundaries between services.

Q17. A system implements TCP multiplexing by assigning each connection a unique 4‑tuple (source IP, source port, dest IP, dest port). If two connections share the same source and destination ports but differ in source IP, can they coexist? Justify.

A.No, because ports must be unique
B.Yes, because IP address differentiates
C.No, because TCP does not consider IP
D.Yes, because the 4‑tuple is unique ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: TCP identifies a connection by the full 4‑tuple, so differing source IP addresses make the tuples distinct even if ports match. This allows multiple connections to coexist without collision, provided the IP addresses are different.

Q18. Apply the principle of end‑to‑end reliability: Which TCP feature directly provides reliable data transfer?

A.Checksum
B.Sequence numbers
C.Sliding window
D.All of the above ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: TCP combines checksums for error detection, sequence numbers for ordering, and a sliding window for flow control. Together these mechanisms ensure that data arrives intact, in order, and without loss, fulfilling the end‑to‑end reliability promise.

Q19. Synthesize how TCP ports interact with DNS resolution when a client accesses a web page via a hostname. Which step correctly describes the process?

A.DNS returns IP address only
B.DNS also returns port number
C.The client uses the resolved IP with default port 80 ✅
D.DNS resolves both IP and port 443
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: When a hostname is resolved, DNS provides the IP address. The client then combines this address with the well‑known HTTP port (80) unless a different port is specified in the URL, allowing TCP to establish a connection to the correct service.

Q20. In a scenario where a TCP connection is hijacked, an attacker injects packets with forged source ports. Which TCP mechanism is designed to detect such an intrusion, and how does it function?

A.Checksums detect forged ports
B.Sequence number verification detects out‑of‑order packets ✅
C.ACK numbers confirm receipt
D.SYN cookies prevent spoofed SYNs
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: TCP tracks the expected sequence number for each side of a connection. If an injected packet contains a sequence number that falls outside the acceptable window, the receiver discards it, thereby detecting attempts to hijack or spoof the session.

Q21. When implementing a custom application protocol over TCP, a developer decides to embed message delimiters instead of relying on port numbers for message boundaries. How does this design choice affect the transport layer's responsibilities?

A.It offloads framing to application layer ✅
B.It requires TCP to change its segment size
C.It eliminates need for checksums
D.It forces use of UDP
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: By using delimiters, the application layer assumes responsibility for delineating messages, allowing TCP to focus on reliable byte‑stream delivery without needing to interpret message boundaries. This separation aligns with the layered network model and keeps transport duties unchanged.

🔗 Related Topics (MCQs)