Table of contents
1.
Introduction
2.
FAQs
2.1.
Are there any restrictions or age limits to applying for the GATE Exams 2023?
2.2.
What is GATE?
2.3.
Are these books GATE specific?
2.4.
Which is the best book to study Digital Logic?
2.5.
What are the eligibility criteria for the GATE Exam?
3.
Conclusion
Last Updated: Mar 27, 2024
Easy

TCP UDP Sockets and Congestion Control

Author Divyansh Jain
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

TCP and UDP are two protocols for data transfer between terminals in an IP network (the Internet). When the source sends more packets than the destination can handle, congestion ensues. When there is a bottleneck, performance suffers. Congestion occurs when these buffers on the destination side become full. In this article, we are going to discuss the previous year's Gate questions based on TCP UDP Sockets and Congestion Control:

So, let's get started:  

Question 1

Electronic mail is supported by which of the following transport layer protocols?

Gate CSE 2012

  1. SMTP
  2. IP
  3. TCP
  4. UDP

Answer: 3

Explanation:

a) SMTP - It is an application layer protocol that is used for sending emails.

b) IP - It is a protocol of a network layer.

c) TCP - It is a connection-oriented transport layer protocol.

d) UDP - It is a connectionless transport layer protocol.

SMTP is an application layer protocol that is used for sending emails. As it is a connection-oriented protocol, TCP is utilized at the transport layer.

As a result, for mail services, SMTP in the application layer uses TCP in the transport layer.

Question 2 

Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= 109 bits-per-second). The session starts with a sequence number of 1234. The minimum time (in seconds, rounded to the closest integer) before this sequence number can be used again is _______ 

  1. 34
  2. 4.30
  3. 43
  4. None of these

Gate CSE 2018

Answer: 1

Explanation:

Because the sequence number field of TCP is 32 bits, there are a total of 232 potential sequence numbers (from 0 to 232-1), which is the TCP data limit.

However, if you want to send data in TCP that is longer than 232 bytes, you must repeat this method after sending 232 bytes of data or unique sequence numbers.

Wrap around is a notion that allows you to deliver a limitless amount of data over TCP.

TCP assigns one sequence number to each byte of data, therefore the query is asking for wrap-around time, which is equal to passing all unique sequences first, i.e., 232.

Twraparound = (Total data) / (Bandwidth)

= (232 bytes) / (109 bits per second)

= (232 * 8 bits) / (109 bits per second)

= 34.35 seconds

Question 3

Consider the statements below.

i) TCP connections are full-duplex.

ii) TCP does not have a selective acknowledgment option.

iii) TCP connections are message streams.

  1. Only i) is correct
  2. Only i) and iii) are correct
  3. Only i) and iv) are correct
  4. All of the i), ii) and iii) are correct

Gate CSE 2015 Set 1

Answer: A

Explanation:

  1. TCP is FULL-DUPLEX because both the sender and the receiver can send segments at the same time.
  2. Selective acknowledgment is possible with TCP. The data receiver can inform the sender about all segments that have arrived successfully using selective acknowledgments (SACKs), requiring the sender to retransmit just the segments that have been lost.
  3. TCP is a BYTE stream protocol because each BYTE is counted in a TCP segment and the sequence number of the first BYTE is saved in the header.

Question 4

Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket APL.

  1. listen, accept, bind, recv
  2. bind, listen, accept, recv
  3. bind, accept, listen, recv
  4. accept, listen, bind, recv

Gate CSE 2015 Set 3

Answer: B

Explanation:

Server-side socket API functions include bind, listen, accept, and recv.

Bind() connects a socket to a socket address structure, which includes a local port number and an IP address.

Listen() enters the listening state of a bound TCP socket.

Accept() accepts an incoming attempt from the remote client to establish a new TCP connection.

A server must first use bind() to inform the operating system of the port number on which it will be listed, and then listen for incoming connection requests on that port number. When a connection is established, the server acknowledges it with accept() and then begins receiving data with recv().

Question 5

The transport layer protocols used for real-time multimedia, file transfer, DNS, and email, respectively are

  1. TCP, UDP, UDP, and TCP
  2. UDP, TCP, TCP, and UDP
  3. UDP, TCP, UDP, and TCP
  4. TCP, UDP, TCP, and UDP

Gate CSE 2013

Answer: C

Explanation:

The main transport layer protocols are TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

TCP is more reliable than UDP because it is connection-oriented rather than connectionless. UDP, on the other hand, is stateless (which means it has less overhead), making it ideal for applications where error checking and correction are less critical than rapid delivery.

For real-time multimedia, timely delivery is more important than correctness. –> UDP

For file transfer, correctness is necessary. –> TCP

DNS, timely delivery is more important –> UDP

