📝 TCP segment structure (17 MCQs)
Header and Payload of a TCP Segment
A TCP segment contains a header followed by application data and operates at OSI Layer 4. The minimum header is 20 bytes and the maximum is 60 bytes when options are present. Fields identify ports, sequence and acknowledgment positions, header length, flags, window, checksum, and urgent pointer, enabling connection management, reliable delivery, and receiver flow control. It defines the boundary between application processes and packet delivery.
Why TCP Needs More Control Fields Than UDP
Reliable ordered stream delivery requires TCP to track byte positions, acknowledge progress, negotiate connection behaviour, and regulate outstanding data. UDP deliberately omits these controls. TCP's variable-length header permits optional features such as MSS, timestamps, and selective acknowledgments, but those options increase header overhead and reduce the space available for payload within a packet.
Reading the Fixed Header and Optional Fields
The first 20 bytes contain source and destination ports, 32-bit sequence and acknowledgment numbers, data offset, reserved bits, control flags, 16-bit window, checksum, and urgent pointer. The data offset gives header length in 32-bit words. Options follow the fixed fields, and padding aligns the header to a 32-bit boundary. The exact steps depend on the protocol's negotiated state.
Interpreting a Header with Options
If a TCP data offset is 7, the header length is 7 multiplied by 4, or 28 bytes. Since the fixed header is 20 bytes, eight bytes are occupied by options and padding. In a 1,500-byte IP MTU with a 20-byte IPv4 header, at most 1,452 bytes remain for TCP data in this simplified case.
Header Overhead and Field Interpretation
The variable header supports negotiation and improved recovery, while flags such as SYN, ACK, FIN, and RST control connection behaviour. A larger header reduces payload capacity at a fixed packet size. The checksum covers the TCP header, data, and pseudo-header; it detects corruption but does not authenticate the sender. Actual performance also depends on path conditions and implementation.
Correcting TCP Header Field Confusion
'The data offset is measured in bytes' is false: it counts 32-bit words. 'The TCP checksum covers only payload' is false: it covers header, data, and pseudo-header. 'The window field is the congestion window' is false: it advertises receiver capacity; cwnd is maintained by the sender. These distinctions separate similar mechanisms that are often confused.
Exam Focus: Header Lengths, Flags and Sequence Fields
Label the fixed TCP header and calculate header bytes from the data offset. Identify which flags participate in setup and teardown, and distinguish sequence numbers from acknowledgments. Calculate payload capacity from an MTU after subtracting IP and TCP headers, noting that options increase TCP header length. Use the assumptions stated in each question when calculating.
Key Terms for TCP Segment Structure
- Data offset - TCP header length in 32-bit words.
- Sequence number - Position of first data byte.
- Acknowledgment number - Next byte expected from peer.
- Window field - Advertised receiver capacity.
- Control flags - Bits governing TCP segment behaviour.
- Pseudo-header - IP values used for checksum.
📝 All TCP segment structure MCQs
Q1. If a producer pushes data faster than the consumer can process, what mechanism in the transport layer prevents data loss?
📖 Explanation: When the sender pushes data too quickly, the receiver can issue a flow‑control signal (such as a zero‑window advertisement) that tells the sender to pause transmission. This feedback prevents the receiver’s buffer from overflowing and avoids discarding data, ensuring reliable delivery despite the speed mismatch.
Q2. What term describes the transport layer function that combines multiple streams from different processes into a single outbound stream?
📖 Explanation: Multiplexing is the process by which the transport layer at the source gathers data from several application processes, adds appropriate headers, and sends the combined streams over a single network connection. This many‑to‑one operation enables efficient use of network resources and simplifies routing of outbound traffic.
Q3. Compare pushing and pulling delivery methods. Which statement correctly identifies a key advantage of pulling over pushing?
📖 Explanation: Pulling gives the receiver the ability to request data only when it has buffer space, preventing overflow and loss. By letting the consumer dictate the pacing, the system can maintain stable queues and avoid the need for complex back‑pressure mechanisms that are required in a pure push model.
Q4. Apply the concept of demultiplexing to a situation where only one packet arrives at a server. Which statement best explains why demultiplexing still occurs?
📖 Explanation: Even a solitary packet carries a destination port number in its transport‑layer header. The receiving transport layer must inspect this field to determine which application process should receive the payload. This inspection, i.e., demultiplexing, is required regardless of how many packets arrive, ensuring correct delivery.
Q5. In the client‑server example with three client processes and two servers, packets 1 and 3 share the same logical channel. What inference can be made about the port numbers used?
📖 Explanation: Since packets 1 and 3 travel over the same logical channel to the first server, they must be addressed to the same destination port on that server. The logical channel is identified by the destination port, allowing the server’s transport layer to direct each packet to the appropriate receiving process.
Q6. Evaluate the efficiency of a pure pushing strategy versus a hybrid push‑pull strategy under highly variable network latency. Which outcome is most likely?
📖 Explanation: A hybrid approach lets the sender pause when the receiver signals congestion and resume when the receiver is ready, adapting dynamically to latency fluctuations. This flexibility prevents wasteful retransmissions and buffer overflows, often resulting in higher usable throughput than a pure push model that cannot react to changing network conditions.
Q7. Synthesize a flow‑control mechanism that combines both push and pull signals. Which description matches such a hybrid approach?
📖 Explanation: In a hybrid scheme the receiver issues a ‘stop’ (or zero‑window) signal when its buffers fill, causing the sender to pause its push. Once the receiver processes enough data, it sends a ‘ready’ (or window‑open) signal, prompting the sender to resume transmission. This combines the immediacy of push with the safety of pull.
Q8. Demultiplexing at the destination transport layer primarily involves which operation?
📖 Explanation: The core of demultiplexing is examining the transport‑layer header—specifically the destination port—to determine which local application should receive the payload. By matching the port number to a registered socket, the transport layer can correctly deliver the data to the intended process, independent of any network‑layer routing or fragmentation actions.
Q9. If flow control fails and the consumer cannot keep up, what is the most probable effect on data integrity?
📖 Explanation: When the receiver’s buffers overflow because it cannot consume data quickly enough, incoming packets may be dropped or overwritten, leading to loss or corruption of the original data. Without proper flow‑control feedback, the sender continues transmitting, exacerbating the overflow and compromising the integrity of the transmitted information.
Q10. Consider a scenario where the sender pushes data, the receiver signals a stop, then later signals resume. Which sequence best represents the cause‑effect chain?
📖 Explanation: When the receiver issues a stop signal, the sender must reduce or halt its transmission rate. After the receiver processes enough data, it sends a resume (or window‑open) signal, prompting the sender to increase its rate again. This cause‑effect chain reflects proper back‑pressure handling in a flow‑controlled system.
Q11. Compare TCP and UDP regarding their ability to multiplex data from multiple applications. Which statement is accurate?
📖 Explanation: Both TCP and UDP employ port numbers to separate concurrent application flows, enabling multiplexing. TCP further maintains a connection state (sequence numbers, acknowledgments) that provides reliable, ordered delivery, whereas UDP remains connectionless. Thus, while both can multiplex, TCP offers additional reliability features that UDP lacks.
Q12. When a transport layer receives a packet on a port that has no associated process, what is the most likely immediate action?
📖 Explanation: If no socket is bound to the destination port, the transport layer cannot deliver the segment to an application. The usual response is to drop the packet and, optionally, generate an ICMP Destination Unreachable – Port Unreachable message to inform the sender of the problem.
Q13. At the source, the transport layer performs multiplexing. At the destination, it performs demultiplexing. Which statement correctly differentiates these roles?
📖 Explanation: Multiplexing at the sender tags each outbound segment with a source port that identifies the originating application. Upon receipt, demultiplexing examines the destination port in the incoming segment header to determine which local application (socket) should receive the payload, thereby separating the combined streams.
Q14. Given three client processes sending to two servers, if packet 2 uses a distinct logical channel, what can be deduced about its destination port relative to packets 1 and 3?
📖 Explanation: A distinct logical channel implies a different combination of source‑ and destination‑port values. Since packets 1 and 3 share a logical channel, they must have the same destination port on the first server. Packet 2, using a separate channel, therefore targets a different destination port on the second server.
Q15. Design a scenario where logical channels are used to provide Quality of Service (QoS) differentiation. Which approach best achieves this?
📖 Explanation: By allocating separate logical channels to different traffic classes, the transport layer can apply distinct flow‑control and buffering policies. High‑priority channels can enforce tighter windows and lower latency, while best‑effort channels tolerate larger queues. This separation enables the system to honor QoS requirements without interfering with lower‑priority flows.
Q16. What immediate consequence occurs when a consumer pulls items only after it signals readiness?
📖 Explanation: Pull‑based delivery ensures that the producer transmits data only after receiving an explicit request from the consumer. This coordination prevents the consumer’s buffers from being overrun, eliminating the risk of data loss or overflow and allowing the system to operate efficiently.
Q17. If a new protocol introduces a logical channel identifier in its segment header, how does this affect the transport layer’s multiplexing capability?
📖 Explanation: Adding a logical‑channel field gives the transport layer an extra dimension for identifying distinct flows beyond the traditional port numbers. This allows more concurrent sessions to be distinguished and managed simultaneously, improving the granularity and scalability of multiplexing within the transport layer.