Javascript (JS) DOM MCQ
This section focuses on the "Javascript DOM" of the Javascript. These Multiple Choice Questions (mcq) should be practiced to improve the Javascript skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. What among the following is an appropriate event handler for input text among the below options ?
A. onclick
B. onchange
C. onkeyup
D. onblur
View Answer
Ans : B
Explanation: This option is correct, because whenever the user enters some value the action should be taken.
2. What among the following is an appropriate when an event occurs when the user clicks on an element?
A. onclick
B. onchange
C. onkeyup
D. onblur
View Answer
Ans : A
Explanation: The onclick JavaScript event occurs when the user clicks on an element. It runs a specified line of code when you click a HTML object that has the onclick attribute.
3. Consider the below code:
Identify the correct code in order to fetch the value entered in username text field?
< body>
< form name="register">
Enter username < input value="John" id="name" name="username">
< /form>
< /body>
A. document.register.name.value
B. document.getElementById ("name").value
C. document.getElementByName ("name").value
D. None of the above
View Answer
Ans : B
Explanation: This option is correct, because we can get the value with the help of DOM method getElementById().
4. Consider the below code:
Identify the correct code in order to fetch the value entered in username text field?
< body>
< form name="login">
Enter Your Name< input value="Akash" id="p_name" name="uname">
< /form>
< /body>
A. document.login.uname.value
B. document.getElementById ("p_name").value
C. document.getElementByName ("name").value
D. Both A and B
View Answer
Ans : D
Explanation: This option is correct, because we can get the value with the help of DOM method getElementById() and we can get the value with the help of form name and the name of the corresponding field.
5. Which of the following statements is/are TRUE about DOM?
A. W3C standard
B. Each page can have multiple Document objects
C. form elements can be accessed using the form object
D. Both A and C
View Answer
Ans : D
Explanation: This option is correct, because W3C Web Applications Working Group has taken over responsibility for the Document Object Model specifications and we can access the form elements with the help of form objects (formObject.formelementname).
6. What is the full form DOM?
A. Document Object Model
B. Document Onhalt Model
C. Document Oriented Model
D. Document Oriented Management
View Answer
Ans : A
Explanation: Document Object Model is the full form DOM.
7. What is the purpose of the Legacy DOM?
A. Modify the nodes
B. Making the script modular
C. Allows access to few keys and elements
D. Makes the scripting easier
View Answer
Ans : C
Explanation: The Legacy DOM: This is the model which was introduced in early versions of JavaScript language. It is well supported by all browsers but allows access only to certain key portions of documents, such as forms, form elements, and images.
8. What is the purpose of the NamedNodeMap object?
A. Unordered collection of arrays
B. Unordered collection of elements
C. Unordered collection of nodes
D. Unordered collection of attributes
View Answer
Ans : C
Explanation: In the HTML DOM, the NamedNodeMap object represents an unordered collection of an elements attribute nodes. The nodes in the NamedNodeMap can be accessed through their name.
9. Which object is the top of the hierarchy?
A. Form Control Elements
B. Document Object
C. Form Object
D. Window Object
View Answer
Ans : D
Explanation: The DOM is arranged in the form of tree with every node as an object. Window object is the top of the hierarchy. It is the outmost element of the object hierarchy.
10. How are the objects organized in the HTML DOM?
A. list
B. stack
C. queue
D. Hierarchy
View Answer
Ans : D
Explanation: The HTML DOM model is constructed as a tree of Objects. The objects are organized in the hierarchy format in the HTML DOM.
11. In Javascript, DOM stands for?
A. Document Oriented Model
B. Document Object Method
C. Document Object Model
D. Document Optimized Model
View Answer
Ans : C
Explanation: When a web page is loaded, the browser creates a Document Object Model of the page.
12. The DOM is a ____________ standard.
A. WWW
B. W3C
C. W3B
D. WMB
View Answer
Ans : B
Explanation: The DOM is a W3C (World Wide Web Consortium) standard.
13. The W3C DOM standard is separated into _____ different parts
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : C
Explanation: The W3C DOM standard is separated into 3 different parts: Core DOM, XML DOM and HTML DOM.
14. _________ standard model for all document types.
A. Core DOM
B. XML DOM
C. HTML DOM
D. None of the above
View Answer
Ans : A
Explanation: Core DOM : standard model for all document types
15. The HTML DOM is a standard object model and programming interface for HTML.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, The HTML DOM is a standard object model and programming interface for HTML.
Also check :
Discussion