TCP

Question 1
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 behaviours is/are possible?
A
If the client was waiting to receive a packet, it may wait indefinitely.
B
If the client sends a packet after the server reboot, it will receive a RST segment.
C
The TCP server application on S can listen on P after reboot.
D
If the client sends a packet after the server reboot, it will receive a FIN segment.
Question 1 Explanation: 
  1. True
    Since broken connections can only be detected by sending data, the receiving side will wait forever. This scenario is called a “half-open connection” because one side realizes the connection was lost but the other side believes it is still active.
  2. True
    The situation resolves itself when client tries to send data to server over the dead connection, and server replies with an RST packet (not FIN).
  3. True
    Yes, a TCP Server can listen to the same port number even after reboot.  For example, the SMTP service application usually listens on TCP port 25 for incoming requests. So, even after reboot the port 25 is assigned to SMTP.
  4. False
    The situation resolves itself when client tries to send data to server over the dead connection, and server replies with an RST packet (not FIN), causing client to finally to close the connection forcibly.
    FIN is used to close TCP connections gracefully in each direction (normal close of connection), while TCP RST is used in a scenario where TCP connections cannot recover from errors and the connection needs to reset forcibly.
Question 2
A user starts browsing a webpage hosted at a remote server. The browser opens a single TCP connection to fetch the entire webpage from the server. The webpage consists of a top-level index page with multiple embedded image objects. Assume that all caches (e.g., DNS cache, browser cache) are all initially empty. The following packets leave the user’s computer in some order. (i)    HTTP GET request for the index page (ii)    DNS request to resolve the web server’s name to its IP address (iii)    HTTP GET request for an image object (iv)    TCP SYN to open a connection to the web server Which one of the following is the CORRECT chronological order (earliest in time to latest) of the packets leaving the computer ?
A
(iv), (ii), (iii), (i)
B
(ii), (iv), (iii), (i)
C
(ii), (iv), (i), (iii)
D
(iv), (ii), (i), (iii)
Question 3
TCP client P successfully establishes a connection to TCP server Q. Let NP denote the sequence number in the SYN sent from P to Q. Let NQ denote the acknowledgement number in the SYN ACK from Q to P. Which of the following statements is/are CORRECT?
A
The sequence number NP is chosen randomly by P
B
The sequence number NP is always 0 for a new connection
C
The acknowledgement number NQ is equal to NP
D
The acknowledgement number NQ is equal to NP + 1
Question 4

A program on machine X attempts to open a UDP connection to port 5376 on a machine Y, and a TCP connection to port 8632 on machine Z. However, there are no applications listening at the corresponding ports on Y and Z. An ICMP Port Unreachable error will be generated by

A
Y but not Z
B
Z but not Y
C
Neither Y nor Z
D
Both Y and Z
Question 4 Explanation: 
When an IP packet is lost or discarded ICMP packet will be generated by receiver or the router. It doesn't matter whether its containing TCP or UDP inside it.
Question 5

A firewall is to be configured to allow hosts in a private network to freely open TCP connections and send packets on open connections. However, it will only allow external hosts to send packets on existing open TCP connections or connections that are being opened (by internal hosts) but not allow them to open TCP connections to hosts in the private network. To achieve this the minimum capability of the firewall should be that of

A
A combinational circuit
B
A finite automaton
C
A pushdown automaton with one stack
D
A pushdown automaton with two stacks
Question 5 Explanation: 
Pushdown automata with two stacks which is the Turing machine.
Turing machine can do everything as the normal computer can do, so firewall can be created by the TM.
Question 6

Consider a TCP connection in a state where there are no outstanding ACKs. The sender sends two segments back to back. The sequence numbers of the first and second segments are 230 and 290 respectively. The first segment was lost, but the second segment was received correctly by the receiver. Let X be the amount of data carried in the first segment (in bytes), and Y be the ACK number sent by the receiver. The values of X and Y (in that order) are

A
60 and 290
B
230 and 291
C
60 and 231
D
60 and 230
Question 6 Explanation: 
In the 1st segment data is from byte number 230 to byte number 289, that is 60 bytes. As 1st segment is lost, so TCP will send ACK for the next-in-order segment receiver is to be expecting. So, it will be for 230.
Question 7

Consider the following statements about the timeout value used in TCP.
(i) The timeout value is set to the RTT (Round Trip Time) measured during TCP connection establishment for the entire duration of the connection.
(ii) Appropriate RTT estimation algorithm is used to set the timeout value of a TCP connection.
(iii) Timeout value is set to twice the propagation delay from the sender to the receiver.
Which of the following choices hold?

