250+ TOP MCQs on Client-Side JavaScript and Answers

Javascript Multiple Choice Questions on “Client-Side JavaScript”.

1. The main purpose of JavaScript in web browser is to ___________
a) Creating animations and other visual effects
b) User Interface
c) Visual effects
d) User experience
Answer: a
Clarification: JavaScript can help to facilitate that experience, for example by:

  1. Creating animations and other visual effects to subtly guide a user and help with page navigation
  2. Sorting the columns of a table to make it easier for a user to find what she needs

2. A JavaScript program can traverse and manipulate document content through __________
a) Element Object
b) Document Object
c) Both Element and Document Object
d) Data object
Answer: c
Clarification: A JavaScript program can traverse and manipulate document content through the Document object and the Element objects it contains. It can alter the presentation of that content by scripting CSS styles and classes. The Element object represents an HTML element, like P, DIV, A, TABLE, or any other HTML element.

3. The behaviour of the document elements can be defined by __________
a) Using document object
b) Registering appropriate event handlers
c) Using element object
d) Using data element
Answer: b
Clarification: The JavaScript program can define the behavior of document elements by registering appropriate event handlers. A JavaScript program can traverse and manipulate document content through the Document object and the Element objects it contains.

4. The service(s) that enables networking through scripted HTTP requests is __________
a) XMLHttpResponse
b) XMLRequest
c) XMLHttpRequest
d) XMLHttps
Answer: c
Clarification: The best known advanced services is the XMLHttpRequest object, which enables networking through scripted HTTP requests. The XMLHttpRequest object can be used to request data from a web server.

5. The HTML5 specification does not includes __________
a) Data storage
b) Graphics APIs
c) Other APIs for web apps
d) Networking
Answer: d
Clarification: The HTML5 specification (which, at the time of this writing, is still in draft form) and related specifications are defining a number of other important APIs for web apps. These include data storage and graphics APIs.The data storage api can store data locally within the user’s browser.

6. Which of the following is not an advanced services?
a) Data storage
b) Networking
c) XMLHttpRequest object
d) Graphics APIs
Answer: d
Clarification: Data storage is used to store data locally on user’s computer and networking is used for connecting between different platforms.

7. JavaScript code between a pair of “script” tags are called __________
a) Non-inline
b) External
c) Referenced
d) Inline
Answer: d
Clarification: The