IAE Academy

GATE 2025 CS1 Q.22: solution and answer

GATE 2025 · CS1Q.22 · 1 mark · MSQ

Consider the 3-way handshaking protocol for TCP connection establishment. Let the three packets exchanged during the connection establishment be denoted as P1, P2, and P3, in order. Which of the following option(s) is/are TRUE with respect to TCP header flags that are set in the packets?

  1. (A)

    P3: SYN = 1, ACK = 1

  2. (B)

    P2: SYN = 1, ACK = 1

  3. (C)

    P2: SYN = 0, ACK = 1

  4. (D)

    P1: SYN = 1

See the question in the paper

Answer and solution

ANSWER

Options (B) and (D) are true.

Official answer: B, DSource: Official answer key, GATE 2025 CS1 (IIT Roorkee)

  1. The three-way handshake uses three packets: P1 goes from client to server, P2 from server to client, and P3 from client to server.

  2. P1 is the connection request. Only SYN is set, so and . Option (D), "P1: SYN = 1", is true.

  3. P2 is the server's reply. It acknowledges the client's SYN and carries the server's own SYN, so and . Option (B) is true and option (C), "P2: SYN = 0, ACK = 1", is false.

  4. P3 is the client's final acknowledgement of the server's SYN. It carries no SYN, so and . Option (A), "P3: SYN = 1, ACK = 1", is false.

  5. The true statements are (B) and (D).

KEY IDEA

In the TCP three-way handshake the flags are SYN for the first packet, SYN+ACK for the second, and ACK alone for the third. Only the first packet has ACK = 0, and only the third has SYN = 0.

WATCH OUT FOR

Setting SYN again in the final packet P3 (option A). The client's last packet only acknowledges the server's SYN, so its SYN flag is 0. Another slip is reading P2 as a plain ACK (option C), when the server must also send its own SYN.

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

More TCP questions