CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 4 · Transport Layer (TCP)

Checkpoint CP4 · Item 75 of 90

Transport Layer (TCP)

Read at your own pace. Try the questions before opening the answers.

On this page

Introduction

15 GATE-pattern questions (1-mark and 2-mark; MCQ, MSQ, and NAT) covering all of Phase 4: Transport-layer multiplexing & ports, UDP checksum, Stop-and-Wait, Go-Back-N, Selective Repeat, TCP header & MSS, 3-way handshake & state machine, flow control & wrap-around time, Jacobson’s RTO & Karn’s rule, Tahoe vs Reno congestion control, and the Socket API.

Practice questions

  1. MCQ · 1 mark

    Two different client hosts, C1 (IP 10.0.0.1) and C2 (IP 10.0.0.2), both happen to pick the exact same ephemeral source port 52000 when connecting via TCP to the same web server S (IP 192.168.1.10, port 80). How does the server’s operating system handle these two connections?

    1. It rejects the second connection with a RST because source port 52000 is already in use.
    2. It demultiplexes both connections cleanly into two separate connected sockets because their 4-tuples differ in the Source IP field.
    3. It merges both streams into a single socket descriptor.
    4. It forces C2 to renegotiate its port number using an ICMP Redirect.
  2. NAT · 2 marks

    Compute the 4-bit 1’s-complement UDP-style checksum (in decimal, 0 to 15) over the three 4-bit words: 1001 (9), 0110 (6), and 0100 (4).

    Write your answer before opening the key.

  3. NAT · 2 marks

    A 100 Mbps point-to-point satellite link has a one-way propagation delay of 120 ms and transmits frames of size 15,000 bytes (120,000 bits). Neglecting ACK size and processing time, what is the minimum sender window size N (in frames) required to achieve at least 80% link utilization?

    Write your answer before opening the key.

  4. NAT · 2 marks

    A sliding-window protocol uses a k = 5-bit sequence number field in the frame header. What is the difference between the maximum allowed sender window size in Go-Back-N (GBN) and the maximum allowed sender window size in Selective Repeat (SR)?

    Write your answer before opening the key.

  5. NAT · 2 marks

    Sender A transmits 9 frames (numbered 1 to 9) to Receiver B using Go-Back-N with sender window size N = 3. Suppose every 5th transmitted frame on the channel is lost (i.e., the 5th, 10th, 15th, ... transmissions are lost). How many total frame transmissions are required until all 9 frames are successfully accepted by B?

    Write your answer before opening the key.

  6. NAT · 1 mark

    A path between two hosts has an IPv4 path MTU of 1,500 bytes. Both the IPv4 header and the TCP header contain 12 bytes of options each (in addition to their 20-byte base headers). What is the Maximum Segment Size (MSS) — the maximum number of application data bytes that can fit in a single unfragmented TCP segment?

    Write your answer before opening the key.

  7. NAT · 2 marks

    Client C initiates a TCP connection to Server S with SYN (Seq = 400). Server S replies with SYN-ACK (Seq = 900, Ack = 401). Client C completes the handshake with an ACK segment that carries NO data, and then immediately sends a data segment carrying 600 bytes of application data, which arrives cleanly at S. What Acknowledgment Number does S place in its ACK for that 600-byte data segment?

    Write your answer before opening the key.

  8. MCQ · 1 mark

    In an active TCP connection, Host A calls shutdown(sock, SHUT_WR) (or closes its write half), causing its TCP stack to send a FIN segment to Host B, which Host B acknowledges with an ACK (before B has finished sending its own data). Which of the following is TRUE during this interval?

    1. The connection is in a TCP half-close state: Host A lies in FIN-WAIT-2, Host B lies in CLOSE-WAIT, and Host B can continue sending data segments to Host A.
    2. Both directions of the connection are immediately closed and any data from B triggers a RST.
    3. Host A enters TIME-WAIT immediately upon receiving B’s ACK of A’s FIN.
    4. A’s FIN segment consumes 0 sequence numbers.
  9. NAT · 2 marks

    A high-speed TCP connection transfers data continuously at 8 Gbps (8 × 10⁹ bits/sec). Calculate the time in seconds (rounded to 2 decimal places) required for the 32-bit TCP sequence number to wrap around.

    Write your answer before opening the key.

  10. NAT · 2 marks

    During the TCP 3-way handshake, a receiver advertises a Window Scale shift factor of S = 4. During data transfer over a link with RTT = 20 ms, the receiver sends an ACK with the 16-bit Window Size field set to 15,000. Assuming no congestion limit (cwnd = ∞), what is the maximum throughput in Mbps permitted by the receiver’s flow-control window?

    Write your answer before opening the key.

  11. NAT · 2 marks

    A TCP connection currently has EstimatedRTT = 80 ms and DevRTT = 12 ms. The next un-retransmitted segment produces SampleRTT = 160 ms. Using α = 0.125 and β = 0.25 (RFC 6298 order: updating DevRTT using old EstimatedRTT = 80 ms), what is the updated Retransmission Timeout (RTO) in ms?

    Write your answer before opening the key.

  12. NAT · 2 marks

    A TCP Reno sender has MSS = 2 KB, initial cwnd = 2 KB (1 MSS) at RTT 1, and initial ssthresh = 16 KB (8 MSS). At the end of RTT 5, the sender receives 3 duplicate ACKs. At the end of RTT 7, a Retransmission Timeout (RTO) occurs. What is the value of cwnd (in KB) during RTT 9?

    Write your answer before opening the key.

  13. NAT · 2 marks

    A TCP connection with MSS = 1 KB starts at RTT 1 with cwnd = 1 KB and ssthresh = 6 KB. How many total kilobytes (KB) of data are transmitted across the first 5 RTT rounds (RTT 1 through RTT 5 inclusive), assuming no packet losses?

    Write your answer before opening the key.

  14. MCQ · 1 mark

    Which of the following statements accurately describes the behavior of the listen() and accept() system calls on a TCP server?

    1. listen() blocks until a client sends a SYN segment; accept() does not block.
    2. listen() is non-blocking and configures kernel queues for incoming connections; accept() blocks until a client completes a 3-way handshake and returns a brand-new connected socket descriptor.
    3. Both listen() and accept() return brand-new socket descriptors.
    4. A UDP server must call listen() but does not call accept().
  15. MSQ · 2 marks

    Which of the following statements about Transport Layer protocols and TCP are ALWAYS TRUE?

    1. In Selective Repeat ARQ with k-bit sequence numbers, the sender and receiver window sizes must satisfy W_s + W_r ≤ 2^k (so W ≤ 2^(k−1) for equal windows).
    2. In TCP, the effective sending window of unacknowledged bytes in flight is bounded by min(cwnd, rwnd).
    3. When a Retransmission Timeout (RTO) expires, TCP Reno sets cwnd = ssthresh instead of resetting cwnd to 1 MSS.
    4. In TCP Slow Start, every individual ACK for new data increases cwnd by 1 MSS, causing cwnd to double every RTT until ssthresh is reached.

