IAE Academy

GATE 2024 CS1 Q.16: solution and answer

GATE 2024 · CS1Q.16 · 1 mark · MCQ

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 ?

  1. (A)

    (iv), (ii), (iii), (i)

  2. (B)

    (ii), (iv), (iii), (i)

  3. (C)

    (ii), (iv), (i), (iii)

  4. (D)

    (iv), (ii), (i), (iii)

See the question in the paper

Answer and solution

ANSWER

The correct order is (ii), (iv), (i), (iii), which is option (C).

Official answer: CSource: Official answer key, GATE 2024 CS1 (IISc Bengaluru)

  1. All caches are empty, so the browser does not know the web server's IP address. The first packet to leave the computer is the DNS request (ii).

  2. A TCP SYN needs the server's IP address as its destination. So (iv) can leave only after the DNS reply arrives. Order so far: (ii), (iv).

  3. The SYN starts the three-way handshake. Once the connection is established, the browser sends the HTTP GET for the index page (i).

  4. The image URLs appear only inside the index page's HTML. The browser must receive and parse that page before it can request any image.

  5. So the GET for an image object (iii) leaves last, over the same single TCP connection.

  6. Chronological order: , which is option (C).

KEY IDEA

Each packet depends on an earlier one. The IP address from DNS is needed for the SYN. An established connection is needed for the GET. The index page must arrive before the image URLs are known.

WATCH OUT FOR

Sending the TCP SYN before the DNS lookup, as in options (A) and (D). Another mistake is asking for an image before the index page, as in options (A) and (B). The image URLs are inside the index page, so it must come first.

From the GATE 2024 CS1 paper. Every question of this paper · Download the full paper · All 5 DNS & HTTP questions, with notes

More DNS & HTTP questions