Document Object Model And Event Handling(Javascript ) Questions and Answers

Question 1. Which property helps to initiate the HTTP requests?
  1.    request
  2.    location
  3.    send
  4.    none of the mentioned
Explanation:-
Answer: Option B. -> location
It is possible for JavaScript code to script HTTP, however. 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.

Question 2. Which of the below is a lieral reverse of Ajax?
  1.    HTTP
  2.    HTML
  3.    XML
  4.    Comet
Explanation:-
Answer: Option D. -> Comet
Comet is the reverse of Ajax: in Comet, it is the web server that initiates the communication, asynchronously sending messages to the client.

Question 3. The other name for Comet is
  1.    Server Push
  2.    Ajax Push
  3.    HTTP Streaming
  4.    All of the mentioned
Explanation:-
Answer: Option D. -> All of the mentioned
Other names for Comet include “Server Push”, “Ajax Push”, “HTTP Streaming”.

Question 4. Which method is an alternative of the property location of a window object?
  1.    submit()
  2.    locate()
  3.    load()
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> submit()
It is possible for JavaScript code to script HTTP, however. 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.

Question 5. Which of the following uses scripted HTTP?
  1.    XML
  2.    HTML
  3.    Ajax
  4.    All of the mentioned
Explanation:-
Answer: Option C. -> Ajax
The key feature of an Ajax application is that it uses scripted HTTP to initiate data exchange with a web server without causing pages to reload.

Question 6. The URL property belongs to which of the following object?
  1.    Document
  2.    Element
  3.    Location
  4.    All of the mentioned
Explanation:-
Answer: Option A. -> Document
The Document object has a URL property, which is a static string that holds the URL of the document when it was first loaded.

Question 7. What does the location property represent?
  1.    Current DOM object
  2.    Current URL
  3.    Both DOM object and URL
  4.    None of the mentioned
Explanation:-
Answer: Option A. -> Current DOM object
The location property of a window is a reference to a Location object; it represents the current URL of the document being displayed in that window.

Question 8. Which among the following is not a property of the Location object?
  1.    protocol
  2.    host
  3.    hostee
  4.    hostname
Explanation:-
Answer: Option C. -> hostee
The various properties of the location object are the protocol, host, hostname, port, search, and hash.

Question 9. What is the return type of the hash property?
  1.    Query string
  2.    Packets
  3.    String
  4.    Fragment identifier
Explanation:-
Answer: Option D. -> Fragment identifier
The hash property returns the “fragment identifier” portion of the URL, if there is one: a hash mark (#) followed by an element ID.

Question 10. What is the function used to extract arguments from the search property of a URL?
  1.    urlArgs()
  2.    url()
  3.    hash()
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> urlArgs()
The urgArgs() function can be used to extract arguments from the search property of a URL.