The Gateway to Computer Science Excellence
+9 votes

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. $Q$ needs to send at least 2 HTTP requests to $S$, each necessarily in a separate TCP connection to server $S$
  2. $Q$ needs to send at least 2 HTTP requests to $S$, but a single TCP connection to server $S$ is sufficient 
  3. A single HTTP request from $Q$ to $S$ is sufficient, and a single TCP connection between $Q$ and $S$ is necessary for this
  4. A single HTTP request from $Q$ to $S$ is sufficient, and this is possible without any TCP connection between $Q$ and $S$
in Web Technologies by Veteran (105k points) | 2k views

i think answer should be A. this is because, it has explicitly been mentioned that no caching is there. this means that as soon as 1st request is processed, the server closes the connection right then. so client has to establish a new TCP connection, and consequently send a new http request. reference for the link is below.

3 Answers

+13 votes
Best answer
A separate HTML request must be send for each image or component in HTML like css file of js. But all can be done in same connection. So, (B) is the answer.
by Veteran (431k points)
selected by
sir by default HTTP is persistent, if it is given non-persistent HTTP then what about TCP

It seems to be correct what you have written. BUT


In question it is given that HTML page has exactly one image.

So we need exactly one single request.

But It seems that my claim doesn't match with correct answer.

So provide insight where my observation or logic needs more clarity.


Do graphical browers use persistent connection ?
@Arjun sir,

Why not option c..i.e a single request from q to s is sufficient.
why not option c?
Why at least 2 http request is required when we have only one static embedded image on server?
+3 votes
Whenever a browser opens a webpage, it makes a separate request for each object of page like image, css, javascript, etc. However if multiple resources are served from same server, then one TCP connect is sufficient.
by Loyal (9.9k points)
Whenever browser open a web page it will require multiple requests for multiple objects and they are served from same server than one tcp connection is enough for that.
copied  from GeeksforGeeks
+1 vote

The answer is B.

Firstly, Q makes a TCP connection with S. 

After that, it sends the first request for the webpage. When it is received, it sees that there is also an image which needs to be picked up, so it makes another request to S for the image.

Then it may close the TCP connection. 

This is how it is done if we are using HTTP version 1.1( which is always used now). One connection, also called HTTP persistent connection, is enough to make several requests on the same server.

So, the answer is B.

Before 1.1, there used to be non-persistent connections wherein a client had to make and close N connections for N different requests. 


by (409 points)
edited by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,313 answers
105,051 users