π HTTP and World Wide Web protocol (8 MCQs)
HTTP as the Web's Application-Layer Exchange
The Hypertext Transfer Protocol (HTTP) enables web clients and servers to exchange representations of resources across an IP network. A browser sends requests for documents, images, scripts or other resources, and a web server returns responses describing the result. HTTP belongs to the application layer; it defines message semantics while lower layers provide transport, addressing and delivery. These shared semantics let different browsers and servers interoperate reliably across different operating environments.
Resources, URLs and ClientβServer Roles
A resource is identified by a Uniform Resource Identifier, commonly a URL containing a scheme, host and path. The client identifies the target and selects a method, while the server maps the request to a resource or application. Headers carry metadata such as content type, caching instructions and authentication information; the message body carries optional content.
Request and Response Message Processing
The client resolves the server name, establishes an appropriate transport connection, and sends an HTTP request. The server parses the method, target and headers, performs the requested operation, then returns a status code, response headers and possibly a representation. The client interprets the result and may request additional page resources through further exchanges.
Retrieving a Web Page from an Origin Server
When a browser requests https://example.com/index.html, it first obtains an IP address for example.com and establishes a protected connection. It sends a GET request for /index.html with a Host field in HTTP/1.1. A successful server response commonly carries status 200, a Content-Type field and the HTML document for rendering.
HTTP's Relationship with TCP, TLS and QUIC
HTTP commonly uses TCP for HTTP/1.1 and HTTP/2, with TLS protecting HTTPS sessions. HTTP/3 retains HTTP semantics but maps them over QUIC, which uses UDP. DNS helps locate the host, while TCP or QUIC transports messages and IP forwards packets; HTTP itself does not perform routing or link-level delivery.
Misunderstandings About Web Protocol Behavior
'HTTP encrypts every message by itself' is incorrect because encryption is supplied by HTTPS security using TLS or by the secure transport arrangement. 'HTTP remembers every user automatically' is false because HTTP semantics are stateless unless applications add state. 'A 404 means the server is offline' is wrong because it reports that the target resource was not found.
Interpreting HTTP Methods, Status Codes and Headers
Be able to distinguish a URL from an IP address, a request method from a status code, and a header from a message body. Interpret GET, POST, PUT and DELETE by their defined semantics; classify 2xx, 3xx, 4xx and 5xx responses; and explain how DNS, transport protocols and TLS support a web exchange without becoming HTTP functions.
HTTP and Web Communication Terms
- HTTP - Carries requests and responses for web resources.
- URL - Identifies a resource and its location.
- Method - Specifies the intended operation on a resource.
- Header field - Carries metadata about a message.
- Status code - Reports the result of request processing.
- Origin server - Hosts the requested resource.
π All HTTP and World Wide Web protocol MCQs
Q1. If a web page contains a hyperlink to another page on a different server, what is the most direct effect on the userβs request?
π Explanation: When the user clicks the link, the browser must locate the target resource. It does this by creating a new HTTP request directed at the server that hosts the linked page, using the URL provided. This request is independent of the original pageβs connection, so the correct effect is a new HTTP request to the target server.
Q2. Which of the following best compares the GET and POST methods when a web form includes a file upload?
π Explanation: GET places all form data in the query string of the URL, which is limited in length and visible to observers, so it cannot reliably carry large binary files. POST places the data in the request body, supporting arbitrarily large payloads and keeping the URL clean, making it the appropriate method for file uploads.
Q3. HTTP is described as a stateless protocol. Which mechanism most effectively allows a web application to maintain a userβs login state across multiple requests?
π Explanation: Because HTTP does not retain information between requests, the server issues a cookie containing a unique session identifier. The browser returns this cookie with each subsequent request, allowing the server to associate the request with the previously authenticated session. This approach preserves login state without violating HTTPβs stateless nature.
Q4. What does the acronym URL stand for?
π Explanation: The term URL is a standard abbreviation in web technology that means Uniform Resource Locator. It specifies the address used to access a resource on the Internet, indicating the protocol, host, and path needed to retrieve the resource.
Q5. A browser has cached a resource with ETag \abc123\. The server later updates the resource. The browser sends a conditional GET with If-None-Match \abc123\. What is the most likely server response?
π Explanation: When the server detects that the ETag supplied by the client does not match the current version of the resource, it knows the cached copy is stale. Consequently, it sends a fresh representation with a 200 OK status, providing the updated content to the browser.
Q6. Which statement best explains why HTTPS provides better security than HTTP?
π Explanation: HTTPS adds a TLS (or SSL) layer on top of HTTP, encrypting the entire request and response payload. This encryption protects data from eavesdropping, while TLS also provides authentication of the server and integrity checks, preventing tampering and manβinβtheβmiddle attacks.
Q7. In HTTP/1.1 persistent connections, which sequence correctly describes a client retrieving two resources from the same server without closing the connection?
π Explanation: HTTP/1.1 allows a single TCP connection to stay open for multiple requests. After establishing the connection, the client can issue a GET for the first resource, immediately follow it with a second GET for the next resource, and finally close the socket when all transfers are complete.
Q8. How does hypermedia extend the concept of hypertext in the modern Web?
π Explanation: Originally, hypertext referred only to linked textual documents. Modern hypermedia expands this idea by allowing any type of mediaβpictures, sound, video, and interactive contentβto be linked and retrieved via hyperlinks. This broader definition reflects the diverse nature of contemporary web pages, which often combine multiple media types in a single navigable experience.