A graphical HTML browser resident at a network client machine Q accesses a…

2014

A graphical HTML browser resident at a network client machine Q accesses a static HTML webpage from a HTTP server S. The static HTML page has exactly one static embedded image which is also at S. Assuming no caching, which one of the following is correct about the HTML webpage loading (including the embedded image)?

  1. A.

    Q needs to send at least 2 HTTP requests to S, each necessarily in a separate TCP connection to server S

  2. B.

    Q needs to send at least 2 HTTP requests to S, but a single TCP connection to server S is sufficient

  3. C.

    A single HTTP request from Q to S is sufficient, and a single TCP connection between Q and S is necessary for this

  4. D.

    A single HTTP request from Q to S is sufficient, and this is possible without any TCP connection between Q and S

Attempted by 340 students.

Show answer & explanation

Correct answer: B

Answer: Q needs to send at least two HTTP requests, and a single TCP connection to the server is sufficient.

  • Step 1: The browser sends an HTTP GET for the HTML page and receives the HTML response.

  • Step 2: The HTML contains a reference to an embedded image hosted on the same server, so the browser issues a second HTTP GET to fetch the image.

  • Why at least two requests: The HTML and the image are separate resources (unless the image were embedded inline using a data URI), so each resource needs its own HTTP request.

  • Why a single TCP connection is sufficient: HTTP/1.1 uses persistent connections (keep-alive) by default, allowing multiple HTTP requests and responses to be sent sequentially over one TCP connection. HTTP/2 and HTTP/3 take this further—HTTP/2 multiplexes many streams over one TCP connection, and HTTP/3 multiplexes over a single QUIC connection (not TCP).

Conclusion: The minimal requirement is two HTTP requests. A single persistent connection to the server can carry both requests, so the statement that one TCP connection is sufficient is correct.

Explore the full course: Gate Guidance By Sanchit Sir