Email again same as file transfer –> TCP

Question 6

Which of the following system calls results in the sending of SYN packets?

  1. socket
  2. listen
  3. bind
  4. connect

Gate CSE 2008

Answer: D

Explanation: 

connect() is used on the client-side, and assigns a free local port number to a socket. In the case of a TCP socket, it causes an attempt to establish a new TCP connection.

Question 7

What is the maximum size of data that the application layer can pass on to the TCP layer below?

Gate CSE 2008

  1. Any size
  2. 216 bytes - size of TCP headers
  3. 216 bytes
  4. 1500 bytes

Explanation:

The maximum segment size for TCP is set to 536 by default. The maximum segment size is supplied as a TCP option, initially in the TCP SYN packet during the TCP handshake, when a host wishes to change it from the default value. A host can adjust the maximum segment size parameter in any subsequent segment since it is controlled by a TCP option.

Question 8

Which of the following protocol pairings (in that order) can be used to send and receive e-mails?

Gate CSE 2022 

  1. IMAP, SMTP
  2. SMTP, POP3
  3. IMAP, POP3
  4. SMTP, MIME

Answer: B

Explanation:  

SMTP( Simple Mail Transfer Protocol ): Responsible for outgoing mail

POP3(Post Office Protocol): Responsible for retrieving mail.

Question 9

Consider the sliding window flow-control protocol, which operates across a full-duplex error-free link between a sender and a receiver. Consider the following scenario:

1. The receiver's processing time for the data frame is insignificant.
2. The sender's time spent processing the acknowledgment frame is insignificant.
3. The sender has an endless number of frames available to send.
4. The data frame is 2,000 bits long and the acknowledgment frame is 10 bits long.
5. The link data rate is 1 Mbps (= 106 bits per second) in each direction.
6. The link's one-way propagation delay is 100 milliseconds.

The minimal value of the sender's window size in units of frames required to achieve a link utilisation of 50% is (rounded to the nearest integer). ______

Gate CSE 2021

Answer: 51

Explanation: 

Given, data with ack = 2000+10 = 2010 bits and bandwidth 1 Mbps (= 106 bits per second).
Therefore, transmission time is Tx = 2010 bits / 1 Mbps = 2.01 milliseconds

And given, propagation delay Tp = 100 milliseconds.

Hence, accodrding to efficiency formula,

effi = N / (1 + 2Tp/Tx),
N is window size.
1/2 = N / (1 + 2*100 / 2.01)
N = (1 + 2*100 / 2.01) / 2
N = 100.502488 / 2
N = 50.251244
N = 51 (nearest integer)

Question 10

Consider an IP packet of length 4,500 bytes which includes a 20-byte IPv4 header ans 40-byte TCP header. The packet is sent to an IPv4 router that supports a Maximum Transmission Unit (MTU) of 600 bytes. Assume that the IP header in all of this packet's outbound segments is 20 bytes long. Assume that the first fragment's fragmentation offset value is zero.

In the third fragment, the fragmentation offset value is_______.

Gate CSE 2018

Answer: 144

Explanation: 

IP Header = 20 bytes and MTU = 600 bytes

Hence, Payload will be 600 – 20 = 580 bytes

580 is not divisiable by 8, but we know fragment size must be a multiple of 8. So fragment size = 576 bytes

Nth fragmentation offset value = Fragment Size * (Nth fragment – 1) / Scaling Factor

3rd fragment’s Offset value = 576 * (3 – 1) / 8 = 144

Question 11

Consider the following claims about the TCP congestion management algorithm's slow start phase. The TCP congestion window is denoted by cwnd, and the Maximum Segments Size is denoted by MSS:

  1. Every successful acknowledgment increases the cwnd by 2 MSS.
  2. Every successful acknowledgment nearly doubles the cwnd.
  3. Every round journey time, the cwnd grows by 1 MSS.
  4. Every round trip time, the cwnd roughly doubles.

Which of the following statements is correct?

  1. Only (ii) and (iii) are true
  2. Only (iv) is true
  3. Only (i) and (iii) are true
  4. Only (i) and (iv) are true

Gate CSE 2018

Answer: C

Explanation: 

Every time an ACK is received by the sender, the congestion window will be increased by 1 segment: CWND=CWND+1.

CWND increases exponentially with every RTT.

Hence, the correct answer is C.

Question 12

For a host machine that uses the token bucket algorithm for congestion control, the token bucket has a capacity of 1 megabyte and the maximum output rate is 20 megabytes per second. Tokens arrive at a rate to sustain output at a rate of 10 megabytes per second. The token bucket is currently full and the machine needs to send 12 megabytes of data. The minimum time required to transmit the data is _________________ seconds.
(A) 1.1
(B) 0.1
(C) 2.1
(D) 2.0