A
(i) is false, but (ii) and (iii) are true
B
(i) and (iii) are false, but (ii) is title
C
(i) and (ii) are false, but (iii) is true
D
(i), (ii) and (iii) are false
Question 7 Explanation: 
Statement-I: It is False.
The timeout value cannot be fixed for entire duration as it will turn timer to static timer, we need dynamic timer for timeout.
Statement-II: It is True.
Basic algorithm, Jacobson's algorithm, Karl's modification; these three algorithms are to be appropriate to RTT estimation algorithm used to set timeout value dynamically.
Statement-III: It is False.
Because timeout value is set to twice the propagation delay in data link layer where hop to hop distance is known, not in TCP layer.
Question 8

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.

A
S2 and S3 only
B
S1 and S4
C
S1 and S3
D
S2 and S4
Question 8 Explanation: 
S1 → True.
S2 → False, because if after ACK client immediately sends data then everything goes on without worry.
S3 → False.
S4 → True.
Question 9

Consider three IP networks A, B and C. Host HA in network A sends messages each containing 180 bytes of application data to a host HC in network C. The TCP layer prefixes a 20 byte header to the message. This passes through an intermediate net­work B. The maximum packet size, including 20 byte IP header, in each network is:

     A : 1000 bytes 
     B : 100 bytes 
     C : 1000 bytes

The network A and B are connected through a 1 Mbps link, while B and C are connected by a 512 Kbps link (bps = bits per second).

What is the rate at which application data is transferred to host HC? Ignore errors, acknowledgements, and other overheads.

A
325.5 Kbps
B
354.5 Kbps
C
409.6 Kbps
D
512.0 Kbps
Question 9 Explanation: 
HC will receive 260 bytes in which only 180 bytes are of application data.
Application data is transferred at rate of (180/260) x 512 Kbps = 354.46 Kbps
Question 10

Consider three IP networks A, B and C. Host HA in network A sends messages each containing 180 bytes of application data to a host HC in network C. The TCP layer prefixes a 20 byte header to the message. This passes through an intermediate net­work B. The maximum packet size, including 20 byte IP header, in each network is:

     A : 1000 bytes 
     B : 100 bytes 
     C : 1000 bytes

The network A and B are connected through a 1 Mbps link, while B and C are connected by a 512 Kbps link (bps = bits per second).

Assuming that the packets are correctly delivered, how many bytes, including headers, are delivered to the IP layer at the destination for one application message, in the best case? Consider only data packets.

A
200
B
220
C
240
D
260
Question 10 Explanation: 
Application data is 180 bytes. TCP layer add 20 bytes to it and passes to IP layer, data for IP layer becomes 200 byte. HA send packet by adding 20 byte of IP header. So total size of IP packet is 220 bytes. Since, maximum packet size for packet in network A is 1000 bytes, there will be no fragmentation at network A. IP Layer at Network B removes IP header and receive 200 bytes of data. Network B has Maximum packet size 100 bytes including 20 byte IP header, network B divide data in 80 bytes fragments and add 20 byte of IP header to it.
Data will be divided in three packets as:
First packet: 80 bytes + 20 byte of header
Second packet: 80 bytes + 20 byte of header
Third packet: 40 bytes + 20 byte of header
Note: Defragmentation (grouping of fragments) is done only at destination.
HC will receive total 260 bytes including header.
Question 11

Host A (on TCP/IP v4 network A) sends an IP datagram D to host B (also on TCP/IP v4 network B). Assume that no error occurred during the transmission of D. When D reaches B, which of the following IP header field(s) may be different from that of the original datagram D?

(i) TTL                  
(ii) Checksum                
(iii) Fragment Offset 
A
(i) only
B
(i) and (ii) only
C
(i) and (ii) only
D
(i), (ii) and (iii)
Question 11 Explanation: 
While an IP Datagram is transferring from one host to another host, TTL, Checksum and Fragmentation Offset will be changed.
Question 12

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 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
Question 12 Explanation: 
TCP header sequence number field consist 16 bits. The maximum number of sequence numbers possible = 216 = 65,535.
The wrap around time for given link = 1048560 * α. The TCP window scale option is an option to increase the receive window size. TCP allows scaling of windows when wrap around time > 65,535.
==> 1048560 * α > 65,535*8 bits
==> α = 0.5 sec = 500 mss
Scaling is done by specifying a one byte shift count in the header options field. The true receiver 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 scaling option is 65535 × 214.
Question 13

