🎓 BookMCQ
← Back to 24. Transport Layer Protocols

📝 TCP features in transport layer protocol (14 MCQs)

Full-Duplex Connection-Oriented Stream Service

TCP provides a connection-oriented, full-duplex, point-to-point byte stream at the transport layer. Each connection is identified by source and destination IP addresses and port numbers. TCP supports multiplexed application sessions, reliable delivery, sequencing, error detection, receiver flow control, and network congestion control, while IP remains responsible for forwarding segments between hosts. It defines the boundary between application processes and packet delivery.

Combining Application Semantics with Network Constraints

Applications need communication that can recover from packet loss and reordering, while receivers have finite buffers and networks have finite capacity. TCP combines end-to-end reliability with separate controls for receiver capacity and network congestion. Its stream abstraction also removes the need for applications to manage IP packet boundaries during ordinary data transfer.

Connection State and Sending Controls

A TCP endpoint tracks sequence and acknowledgment numbers, connection state, retransmission timers, and negotiated options. It sends only within limits imposed by the receiver's advertised window and its congestion window. Checksums detect corruption, while acknowledgments and retransmissions provide recovery. The operating system maps the connection's address-and-port tuple to a socket.

Full-Duplex Exchange Between Two Hosts

Host A opens TCP connection to host B using source port 51000 and destination port 443. After setup, both endpoints can send data independently in each direction, each maintaining its own sequence space and receive window. The same connection carries an ordered stream in each direction rather than one-way datagrams.

Capabilities and Performance Trade-Offs

TCP's reliability and flow regulation suit transactions, remote shells, and files, but connection state and head-of-line blocking can affect latency. Congestion control helps share capacity fairly, while receive-window flow control protects memory. TCP does not encrypt payloads by itself; protocols such as TLS add confidentiality and peer authentication above it.

Avoiding Confusion Between TCP Capabilities

'Flow control and congestion control are the same' is false: one protects the receiver and the other the network. 'TCP is encrypted by default' is false: encryption requires a higher-layer protocol such as TLS. 'TCP sends one segment per application write' is false: buffering and segmentation determine actual segment boundaries.

Exam Focus: Separate Reliability, Flow and Congestion

Classify TCP features into connection management, reliable delivery, byte sequencing, receiver flow control, and congestion control. Explain full-duplex operation and the four values identifying a connection. Compare TCP with UDP, and identify why TLS is needed when confidentiality and authentication are required. Use the assumptions stated in each question when calculating.

Key Terms for TCP Features in the Transport Layer Protocol

  • Full duplex - Both endpoints send independently.
  • Four-tuple - Source and destination address-port values.
  • Flow control - Protects the receiver buffer.
  • Congestion control - Regulates load on the network path.
  • Head-of-line blocking - Later bytes wait behind a gap.
  • TLS - Adds cryptographic protection above TCP.
4
Easy
7
Medium
3
Hard

📝 All TCP features in transport layer protocol MCQs

Q1. If a client sends a TCP segment to destination port 80 but the server is listening on port 8080, what is the most likely outcome?

A.A: The connection is established immediately
B.B: The server sends a reset (RST) packet
C.C: The client receives no response and eventually times out ✅
D.D: Data is delivered but arrives out of order
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: When the server does not have a socket bound to port 80, the SYN packet is not accepted. The server’s TCP stack typically discards the packet or replies with an RST, but many firewalls simply drop it. Consequently the client waits for retransmissions until its timeout expires, yielding no connection.

Q2. A client behind NAT selects a dynamic source port 50000. The server replies using the same source port number as destination. Why does this allow the NAT device to forward the packet correctly?

A.A: NAT matches packets based only on IP addresses
B.B: NAT maintains a port‑mapping table that associates the internal port with the external port ✅
C.C: NAT ignores port numbers entirely
D.D: NAT requires the use of well‑known ports for return traffic
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: NAT devices create a temporary translation entry when the outbound SYN is sent, recording the internal IP : 50000 and the external IP : assigned port. When the server replies, the packet’s destination port matches the external port recorded in the table, enabling the NAT to translate it back to the internal address and port.

Q3. If a server process binds to a well‑known port 53 but also opens a second socket on a dynamic port for the same client, what inference can be made about the server's design?

A.A: It uses UDP exclusively
B.B: It implements multiplexing to handle multiple client sessions ✅
C.C: It cannot handle more than one client at a time
D.D: It violates the TCP specification
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Opening an additional dynamic socket for each client indicates that the server separates control traffic (on the well‑known port) from data traffic (on a per‑client dynamic port). This design, known as multiplexing, allows concurrent handling of many clients while preserving a single well‑known entry point for service discovery.

Q4. Suppose an application mistakenly uses a registered port range (e.g., 5000) for a well‑known service, while another application uses the official well‑known port for a different service. What network‑level conflict arises, and how does TCP resolve it?

A.A: Duplicate IP addresses cause routing loops
B.B: A port collision leads to ambiguous demultiplexing, and TCP drops the connection with a reset ✅
C.C: The conflict increases latency but does not affect correctness
D.D: No conflict occurs because ports are independent of services
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When two distinct services compete for the same port number, a receiving host cannot unambiguously map incoming segments to the correct process. TCP resolves this by sending a reset (RST) for packets that cannot be matched to an existing socket, effectively rejecting the ambiguous connection attempt.

Q5. Compare the role of the destination port number in TCP with the destination IP address. Which statement best captures their relationship?

