UDP and TCP

GATE CS previous year questions · 4 questions

GATE CS 2025 Set 1 | Question 22

MSQ · 1 mark

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?

Options for GATE CS 2025 Set 1 | Question 22

Explanation

Answer: (B), (D)

In the 3-way handshake the client opens with a SYN segment (P1: SYN = 1, ACK = 0). The server replies with SYN + ACK (P2: SYN = 1, ACK = 1), and the client finishes with a pure acknowledgement (P3: SYN = 0, ACK = 1).

  • (A) False: P3 has SYN = 0.
  • (B) True: P2 acknowledges the client’s SYN and carries the server’s own SYN.
  • (C) False: P2 must have SYN = 1.
  • (D) True: P1 is the connection request, so SYN = 1.

Answer: B, D

GATE CS 2025 Set 2 | Question 16

MCQ · 1 mark · −0.33

Consider the following statements:

(i) Address Resolution Protocol (ARP) provides a mapping from an IP address to the corresponding hardware (link-layer) address.

(ii) A single TCP segment from a sender S to a receiver R cannot carry both data from S to R and acknowledgement for a segment from R to S.

Which ONE of the following is CORRECT?

Options for GATE CS 2025 Set 2 | Question 16

Explanation

Answer: (B)

(i) is TRUE. A host that knows the IP address of a machine on its local network still needs that machine’s link-layer (MAC) address to build a frame. ARP broadcasts a request for that IP address and gets back the matching hardware address.

(ii) is FALSE. TCP is full duplex, and every segment header has an acknowledgement number field, so a segment carrying data from S to R can also acknowledge data received from R. This is called piggybacking, and it is the normal case when both sides are sending.

Answer: B

GATE CS 2024 Set 1 | Question 29

MSQ · 1 mark

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

Options for GATE CS 2024 Set 1 | Question 29

Explanation

Answer: (A), (D)

  • A: true. In the three-way handshake each side picks its initial sequence number (pseudo-)randomly. This stops stray segments of an old connection between the same ports from being accepted, and makes it hard for an attacker to guess the numbers and forge segments.
  • B: false. Starting every connection at 0 is exactly what the random choice avoids; packet analysers that show 0 are displaying relative numbers.
  • C and D: a SYN uses up one sequence number even though it carries no data. The acknowledgement number in the SYN ACK is the next sequence number Q expects from P, so \(N_{Q} = N_{P} + 1\). C is false and D is true.

Answer: A, D

GATE CS 2024 Set 2 | Question 54

NAT · 2 marks

Consider a TCP connection operating at a point of time with the congestion window of size 12 MSS (Maximum Segment Size), when a timeout occurs due to packet loss. Assuming that all the segments transmitted in the next two RTTs (Round Trip Time) are acknowledged correctly, the congestion window size (in MSS) during the third RTT will be _________

Explanation

Answer: 4

On a timeout, TCP sets the slow-start threshold to half the current window, \(12 / 2 = 6\) MSS, and restarts slow start from a window of 1 MSS. In slow start the window doubles every RTT while all segments are acknowledged:

  • first RTT after the timeout: 1 MSS;
  • second RTT: 2 MSS;
  • third RTT: 4 MSS.

The window is still below the threshold of 6, so slow start has not yet given way to linear growth. Continuing from 6 MSS would be the fast-recovery response to triple duplicate ACKs, not to a timeout.

Answer: 4