Computer Networks

GATE CS previous year questions · 22 questions

GATE CS 2024 Set 1 | Question 16

MCQ · 1 mark · −0.33

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 ?

Options for GATE CS 2024 Set 1 | Question 16

Explanation

Answer: (C)

Follow what the browser needs at each step:

  • (ii) It knows only the server’s name and the DNS cache is empty, so it must first send a DNS request for the IP address.
  • (iv) With the address known, it opens the TCP connection by sending a SYN.
  • (i) Over that connection it requests the index page.
  • (iii) Only after the index page arrives does the browser learn which images are embedded, so an image GET comes last.

So the order is (ii), (iv), (i), (iii). Options A and D send the SYN before the address is known, and option B requests an image before the index page.

Answer: C

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 1 | Question 31

MSQ · 1 mark

Which of the following fields is/are modified in the IP header of a packet going out of a network address translation (NAT) device from an internal network to an external network?

Options for GATE CS 2024 Set 1 | Question 31

Explanation

Answer: (A), (C)

A NAT device lets hosts with private addresses share a public address. For a packet leaving the internal network it replaces the private source address with its own public address (with port translation it also changes the source port, but that is in the TCP or UDP header) and records the mapping so that replies can be sent back.

  • Source IP: modified, as described.
  • Destination IP: unchanged, because the packet still goes to the same external host.
  • Header Checksum: modified. It covers the whole IP header, so it must be recomputed once the source address changes.
  • Total Length: unchanged, because the sizes of the header and the data stay the same.

Answer: A, C

GATE CS 2024 Set 1 | Question 36

MCQ · 2 marks · −0.66

Consider a network path P—Q—R between nodes P and R via router Q. Node P sends a file of size \(10^{6}\) bytes to R via this path by splitting the file into chunks of \(10^{3}\) bytes each. Node P sends these chunks one after the other without any wait time between the successive chunk transmissions. Assume that the size of extra headers added to these chunks is negligible, and that the chunk size is less than the MTU.

Each of the links P—Q and Q—R has a bandwidth of \(10^{6}\) bits/sec, and negligible propagation latency. Router Q immediately transmits every packet it receives from P to R, with negligible processing and queueing delays. Router Q can simultaneously receive on link P—Q and transmit on link Q—R.

Assume P starts transmitting the chunks at time \(t = 0\).
Which one of the following options gives the time (in seconds, rounded off to 3 decimal places) at which R receives all the chunks of the file?

Options for GATE CS 2024 Set 1 | Question 36

Explanation

Answer: (B)

The file is split into \(10^{6} / 10^{3} = 1000\) chunks of 8000 bits each. Sending one chunk on a \(10^{6}\) bits/sec link takes \(8000 / 10^{6}\) s, that is 8 ms.

P sends the chunks back to back, so Q has received the last chunk at \(1000 \times 8\) ms \(= 8\) s. Q forwards each chunk as soon as it has fully arrived, and because it can send while it receives, it finishes forwarding one chunk just as the next one has arrived: no queue builds up. The last chunk then needs one more transmission time on Q—R, so R has everything at \(8 + 0.008 = 8.008\) s.

Holding the whole file at Q before forwarding would give 16.000 s, and 8.000 s leaves out the second hop of the last chunk.

Answer: B

GATE CS 2024 Set 1 | Question 58

NAT · 2 marks

Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation “/N” in a prefix indicates a subnet mask with the most significant N bits set to 1.

PrefixNext hop router
10.1.1.0/24R1
10.1.1.128/25R2
10.1.1.64/26R3
10.1.1.192/26R4

This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205 . The number of packets forwarded via the next hop router R2 is _______

Explanation

Answer: 40

A router sends each packet by the longest prefix that matches its destination. In the last byte, 10.1.1.128/25 covers 128–255, 10.1.1.64/26 covers 64–127, 10.1.1.192/26 covers 192–255, and the /24 matches every 10.1.1.x address.

  • 10.1.1.16 matches only the /24: R1.
  • 10.1.1.72 matches the /24 and 10.1.1.64/26: R3.
  • 10.1.1.132 and 10.1.1.191 match the /24 and the /25 but not 10.1.1.192/26 (191 is just below 192): R2.
  • 10.1.1.205 matches the /24, the /25 and 10.1.1.192/26; the /26 is the longest: R4.

Two hosts are reached via R2, so \(2 \times 20 = 40\) packets go through it.

Answer: 40

GATE CS 2024 Set 1 | Question 65

NAT · 2 marks

