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:
- Creating animations and other visual effects to subtly guide a user and help with page navigation
- 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
