TCP Connection Management & Reliability MCQs: 12 Solved Questions with Explanations

Practise 12 TCP connection management MCQs and MSQs on handshakes, sequence numbers, TIME-WAIT, persist probes, sender windows, resets and SYN floods.

KnowledgeGate Team

Exam prep & CS education

Updated 18 Nov 20268 min read
TCP Connection Management & Reliability MCQs: 12 Solved Questions with Explanations

A TCP answer can turn on one state, flag or sequence rule. Active and passive open, graceful FIN and crash-triggered RST, and receiver and congestion windows must stay separate. Start with the Connection Management and Reliability practice set open for Questions 1, 9 and 12. Questions 2 and 8 also appear in TCP and UDP MCQs: 12 Solved Transport Layer Questions. That broader set connects them to ports, UDP and congestion control; their job here is to test active open and simultaneous close alongside handshake states, crash recovery, TIME-WAIT, persist probes and SYN flooding. Attempt each question before reading its answer.

TCP connection rules to write before solving

Rule

What to remember

Active open

The client calls connect() and sends SYN.

Passive open

The server follows LISTEN -> SYN_RCVD -> ESTABLISHED.

Three packets

Their flag sets are SYN, SYN+ACK, then ACK.

Sequence space

SYN and FIN each consume one position. A data-free ACK consumes none.

Sender window

Usable allowance is min(rwnd, cwnd).

Zero window

Persist probes prevent deadlock after a lost window update.

Abrupt reboot

A forgotten old connection can produce RST, not graceful FIN.

Let client P choose initial sequence number 4000. It sends P1: SYN=1, ACK=0, SEQ=4000. Server Q chooses 9000 and returns P2: SYN=1, ACK=1, SEQ=9000, ACK number=4001. P completes with P3: SYN=0, ACK=1, SEQ=4001, ACK number=9001. Each SYN consumes one position, so both acknowledgements add 1. The data-free final ACK consumes none. P follows CLOSED -> SYN_SENT -> ESTABLISHED; Q follows LISTEN -> SYN_RCVD -> ESTABLISHED. Keep these paths separate.

TCP three-way-handshake sequence chart shows Client P and Server Q exchanging SYN and ACK packets with sequence values 4000, 9000, 4001 and acknowledgments 4001 and 9001.

TCP MCQs 1-3: handshake purpose, active open and flags

Question 1

Code
In TCP/IP, what is the purpose of the three-way handshake ?
Code
A. Data encryption
B. Connection establishment
C. Error detection
D. Routing optimization

Answer: B. Connection establishment. It confirms reachability, creates shared state and carries initial sequence numbers. Encryption, routing and error detection are separate.

Question 2 (GATE 2008)

Code
Which of the following system calls results in the sending of SYN packets? 
Code
A.  socket
B.  bind 
C. listen
D. connect

Answer: D. connect. socket() creates, bind() addresses and listen() makes passive. Active-open connect() sends SYN. Solution.

Question 3 (GATE 2025)

Code
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?
Code
A. P3: SYN = 1, ACK = 1
B. P2: SYN = 1, ACK = 1
C. P2: SYN = 0, ACK = 1
D. P1: SYN = 1

Answer: B and D. P1 is SYN, P2 is SYN+ACK, P3 is ACK. A adds SYN to P3; C removes P2's SYN. Solution.

TCP questions 4-6: sequence numbers and states

Question 4 (GATE 2021)

Code
Consider the three-way handshake mechanism followed during TCP connection establishment between hosts P and Q. Let X and Y be two random 32-bit starting sequence numbers chosen by P and Q respectively. Suppose P sends a TCP connection request message to Q with a TCP segment having SYN bit =1, SEQ number =X, and ACK bit =0. Suppose Q accepts the connection request. Which one of the following choices represents the information present in the TCP segment header that is sent by Q to P?
Code
A. SYN bit =1, SEQ number =X+1, ACK bit =0, ACK number =Y, FIN bit =0
B. SYN bit =0, SEQ number =X+1, ACK bit =0, ACK number =Y, FIN bit =1
C. SYN bit =1, SEQ number =Y, ACK bit =1, ACK number =X+1, FIN bit =0
D. SYN bit =1, SEQ number =Y, ACK bit =1, ACK number =X, FIN bit =0

Answer: C. Q sends Y and acknowledges P's SYN with X+1. The reply is SYN+ACK, FIN=0. Solution.

Question 5 (GATE 2024)

Code
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?    
Code
A. The sequence number N_P is chosen randomly by P
B. The sequence number N_P is always 0 for a new connection
C. The acknowledgement number N_Q is equal to N_P
D. The acknowledgement number N_Q is equal to N_P + 1

Answer: A and D. P chooses its initial number. If N_P=4000, SYN consumes one position, so N_Q=4000+1=4001. Solution.

Question 6 (GATE 2008)

