🎓 BookMCQ
← Back to 24. Transport Layer Protocols

📝 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.
5
Easy
8
Medium
4
Hard

📝 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?

A.Automatic packet drop
B.Flow‑control feedback to the sender ✅
C.Increasing the receiver buffer size
D.No action is taken
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Demultiplexing
B.Multiplexing ✅
C.Encapsulation
D.Fragmentation
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Pulling allows the receiver to control the arrival rate, reducing the risk of buffer overflow. ✅
B.Pulling eliminates the need for any flow‑control mechanism.
C.Pulling guarantees lower latency for all packets.
D.Pulling requires less protocol overhead than pushing.
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.Demultiplexing is only needed when multiple packets arrive simultaneously.
B.The transport layer ignores the packet because there is no multiplexing.
C.Even a single packet must be examined for its destination port to deliver it to the correct process. ✅
D.Demultiplexing is replaced by routing at the network layer.
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.Packets 1 and 3 use the same destination port on the first server. ✅
B.Packets 1 and 3 use different source ports but the same destination port.
C.All three packets use identical source ports.
D.Packet 2 uses the same destination port as packets 1 and 3.
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.Pure pushing always yields higher throughput regardless of latency.
B.Hybrid push‑pull reduces throughput because of added signaling overhead.
C.Pure pushing avoids latency spikes by sending continuously.
D.Hybrid push‑pull adapts to latency changes, maintaining higher effective throughput. ✅
💡 Difficulty: hard | ✅ Correct: D

📖 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?

A.The sender transmits continuously while the receiver periodically discards excess data.
B.The receiver sends a ‘ready’ signal only after processing a batch, and the sender pauses when a ‘stop’ signal is received. ✅
C.Both sender and receiver ignore each other’s signals and operate independently.
D.The sender always waits for an explicit request before sending any data.
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.Inspecting the segment header to select the appropriate receiving process. ✅
B.Encrypting the payload before delivery.
C.Routing the packet to the next network hop.
D.Fragmenting the segment into smaller pieces.
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.All data will be delivered faster, improving integrity.
B.Some transmitted data may be lost or corrupted due to buffer overflow. ✅
C.The sender will automatically switch to a reliable protocol.
D.The network will increase its bandwidth to compensate.
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.Receiver stop → Sender continues → Receiver resume
B.Sender pushes → Receiver never acknowledges → Data loss
C.Receiver stop → Sender reduces rate → Receiver resume → Sender increases rate ✅
D.Sender pushes → Receiver resume → Sender stops
💡 Difficulty: hard | ✅ Correct: C

📖 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?

A.Both TCP and UDP cannot multiplex data; they rely on a single stream.
B.UDP provides built‑in multiplexing, while TCP does not.
C.Both protocols use port numbers to multiplex multiple application streams, but TCP adds connection‑state management. ✅
D.TCP multiplexes only for streaming media, whereas UDP multiplexes for all traffic.
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.The packet is discarded and an ICMP port‑unreachable message may be sent. ✅
B.The transport layer creates a new process automatically.
C.The packet is forwarded to the next hop unchanged.
D.The payload is stored for later processing.
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.Multiplexing combines multiple destination ports into one source port.
B.Demultiplexing merges several incoming streams into a single output.
C.Multiplexing encrypts data, while demultiplexing decrypts it.
D.Multiplexing assigns source ports to outgoing segments; demultiplexing uses destination ports to route incoming segments to the proper process. ✅
💡 Difficulty: easy | ✅ Correct: D

📖 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?

A.Packet 2 shares the same destination port as packet 1.
B.Packet 2 uses a different destination port than packets 1 and 3. ✅
C.All packets use the same source port.
D.Packet 2’s source port determines its destination port.
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.Assign the same logical channel to all traffic and rely on network scheduling.
B.Use random logical channel identifiers for each packet.
C.Map high‑priority traffic to a dedicated logical channel with stricter flow‑control parameters, while lower‑priority traffic uses a separate channel with looser constraints. ✅
D.Disable flow control for high‑priority traffic to maximize speed.
💡 Difficulty: hard | ✅ Correct: C

📖 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?

A.The producer continues sending regardless of the consumer’s state.
B.Items may be lost because the producer does not know the consumer is ready.
C.The network becomes congested due to unnecessary traffic.
D.Data transmission occurs only when the consumer is prepared, preventing overflow. ✅
💡 Difficulty: easy | ✅ Correct: D

📖 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?

A.It enables the transport layer to distinguish more concurrent flows, enhancing multiplexing. ✅
B.It removes the need for port numbers entirely.
C.It forces the transport layer to use only one logical channel.
D.It causes the transport layer to ignore payload size.
💡 Difficulty: easy | ✅ Correct: A

📖 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.

🔗 Related Topics (MCQs)