Suppose two hosts use a TCP connection to transfer a large file. Which of the following statements is/are False with respect to the TCP connection?

    1. If the sequence number of a segment is m, then the sequence number of the subsequent segment is always m+1.
    2. If the estimated round trip time at any given point of time is t sec, the value of the retransmission timeout is always set to greater than or equal to t sec.
    3. The size of the advertised window never changes during the course of the TCP connection.
    4. The number of unacknowledged bytes at the sender is always less than or equal to the advertised window.
A
III only
B
I and III only
C
I and IV only
D
II and IV only
Question 13 Explanation: 
I. False.
If the sequence no. of the segment is m, then the sequence number of the subsequent segment depends on the current segment size.
II. True.
If the estimated RTT at any given point of time is t second, then the value of the re-transmission timeout is always set to greater than or equal to t sec.
III. False.
The size of the advertised window may change during the course of the TCP connection depending on the processing capability at the receiver's side and the network traffic.
IV. True.
The number of unacknowledged bytes at the sender is always less than or equal to the advertised window, because the sender never sends no. of bytes greater than advertised window.
Question 14

Identify the correct sequence in which the following packets are transmitted on the network by a host when a browser requests a webpage from a remote server, assuming that the host has just been restarted.

A
HTTP GET request, DNS query, TCP SYN
B
DNS query, HTTP GET request, TCP SYN
C
DNS query, TCP SYN, HTTP GET request
D
TCP SYN, DNS query, HTTP GET request
Question 14 Explanation: 
When a browser requests a web page from a remote server then that requests (URL address) will be mapped to IP address using DNS query, then TCP synchronization takes place after that HTTP verify whether it is existed in the web server or not.
Question 15
Suppose you are asked to design a new reliable byte-stream transport protocol like TCP. This protocol, named myTCP, runs over a 100 Mbps network with Round Trip Time of 150 milliseconds and the maximum segment lifetime of 2 minutes. Which of the following is/are valid lengths of the Sequence Number field in the myTCP header?
A
30 bits
B
32 bits
C
34 bits
D
36 bits
Question 16

Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= 109 bits/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 _________.

A
33
B
34
C
35
D
36
Question 16 Explanation: 
In TCP, Sequence number field is 32 bit, which means 232 sequence number per byte are possible. Whatever be the starting sequence number the possible number will be 232bytes
The process of using all the sequence number and repeating a previously used sequence number.
The time taken to wrap around is called wrap around time:
Minimum Time = Wrap around time = Total number of bits in sequence number / Bandwidth = 232 * 8 / 109 = 34.35 == 34 (closest integer)
Question 17

Consider the following statements.

    I. TCP connections are full duplex.
    II. TCP has no option for selective acknowledgment.
    III. TCP connections are message streams.
A
Only I is correct
B
Only I and III are correct
C
Only II and III are correct
D
All of I, II and III are correct
Question 17 Explanation: 
In TCP, as sender and receiver can send segments at the same time, It is FULL-DUPLEX. TCP can use selective ACK and TCP uses byte streams that is every byte is send using TCP is numbered.
Question 18

Let the size of congestion window of a TCP connection be 32 KB when a timeout occurs. The round trip time of the connection is 100 msec and the maximum segment size used is 2 KB. The time taken (in msec) by the TCP connection to get back to 32 KB congestion window is _________.

A
1100 to 1300
B
1101 to 1301
C
1102 to 1302
D
1103 to 1303
Question 18 Explanation: 
Given that at the time of Time Out, Congestion Window Size is 32KB and RTT = 100ms
When Time Out occurs, for the next round of Slow Start, Threshold = (size of Cwnd) / 2
It means Threshold = 16KB
Slow Start
2KB
1RTT
4KB
2RTT
8KB
3RTT
16KB ----------- Threshold reaches. So Additive Increase Starts
4RTT
18KB
5RTT
20KB
6RTT
22KB
7RTT
24KB
8RTT
26KB
9RTT
28KB
10RTT
30KB
11RTT
32KB
So, Total no. of RTTs = 11 → 11 * 100 = 1100
Question 19
Identify the correct order in which the following actions take place in an interaction between a web browser and a web server.
1. The web browser requests a webpage using HTTP.
2. The web browser establishes a TCP connection with the web server.
3. The web server sends the requested webpage using HTTP.
4. The web browser resolves the domain name using DNS.
A
4,2,1,3
B
1,2,3,4
C
4,1,2,3
D
2,4,1,3
Question 19 Explanation: 
First of all the browser must now know what IP to connect to. For this purpose browser takes help of Domain name system (DNS) servers which are used for resolving hostnames to IP addresses. As browser is an HTTP client and as HTTP is based on the TCP/IP protocols, first it establishes a TCP connection with the web server and requests a web page using HTTP, and then the web server sends the requested web page using HTTP. Hence the order is 4,2,1,3.
There are 19 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access