Consider sending an IP datagram of size 1420 bytes (including 20 bytes of IP header) from a sender to a receiver over a path of two links with a router between them. The first link (sender to router) has an MTU (Maximum Transmission Unit) size of 542 bytes, while the second link (router to receiver) has an MTU size of 360 bytes. The number of fragments that would be delivered at the receiver is ________

Explanation

Answer: 6

The datagram carries \(1420 - 20 = 1400\) bytes of data. Every fragment has its own 20-byte header, and every fragment except the last must carry a multiple of 8 data bytes.

  • First link (MTU 542): at most \(542 - 20 = 522\) data bytes, rounded down to 520. The data splits as \(520 + 520 + 360\), giving fragments of 540, 540 and 380 bytes.
  • Second link (MTU 360): at most \(360 - 20 = 340\) data bytes, rounded down to 336. Each 520-byte piece splits into \(336 + 184\), and the 360-byte piece into \(336 + 24\).

Routers do not reassemble fragments, so the receiver gets \(2 + 2 + 2 = 6\) fragments.

Answer: 6

GATE CS 2024 Set 2 | Question 23

MSQ · 1 mark

Node X has a TCP connection open to node Y. The packets from X to Y go through an intermediate IP router R. Ethernet switch S is the first switch on the network path between X and R. Consider a packet sent from X to Y over this connection.

Which of the following statements is/are TRUE about the destination IP and MAC addresses on this packet at the time it leaves X?

Options for GATE CS 2024 Set 2 | Question 23

Explanation

Answer: (B)

IP addresses name the two ends of the journey, while a MAC address only names the next stop on the current link.

  • The IP header carries the final destination, so the destination IP address is Y's all the way; routers forward on it but do not rewrite it. B is true and A is false.
  • Y is on another network, so X sends the frame to its next-hop router R: the destination MAC address is R's, which X finds through ARP. R then puts the packet in a new frame for the next link.
  • An Ethernet switch is transparent. It forwards frames by their destination MAC address but is never itself the addressee, so C is false. Y's MAC address would be used only if Y were on X's own LAN, so D is false.

Answer: B

GATE CS 2024 Set 2 | Question 28

MSQ · 1 mark

Which of the following statements about IPv4 fragmentation is/are TRUE?

Options for GATE CS 2024 Set 2 | Question 28

Explanation

Answer: (B), (C)

In IPv4, a datagram can meet a link with a smaller MTU anywhere on its path.

  • B is true and A is false: any router whose outgoing link cannot carry the datagram splits it into fragments, each with its own IP header and with the offset and more-fragments fields set. (Fragmenting only at the source is how IPv6 works.)
  • C is true and D is false: fragments of one datagram may take different routes, and a later link may have a larger MTU anyway, so routers forward fragments as independent datagrams. Only the destination host collects them, using the identification field and the offsets, and rebuilds the original datagram.

Answer: B, C

GATE CS 2024 Set 2 | Question 32

MSQ · 1 mark

Which of the following fields of an IP header is/are always modified by any router before it forwards the IP packet?

Options for GATE CS 2024 Set 2 | Question 32

Explanation

Answer: (C), (D)

When a router forwards an IPv4 packet:

  • it decrements the TTL by 1 (and discards the packet if the TTL reaches 0), so the TTL always changes;
  • the header checksum covers the whole header, TTL included, so it must be recomputed and rewritten every time.

The source IP address identifies the original sender and stays the same end to end; only special devices such as NAT boxes rewrite it, not every router. The protocol field names the protocol of the payload (for example 6 for TCP), which a router has no reason to change.

Answer: C, D

GATE CS 2024 Set 2 | Question 38

MCQ · 2 marks · −0.66

Which one of the following CIDR prefixes exactly represents the range of IP addresses 10.12.2.0 to 10.12.3.255?

Options for GATE CS 2024 Set 2 | Question 38

Explanation

Answer: (A)

The range holds \(2 \times 256 = 512 = 2^{9}\) addresses, so the block needs 9 host bits: a /23 prefix. In the third octet, 2 is 00000010 and 3 is 00000011, so only its last bit varies, and 10.12.2.0 has all 9 host bits zero. So 10.12.2.0/23 covers exactly 10.12.2.0 to 10.12.3.255.

  • 10.12.2.0/24 covers only 10.12.2.0 to 10.12.2.255, half the range.
  • 10.12.0.0/22 covers 10.12.0.0 to 10.12.3.255, twice the range.
  • 10.12.2.0 does not start a /22 block; with a /22 mask it falls in the block 10.12.0.0 to 10.12.3.255, again too large.

Answer: A