A.A: Both identify the same network entity
B.B: The IP address selects the host, while the port number selects the specific process on that host ✅
C.C: The port number selects the host, and the IP address selects the process
D.D: Neither is used for routing decisions
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The destination IP address determines which physical or virtual machine should receive the packet, directing it through the network layer. Once the packet reaches that machine, the destination port number tells the transport layer which application or process should handle the data, providing process‑level demultiplexing.

Q6. Evaluate the advantage of using well‑known ports (0‑1023) for standard services versus using dynamic ports for the same services. Which advantage is most significant?

A.A: Simplifies firewall rule creation and management ✅
B.B: Improves raw data throughput
C.C: Reduces consumption of IP address space
D.D: Eliminates the need for DNS name resolution
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Well‑known ports are universally recognized, allowing administrators to create concise firewall policies that permit or deny traffic based on a small, predictable set of port numbers. This predictability reduces configuration errors and eases auditing, which is a more impactful benefit than any marginal performance or address‑space considerations.

Q7. Differentiate between a socket address and a port number alone. Which of the following statements is accurate?

A.A: A socket address includes only the port number
B.B: A socket address combines an IP address with a port number ✅
C.C: A port number uniquely identifies a process across the entire Internet
D.D: A socket address is a layer‑3 concept independent of transport details
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: A socket address uniquely identifies an endpoint for a transport‑layer connection by pairing the host’s IP address with the specific port number used by the application. A port number by itself lacks host context, so it cannot distinguish between identical ports on different machines.

Q8. Analyze why TCP requires both client and server socket addresses to be known before establishing a connection, whereas UDP can send datagrams without a prior handshake. Which principle best explains this requirement?

A.A: TCP’s reliable byte‑stream needs end‑to‑end acknowledgment and sequencing, which depend on knowing both endpoints ✅
B.B: UDP is inherently connection‑oriented, requiring no socket addresses
C.C: TCP does not use ports, so addresses are irrelevant
D.D: UDP uses a three‑way handshake similar to TCP
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: TCP guarantees reliable, ordered delivery, which necessitates establishing state at both ends. Knowing both socket addresses enables the exchange of SYN, SYN‑ACK, and ACK packets that negotiate sequence numbers, window sizes, and other parameters essential for dependable communication. UDP lacks these guarantees and therefore can transmit without such a handshake.

Q9. Apply the concept of socket addressing: If a client at 192.168.1.10:34567 contacts a server at 203.0.113.5:80, what is the complete set of four values needed to uniquely identify the TCP connection?

A.A: Only the client IP address and the server IP address
B.B: Only the client port number and the server port number
C.C: The client IP address, client port number, server IP address, and server port number ✅
D.D: Only the server IP address and server port number
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A TCP connection is uniquely defined by the tuple (client IP, client port, server IP, server port). This four‑element combination distinguishes one connection from all others, even if multiple connections share the same client or server address individually.

Q10. Explain how the three‑way handshake utilizes socket addresses to establish a TCP connection. Which step correctly pairs the socket addresses?

A.A: The SYN packet contains only the client IP address
B.B: The SYN‑ACK packet contains the server IP address and port number
C.C: The final ACK packet contains both client and server ports
D.D: All three steps include both IP addresses and port numbers of the communicating endpoints ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: During the SYN, the client sends its own IP and chosen source port together with the server’s IP and destination port. The server replies with a SYN‑ACK that mirrors both addresses and ports, confirming receipt. Finally, the client’s ACK again carries the full socket pair, ensuring both sides have a consistent view of the connection endpoints.

Q11. Synthesize a scenario where a server uses both a well‑known port and a dynamic port for a single client session. What is the most likely purpose of the dynamic port?

A.A: To serve as a backup for the well‑known port
B.B: To carry the actual data while the well‑known port handles control signalling ✅
C.C: To intentionally confuse potential attackers
D.D: To permanently replace the well‑known port for the service
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Many protocols (e.g., FTP) employ a control channel on a well‑known port and open a separate dynamic data channel for each client. The dynamic port isolates the bulk data transfer, allowing the well‑known port to remain free for command exchange and reducing interference between control and data streams.

Q12. Given the socket address definition \\\text{socket address}= (\\text{IP address}, \\text{port number})\, derive how NAT translation modifies the client’s socket address and discuss the impact on end‑to‑end reliability guarantees of TCP.

A.A: NAT only changes the IP address, breaking TCP’s reliability
B.B: NAT changes both the external IP and port, but TCP’s sequence numbers and acknowledgments preserve reliability across the translation ✅
C.C: NAT does not alter the socket address at all
D.D: NAT replaces the client’s port with a well‑known range, violating TCP’s specifications
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When a packet traverses NAT, the device substitutes the client’s private IP with its public IP and typically assigns a new, unique external port. TCP’s reliability mechanisms—sequence numbers, checksums, and acknowledgments—operate on the payload and are indifferent to the address translation, ensuring the connection remains reliable despite the intermediate modification.

Q13. What is the range of well‑known ports defined by IANA?

A.A: 0‑1023 ✅
B.B: 1024‑49151
C.C: 49152‑65535
D.D: 1024‑65535
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: IANA designates the well‑known port range as 0 through 1023. These ports are reserved for core services such as HTTP (80), FTP (21), and DNS (53), and they are typically bound by privileged processes on a host.

Q14. Define a socket address in the context of TCP.

A.A: Only the IP address of the host
B.B: Only the port number used by the application
C.C: The combination of an IP address and a port number that uniquely identifies an endpoint ✅
D.D: The MAC address combined with a port number
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: A socket address pairs a host’s network layer identifier (its IP address) with a transport‑layer identifier (the port number). This tuple uniquely identifies one endpoint of a TCP connection, enabling the protocol to demultiplex incoming segments to the correct application process.

🔗 Related Topics (MCQs)