Gate CSE 2016

Answer: A

Explanation: Token bucket is a data transmission congestion control method. To synchronize the rate of incoming and departing data, tokens are required.

The minimum time required by the token bucket algorithm

to transfer 1 MB of data or the maximum rate of data transmission is 

given by:

   S = C / (M - P)

Where, 

M = Maximum burst rate,

P = Rate of the arrival of a token,

C = capacity of the bucket

Using the above formula for the given question we can say that:

M = 20 MB P = 10 MB C = 1 MB S = 1 / (20- 10) = 0.1 sec 

Since the bucket is initially full, it already has 1 MB to transmit so it will be transmitted instantly. So, we are left with only (12 – 1), i.e. 11 MB of data to be transmitted.

Time required to send the 11 MB will be 11 * 0.1 = 1.1 sec.

You can read related articles such as Congestion Control in Computer Networks here.

Question 13

Consider data transport over a 1 Gbps network using TCP. Assuming a 60-second maximum segment lifetime (MSL), the minimal amount of bits required for the sequence number field of the TCP header to avoid the sequence number space from circling around during the MSL is ___________.

(A) 27.8

(B) 48.0

(C) 33.0

(D) 35.0

Gate CSE 2019

Answer: 33

Explanation: 

Given us:

Bandwidth = 1Gbps = ⅛ * 109bps . 

In 60 seconds no of bytes to be transferred = 60*⅛ *109,

i.e. 7.5*109 Bytes

So, TCP will generate 7.5*109 Sequence numbers within 60 seconds. To generate 7.5*109 unique sequence no. we need

ceil(log(7.5*109))=ceil(32.8) = 33 bits in the sequence no. field. 


Question 14

Assume that the bandwidth for a TCP connection is 1048560 bits/sec. Let α be the value of RTT in milliseconds (rounded off to the nearest integer) after which the TCP window scale option is needed. Let β be the maximum possible window size with the window scale option. Then the values of α and β are.
(A) 63 milliseconds 65535 × 214
(B) 63 milliseconds 65535 × 216
(C) 500 milliseconds 65535 × 214
(D) 500 milliseconds 65535 × 216

Gate CSE 2015

Answer: D

Explanation: 

Since the sequence number in the TCP header is limited to 16 bits, the maximum window size is limited. When the bandwidth-delay product of a link is high, scaling is required to efficiently use the link. 

TCP allows scaling of windows when the bandwidth-delay product is greater than 65,535.

The bandwidth-delay product for the given link is 1048560 * α. Window scaling is needed when this value is more than 65535 bytes, i.e., when α is greater than 65535 * 8 / 1048560 or 0.5 seconds.

Scaling is done by specifying a one-byte shift count in the header options field. The true receive window size is left-shifted by the value in shift count. A maximum value of 14 may be used for the shift count value. Therefore maximum window size with the scaling option is 65535 × 214.

Question 15

When a TCP connection times out, set the congestion window size to 32 KB. The connection's round trip time is 100 milliseconds, and the maximum segment size is 2 KB. The time it takes the TCP connection to return to the 32 KB congestion window (in milliseconds) is_______.

(A) 1100 to 1300

(B) 1400 to 1600

(C) 800 to 1000

(D) 1500 to 1700

Gate CSE 2015

Answer: B

Explanation: In terms of the number of segments, the current size of the congestion window is

                            = (Size in Bytes)/(Maximum Segment Size)

                            = 32KB / 2KB 

                            = 16 MSS

When TCP's Slow Start algorithm detects a timeout, the threshold is dropped to half, which is 16KB or 8MSS. When the congestion window is enlarged twice, the slow start phase begins.

As a result, the window size will rise exponentially from 1 MSS to 8 MSS.
After one RTT, the congestion window becomes 2MSS, 4MSS after two RTTs, and 8MSS after three RTTs. The congestion avoidance phase begins when the threshold is met at 8MSS. The window is linearly enlarged during the congestion avoidance phase. So 8 RTTs are required to span the range of 8MSS to 16MSS.

11 RTTs are required in total (3 for the sluggish start phase and 8 for the congestion avoidance phase).

Question 16

The initial sequence number for a TCP connection is calculated using a time-of-day (ToD) clock that runs even while the host is unavailable. The initial sequence numbers will be generated using the low order 32 bits of the ToD clock's counter. The clock counter advances by one millisecond per millisecond. The maximum packet lifetime is specified as 64 seconds.

Which of the following options is closest to the lowest rate at which sequence numbers for packets in a connection can increase?

(A) 0.135/s

(B) 0.064/s

(C) 0.015/s

(D) 0.327/s