Answer key

Try the questions first. Open when you are ready to check.
  1. B — TCP demultiplexing uses the full 4-tuple (SrcIP, SrcPort, DstIP, DstPort). Since SrcIP differs (10.0.0.1 vs 10.0.0.2), the two 4-tuples are distinct.
    • A: Port uniqueness is per-IP; different client IPs can freely use the same ephemeral port.
    • C: Each 4-tuple gets its own socket descriptor from accept().
    • D: ICMP Redirect is for Layer-3 routing, not TCP ports.

    Review lesson 4.1

  2. 11 — Sum = 9 + 6 + 4 = 19 = 10011₂. Wrap carry bit into low 4 bits: 0011₂ (3) + 1 = 0100₂ (4). Take 1’s complement (flip all 4 bits): ~0100₂ = 1011₂ = 11.

    Review lesson 4.1

  3. 161 — T_t = 120,000 / 10⁸ = 1.2 ms. T_p = 120 ms, so a = T_p / T_t = 120 / 1.2 = 100. For η ≥ 0.80: N ≥ 0.80 × (1 + 2a) = 0.80 × 201 = 160.8 → N = 161 frames.

    Review lesson 4.2.2

  4. 15 — For k = 5 bits: N_max(GBN) = 2⁵ − 1 = 31, whereas N_max(SR) = 2⁵⁻¹ = 16. Difference = 31 − 16 = 15 frames.

    Review lesson 4.2.4

  5. 16 — Tx 1..4 deliver frames 1..4. Tx 5 (frame 5) is lost and Tx 6,7 (frames 6,7) are discarded (total +3). Tx 8,9 deliver frames 5,6. Tx 10 (frame 7) is lost and Tx 11,12 (frames 8,9) are discarded (+3). Tx 13,14 deliver frames 7,8. Tx 15 (frame 9) is lost (+1, no frames after 9), and Tx 16 finally delivers frame 9! Total = 16 transmissions.

    Review lesson 4.2.3

  6. 1436 — IPv4 header = 20 + 12 = 32 bytes. TCP header = 20 + 12 = 32 bytes. MSS = MTU − IP_hdr − TCP_hdr = 1500 − 32 − 32 = 1,436 bytes.

    Review lesson 4.3.1

  7. 1001 — C’s SYN consumed byte 400. The pure ACK consumed 0 bytes. The 600-byte data segment occupies bytes 401..1000 inclusive. Therefore S acknowledges with next expected byte Ack = 1001.

    Review lesson 4.3.2

  8. A — After B ACKs A’s FIN (step 2 of the 4-way handshake), A enters FIN-WAIT-2 and B enters CLOSE-WAIT (half-close). B can still send data to A until B closes its side and sends its own FIN.
    • B: TCP supports half-close; B→A remains open until B sends FIN.
    • C: A only enters TIME-WAIT after receiving and ACKing B’s FIN.
    • D: FIN always consumes 1 sequence number.

    Review lesson 4.3.2

  9. 4.28..4.31 — T_wrap = (2³² × 8 bits) / (8 × 10⁹ bits/s) = 2³² / 10⁹ ≈ 4.29 seconds.

    Review lesson 4.3.3

  10. 96 — True rwnd = 15,000 × 2⁴ = 15,000 × 16 = 240,000 bytes = 1,920,000 bits. Over RTT = 0.020 s, max throughput = 1,920,000 / 0.020 = 96 × 10⁶ bps = 96 Mbps.

    Review lesson 4.3.3

  11. 206 — Est_new = 80 + (160 − 80)/8 = 90 ms. Dev_new = 0.75(12) + 0.25|160 − 80| = 9 + 20 = 29 ms. RTO = 90 + 4(29) = 90 + 116 = 206 ms.

    Review lesson 4.3.4

  12. 4 — Trace in MSS (1 MSS = 2 KB): RTT 1..4 (SS): 1, 2, 4, 8 MSS. RTT 5 (CA): 9 MSS → 3 dup ACKs! New ssthresh = ⌊9/2⌋ = 4 MSS, so RTT 6 has cwnd = 4 MSS (CA). RTT 7 (CA): cwnd = 5 MSS → Timeout! New ssthresh = ⌊5/2⌋ = 2 MSS, and RTT 8 resets cwnd = 1 MSS (SS). RTT 9 doubles to cwnd = 2 MSS = 4 KB!

    Review lesson 4.3.5

  13. 20 — cwnd in RTTs 1 to 5: RTT 1 = 1 KB, RTT 2 = 2 KB, RTT 3 = 4 KB, RTT 4 = min(8, 6) = 6 KB (clamped at ssthresh), RTT 5 = 6 + 1 = 7 KB (CA). Total data sent across rounds 1..5 = 1 + 2 + 4 + 6 + 7 = 20 KB.

    Review lesson 4.3.5

  14. B — listen() simply transitions the bound socket to the LISTEN state and returns immediately; accept() blocks until a 3-way handshake finishes and returns a new connected descriptor.
    • A: listen() never blocks; accept() is the blocking call.
    • C: listen() returns 0 on success, not a new descriptor.
    • D: UDP servers call neither listen() nor accept().

    Review lesson 4.4

  15. ABD — A, B, and D are fundamental laws of transport protocols. C is false: on a Timeout (RTO), BOTH TCP Tahoe and TCP Reno reset cwnd = 1 MSS (only on 3 duplicate ACKs does Reno set cwnd = ssthresh).
    • C: On a Timeout, even TCP Reno resets cwnd to 1 MSS and enters Slow Start.

    Review lesson 4.3.5

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.