Code
The three way handshake for TCP connection establishment is shown below. Which of the following statements are TRUE?
(S1) Loss of SYN + ACK from the server will not establish a connection
(S2) Loss of ACK from the client cannot establish the connection
(S3) The server moves LISTEN -> SYN_RCVD -> SYN_SENT -> ESTABLISHED in the state machine on no packet loss 
(S4) The server moves LISTEN -> SYN_RCVD -> ESTABLISHED in the state machine on no packet loss.
Sequence diagram showing client SYN, server SYN+ACK, and client ACK in the TCP three-way handshake.
Code
A. S2 and S3 only
B. S1 and S4
C. S1 and S3
D. S2 and S4

Answer: B. S1 and S4. Lost SYN+ACK blocks until retransmission; lost ACK is recoverable. The passive path is LISTEN -> SYN_RCVD -> ESTABLISHED, never SYN_SENT. Solution.

TCP questions 7-9: crashes, close and TIME-WAIT

Question 7 (GATE 2021)

Code
A TCP server application is programmed to listen on port number P on host S. A TCP client is connected to the TCP server over the network. Consider that while the TCP connection was active, the server machine S crashed and rebooted. Assume that the client does not use the TCP keepalive timer. Which of the following behaviors is/are possible?
Code
A. If the client was waiting to receive a packet, it may wait indefinitely.
B. The TCP server application on S can listen on P after reboot.
C. If the client sends a packet after the server reboot, it will receive a RST segment.
D. If the client sends a packet after the server reboot, it will receive a FIN segment.

Answer: A, B and C. Reboot erases state. The client may block, the server may listen, and old traffic may provoke RST. FIN is orderly. Solution.

Question 8 (GATE 2026)

Code
With respect to a TCP connection between a client and a server, which one of the following statements is true?
Code
A. The client and server use a two-way handshake mechanism before the start of data transmission
B. The server cannot initiate closing of the connection before the client initiates closing of the connection
C. The TCP connection is half-duplex
D. The client and server can initiate closing of the connection at the same time

Answer: D. TCP is full-duplex with three-way establishment. Either endpoint may close, including simultaneously. Solution.

Question 9

Code
Suppose a client C repeatedly connects via TCP to a given port on a server S, and that each time it is C that initiates the close. If TIME-WAIT state lasts for 60 seconds, then how many connections per second can the client make, given that the available client-side port range is 1024 to 5119?
Code
A. 70 per sec
B. 10 per sec
C. 13 per sec
D. 100 per sec

Answer: A. 70 per sec. The inclusive range has 5119-1024+1=4096 ports. Then 4096/60=68.2666..., about 68.27 connections per second. The nearest option, 70, is an option-matching approximation.

TCP questions 10-12: windows and SYN floods

Question 10 (ISRO 2020)

Code
The persist timer is used in TCP to
Code
A. To detect crashes from the other end of the connection
B. To enable retransmission
C. To avoid deadlock condition
D. To timeout FIN_Wait1 condition

Answer: C. To avoid deadlock condition. A lost update can stall both ends. Persist probes find reopened space; this is not retransmission timing. Solution.

Question 11 (UPPSC 2022)

Code
Suppose in a TCP connection at any given time the receiver advertised window size is 20 kB and congestion window size is 10 kB.
 What should be the size of sender window to achieve flow control?
Code
A. 30 KB
B. 20 KB
C. 10 KB
D. Could be 10 kB or 20 kB or both

Answer: C. 10 KB. Both ceilings apply: min(rwnd,cwnd)=min(20 kB,10 kB)=10 kB. They are simultaneous limits, so adding them is wrong. Solution.

Question 12

Code
Consider the following statements:
S1: The sender retransmits the same segment without waiting for its timeout timer to expire. This problem is known as denial of service.
S2: An attacker sends a large number of requests to connect to a server but never completes the handshake for any of them. This problem is known as a SYN flooding attack.
Which of the following is correct with respect to the above statements?
Code
A. Only S1 is true
B. Only S2 is true
C. Both S1 and S2 are true
D. Neither S1 nor S2 is true

Answer: B. Only S2 is true. Fast retransmit is legitimate, so S1 is mislabelled. S2 describes half-open SYN-flood attempts.

The traps these TCP connection questions expose

Trap

Questions

Handshake purpose and flags

1 and 3

Active open and server state

2 and 6

SYN sequence-number accounting

4 and 5

Crash, close and TIME-WAIT

7 to 9

Zero-window and sender-window control

10 and 11

Reliability versus attack behaviour

12

Never put passive servers in SYN_SENT, charge data-free ACKs sequence space, expect FIN after crashes, add rwnd to cwnd, treat persist as retransmission timing, or label fast retransmit an attack. For the next step, study TCP Congestion Control for GATE and separate receiver flow control from sender congestion control.

TCP connection management and reliability: the short version and next step

Retest Questions 3, 4, 6, 7, 9, 10 and 11 without looking. The key topics are flags, sequence numbers, passive-open states, reboot behaviour, TIME-WAIT arithmetic, persist probes and sender-window calculation. The short chain is: connect() sends SYN; SYN and FIN consume one sequence number; a passive server follows LISTEN -> SYN_RCVD -> ESTABLISHED; either side may close; a crash can produce RST instead of FIN; persist probes break zero-window deadlock; usable send allowance is min(rwnd,cwnd). Use GATE Guidance by Sanchit Sir for sequenced Computer Networks study and the GATE Test Series for timed practice. Then explain each missed option aloud carefully.