1) The DOM defines a number of ways to select elements, by using which of the following methods we can query a document for an element or elements.
i) with a specified id attribute
ii) with a specified name attribute
iii) with the specified tag name
iv) with the specified CSS class or classes
A. i, ii and iii only
B. i, ii and iv only
C. i, iii and iv only
D. All i, ii, iii and iv
2) We can select an element based on unique ID with the ........... method of the document object.
A. getElementById()
B. getElementsById()
C. selectElementById()
D. selectElementsById()
3) The ......... attribute is only valid on a handful or HTML elements, including forms, form elements, <iframe> and <img> elements.
A. id
B. name
C. tag
D. class
4) .......... return NodeList objects and properties like document.images and document.forms are HTML Collection objects.
A. getElementsByName() and getElementsById()
B. getElementsById() and getElementsByTagName()
C. getElementsByName() and getElementsByTagName()
D. getElementsByClassName() and getElementsByTagName()
5) Like getElementsByTagName(), .......... can be invoked on both HTML documents and HTML elements, and it returns a live NodeList containing all matching descendants of the document or element.
A. getElementsById()
B. getElementsByName()
C. getElementsByClassName()
D. All of the above
6) .......... takes a single string argument containing a CSS selector and returns a Nodelist that represents all elements in the document that match the selector.
A. getElementsById()
B. getElementsByName()
C. getElementsByClassName()
D. querySelectorAll()
7) ........... is the ultimate element selection method and very powerful technique by which client side JavaScript programs can select the document elements that they are going to manipulate.
A. querySelectAll()
B. querySelector()
C. querySelectorAll()
D. querySelect()
8) The CSS selector ............ selects any <span> descendant of the element with id="log".
A. #log span
B. #log>span
C. #log=span
D. #log:span
9) The CSS selector ............ selects any <span> child of the element with id="log".
A. #log span
B. #log>span
C. #log=span
D. #log:span
10) The CSS selector .......... selects all <div> elements plus the element with id="log".
A. div #log
B. div.#log
C. div>#log
D. div, #log
11) ........... defines properties for the universal HTTP attributes such as id, title lang, and dir and event handler properties like onClick.
A. Element properties
B. HTMLElement
C. HTMLProperty
D. HTMLAttribute
12) ......... are not case sensitive, but JavaScript property names are.
A. Element properties
B. HTML element
C. HTML property
D. HTML attributes
13) .............. methods can be used to query and set non standard HTML attributes and to query and set attributes on elements of an XML document.
A. getAttribute() and setAttribute()
B. getElement() and setElement()
C. getDocument() and setDocument()
D. getHTML() and setHTML()
14) HTML elements defines two methods ............ to check for the presence of named attribute and remove an attribute entirely.
A. getAttribute() and setAttribute()
B. hasAttribute() and removeAttribute()
C. hasDocument() and removeDocument()
D. hasElement() and removeElement()
15) For XML documents the include attributes from other namespaces, can use the namespace variants of which of the following method(s).
A. getAttributeNS()
B. setAttributeNS()
C. hasAttributeNS()
D. All of the above
Answers:
1) D. All i, ii, iii and iv2) A. getElementById()
3) B. name
4) C. getElementsByName() and getElementsByTagName()
5) C. getElementsByClassName()
6) D. querySelectorAll()
7) C. querySelectorAll()
8) A. #log span
9) B. #log>span
10) D. div, #log
11) B. HTMLElement
12) D. HTML attributes
13) A. getAttribute() and setAttribute()
14) B. hasAttribute() and removeAttribute()
15) D. All of the above
Related Posts:
Solved MCQ of JavaScript set-1
MCQ of JavaScript with Answer set-2
Solved MCQ on Basic Client Side JavaScript set-3
Solved MCQ on JavaScript Window Object set-4
Solved MCQ of CSS set-1
MCQ of CSS With Answer set-2
Objective Questions of CSS with Answer set-3
Solved Objective Questions of CSS set-4
Solved MCQ of Java Set-1
Solved MCQ of Java Beans set-1
Solved MCQ of Internet and HTML set-3
0 التعليقات: