1. Which property helps to initiate the HTTP requests?
2. Which method is an alternative of the property location of a window object?
Explanation: HTTP requests are initiated when a script sets the location property of a window object or calls the submit() method of a form object. In both cases, the browser loads a new page.
3. Which of the following uses scripted HTTP?
4. Which of the below is a liberal reverse of Ajax?
Explanation: Comet is the reverse of Ajax: in Comet, it is the web server that initiates the communication, asynchronously sending messages to the client. The big advantage of Comet is that each client always has a communication link open to the server.
5. The other name for Comet is _____________
a) Server Push
b) Ajax Push
c) HTTP Streaming
d) All of the mentioned
Explanation: Comet is a web application model where a request is sent to the server and kept alive for a long time, until a time-out or a server event occurs. Other names for Comet include “Server Push”, “Ajax Push”, “HTTP Streaming”.
6. Which is the element that has a src property to initiate HTTP GET request?
d) both img and script
Explanation: Both img and script contains the src property that can be set to initiate an HTTP GET request. The src property sets or returns the value of the src attribute of an image.The required src attribute specifies the URL of an image.
7. XMLHttpRequest is a ____________
c) Both Object and Class
Explanation: XMLHttpRequest is both an object and a class. The XMLHttpRequest object can be used to request data from a web server.
8. Which of the following are the features of an HTTP request?
a) URL being requested
b) Optional request body
c) Optional set of request headers
d) All of the mentioned
Explanation: An HTTP request consists of four parts :
- the HTTP request method or “verb”
- the URL being requested
- an optional set of request headers, which may include authentication information
- an optional request body
9. Which of the following is a feature of the HTTP response?
a) Mandatory response body
b) Optional response body
c) URL being released
d) Optional set of response headers
Explanation: The HTTP response sent by a server has three parts :
- a numeric and textual status code that indicates the success or failure of the request
- a set of response headers
- the response body
10. Which is the appropriate code to begin a HTTP GET request?
a) request.open("GET","data"); b) request.open(GET,"data.csv"); c) request.open("GET","data.csv"); d) request.open("GET");
Explanation: The code that begins a HTTP GET request for the contents of the specified URL is
To send a request to a server open() and send() methods of the XMLHttpRequest object are used.