GoConqr has a new look! Let us know what you think.

Quiz

JavaScript Dom and Events

Junaid Khan 60 questions Updated 4 Dec 2017

Take the quiz

This quiz has a time limit, so it opens in the usual player.

Questions in this quiz (60)

  1. 1Consider the following HTML and JS code. What is the value of pars.length?
    <body>
    <p> Paragraph 1 </p>
    <div id="myDiv">
    <p> Paragraph 2 </p>
    </div>
    </body>
    var myDiv=document.getElementById("myDiv");
    var pars=myDiv.getElementsByTagName("p");
    1. A0
    2. B2
    3. C1
    4. D3
  2. 2Consider the following HTML and JS code. What is the value of pars.length?
    <body>
    <p> Paragraph 1 </p>
    <div id="myDiv">
    <p> Paragraph 2 </p>
    </div>
    </body>
    var myDiv=document.getElementById("myDiv");
    var pars=document.getElementsByTagName("p");
    1. A0
    2. B1
    3. C3
    4. D2
  3. 3In the Prototype library, the $("p") function is equivalent to?
    1. Adocument.createElement("p");
    2. Bdocument.getElementsByTagName("p");
    3. Cdocument.getElementById("p");
    4. Ddocument.getElementByTagName("p");
  4. 4In JavaScript, does the DOM tree include the head section of the HTML page?
    1. AYes
    2. BNo
  5. 5Based on the following JS code which variable is local scoped?
    var a=10;
    function myFunc() {
    var c=document.getElementById("myPar");
    }
    1. Adocument
    2. Ba
    3. Cc
    4. Dboth a and c
  6. 6var myP = document.getElementById("myP");
    myP.children[1].style.backgroundColor = "silver";
    1. ASets the background color to silver of the third child of element id="myP"
    2. BSets the background color to silver of the first child of element id="myP"
    3. CModifies all children of elemetn id="myP"
    4. DSets the second child of element id="myP" background to silver
    5. ESets the element id="myP" background to silver
  7. 7In Javascript, if you wanted to set a timer that calls function "myFunc" every second, which statement would you use?
    1. AsetInterval(1000, myFunc);
    2. BsetRepeat(myFunc, 1000);
    3. CsetInterval(myFunc, 1000);
    4. DsetTimeout(myFunc, 1000, REPEAT);
    5. EsetTimeout(myFunc, 1000);
  8. 8In JavaScript, what command can be used to remove a node from the DOM tree?
    1. Adocument.deleteChild(...)
    2. Bdocument.removeChild(...)
    3. Cdocument.killChild(...)
    4. Ddocument.unappendChild(...)
  9. 9Consider the following HTML code as a DOM tree:
    <div id="myDiv>
    <h1> Hello </h1>
    <p> This is a test. </p>
    <p> This is only <a myid="a" href=""> a test. </a> </p>
    <p> There will be one more test. </p>
    </div>

    Is the element myid="a" a child of the div element?
    1. Ayes
    2. Bno
  10. 10Consider the following HTML code as a DOM tree:

    <div id="myDiv">
    <h1> Hello </h1>
    <p> This is a test. </p>
    <p> This is only <a href=""> a test. </a> </p>
    <p> There will be one more test. </p>
    </div>
    Is the h1 element an ancestor of the element <a>?
    1. Ayes
    2. Bno

Information

Description
EECS 1012- Quiz on JavaScript Dom and Events, created by Junaid Khan on 03/12/2017.
Language
English
Views
1
History
Created on 3 Dec 2017 · updated on 4 Dec 2017
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?