Gate CSE 2009

Answer: C

Explanation: In the inquiry, the maximum packet lifetime is specified as 64 seconds.
As a result, every 64 seconds, the sequence number increases.

So, minimum permissible rate = 1 / 64 = 0.015 per second

Hence, option (A) is the answer.

 

Question 17

A token bucket controls the speed of a computer on a 10Mbps network. At a rate of 2Mbps, the token bucket is filled. It is pre-loaded with 16 megabits of data. What is the maximum time the computer can send at full speed (10Mbps)?

  1. 1.6 seconds
  2. 5 seconds
  3. 2 seconds
  4. 8 seconds

Gate CSE 2008

Answer: C

Explanation: 

New tokens are added at a rate of r bits/sec, which in this case is 2Mbps.

Capacity of the token bucket (b)=16Mbits

Maximum possible transmission rate (M)=10Mbps

So, the maximum burst time =b/(M−r)=16/(10−2)=2seconds

Here is the token bucket animation, which should help us understand the concept.

Question 18

Over and above the network protocol, which of the following functionalities must be implemented by a transport protocol?

(A) Detection of duplicate packets

(B) Recovery from packet losses

(C) Packet delivery in the correct order

(D) End to end connectivity

Gate CSE 2003

Answer: D

Explanation: The Transport protocol's necessary feature is end-to-end connectivity. UDP is a transport layer protocol that lacks the other three functions, which are only implemented in TCP.

Question 19

Consider a 100 Mbps link between an earth station (sender) and a satellite (receiver) at an altitude of 2100 km. The signal propagates at a speed of 3×108 m/s. The time taken (in milliseconds, rounded off to two decimal places) for the receiver to completely receive a packet of 1000 bytes transmitted by the sender is_________.

A 3.95

B 5.09

C 7.08

D 9.65

Gate CSE 2022 

Answer: C : 7.08

Explanation: 

The time required for the receiver to receive the packet in transmission time (Tt) + propagation time(Tp), 

i.e. Tt + Tp . Tt = 1000*8 bits/108 bps

=> 0.08 ms

Tp = 2100*1000m / 3*108m

=>7*105/108

=> 7ms

henceforth, the total time required => 7.08 ms

Question 20

Consider the Additive Increase Multiplicative Decrease (AIMD) algorithm of TCP, in which the window size at the start of the slow start phase is 2 MSS and the threshold at the commencement of the first transmission is 8 MSS. Assume the fifth transmission is interrupted by a timeout. At the end of the tenth transmission, calculate the congestion window size.

(A) 8 MSS

(B) 7 MSS

(C) 14 MSS

(D) 12 MSS

Gate CSE 2012

Answer: B

Explanation: 

At:
𝑡=1, = 2 MSS
𝑡=2,=  4 MSS
𝑡=3, = 8 MSS
𝑡=4,= 9 MSS (after threshold additive increase)
𝑡=5, = 10 MSS (fails)
Threshold will be reduced to 𝑛2 i.e. 102=5.
𝑡=6,= 1 MSS , 
(There is an ambiguity here if the window size will be 1 MSS or 2 MSS as given in the question and due to this GATE gave marks to all. Assuming window size to be 1 MSS) 
𝑡=7 = 2 MSS
𝑡=8, = 4 MSS
𝑡=9, = 5 MSS
𝑡=10, = 6 MSS.
So, at the end of 10th successful transmission ,
The the congestion window size will be (6+1)=7 MSS.

FAQs

Are there any restrictions or age limits to applying for the GATE Exams 2023?


No, there are no restrictions on the number of times.

What is GATE?


GATE, or Graduate Aptitude Test in Engineering, is an All-India Examination conducted jointly by the Indian Institute of Science (IISc), Bangalore, and the seven Indian Institutes of Technology (IITs).

Are these books GATE specific?


These are the books widely recommended to prepare for the GATE exam. However, it would be best to study them according to the GATE syllabus only.

Which is the best book to study Digital Logic?


Digital Logic and Computer Design by Morris Mano is one of the best books to clear your concepts on Boolean algebra, Combinational and sequential circuits, etc.

What are the eligibility criteria for the GATE Exam?


The candidate should have done their Bachelors in Science or Engineering.

Conclusion

To summarize the above article we have done so many questions on TCP UDP Sockets as well as Congestion Control. These were all previous year's questions that appeared in the Gate paper. 

Hope you learned something. But the knowledge never stops.

If you want to learn more, check out our articles on Introduction to GATEHow to prepare in the Last 10 days to score high in GATE?

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. 

Enroll in our courses and refer to the mock test and problems available.

Take a look at the interview experiences and interview bundle for placement preparations.

Happy Learning Ninja :) 

Live masterclass