IAE Academy

GATE 2024 CS1 Q.29: solution and answer

GATE 2024 · CS1Q.29 · 1 mark · MSQ

TCP client P successfully establishes a connection to TCP server Q. Let denote the sequence number in the SYN sent from P to Q. Let denote the acknowledgement number in the SYN ACK from Q to P. Which of the following statements is/are CORRECT?

  1. (A)

    The sequence number is chosen randomly by P

  2. (B)

    The sequence number is always 0 for a new connection

  3. (C)

    The acknowledgement number is equal to

  4. (D)

    The acknowledgement number is equal to

See the question in the paper

Answer and solution

ANSWER

The correct statements are (A) and (D). The client's ISN is chosen unpredictably, and the SYN-ACK acknowledgement number is .

Official answer: A, DSource: Official answer key, GATE 2024 CS1 (IISc Bengaluru)

  1. In the three-way handshake, the client P sends a SYN carrying its initial sequence number (ISN), .

  2. TCP does not start every connection at 0. It picks the ISN unpredictably, from a clock-driven or pseudo-random generator. This keeps delayed segments from an earlier connection from being mistaken for the new one, and it makes sequence-number guessing attacks harder. So (A) is true and (B) is false.

  3. The server Q replies with a SYN-ACK. A SYN occupies one sequence number, so Q acknowledges the next sequence number it expects from P: .

  4. So (C), , is false, and (D), , is true.

  5. Correct statements: (A) and (D).

KEY IDEA

A SYN segment consumes one sequence number. The acknowledgement number in the SYN-ACK is therefore the client's ISN plus 1. The ISN itself is chosen unpredictably, not fixed at 0.

WATCH OUT FOR

Thinking the ACK in the SYN-ACK echoes the client's sequence number (). It actually names the next number expected, which is , because the SYN uses up one sequence number. Another slip is assuming a new connection always starts at sequence number 0.

From the GATE 2024 CS1 paper. Every question of this paper · Download the full paper · All 12 TCP questions, with notes

More TCP questions