Javascript Quiz
  

Q.Which statement accesses HTML classes?

  • getElementById
  • class.name
  • getElementsByClassName

Q.By modifying the DOM, the contents on the page also gets modified

  • False
  • True

Q.Using HTML button tag, JavaScript command can be executed by using ____ function

  • "alert('Button");"
  • "alert('Button1');
  • "alert(Button1);"

Q.Document object is part of ____ object

  • Window
  • Tree
  • System

Q.For any structured document, _____ defines a standard set of objects

  • Core DOM
  • XML DOM
  • HTML DOM

Q.Which is the most preferred way of handling events?

  • Register a listener to an element
  • Referencing an element with the event and assign a function as a value
  • Writing the JavaScript as an attribute to an element

Q.How many 'onload' events can be written in a page

  • Many
  • 1
  • 2
  • None

Q.The data from the AJAX request is usually in XML. True or False?

  • True
  • False

Q.AJAX requests can support data transfer in ______ format

  • XML
  • None of the options
  • Any
  • JSON

Q._____ object is used to make calls and request data from server

  • GET
  • XML
  • XMLHttpRequest

Q.You want to create an alert. Select the correct one

  • alert("goodbye');
  • alert('goodbye");
  • alert('he said "goodbye" ');

Q.What is the output for the following function test(x) { while(x < 5) { x++; } return x; } alert(test(2));

  • 5
  • 3
  • 6
  • 2

Q.var i = 1; if (function f(){}) { i += typeof f; } x;

  • 1undefined
  • Error
  • 1NaN
  • 1

Q.____ is used to exit a loop early.

  • Break
  • Alert
  • Exit
  • Continue

Q.What is the output for the following code (function f(){ function f(){ return 1; } return f(); function f(){ return 2; } })();

  • Error
  • 2
  • 1
  • NaN

Q.Anonymous functions can be created in JavaScript. What do anonymous function do?

  • Process a variable before passing it on to another function
  • Automatically define the scope of a value inside a parameter
  • Overwrite variables that are to be kept updated

Q.Your div element in a document has id="answers". If a JS fn sets d=document.getElementById("answers"), then which is the preferred way to add a paragraph containing the word "Hello" as a child of that div?

  • answers.innerHTML = "Hello";
  • d.innerHTML = "Hello ";
  • d.appendChild("Hello ");
  • p = createElement("p"); p.innerHTML = "Hello"; d.appendChild(p);

Q.Multiple variables can be created and initialized in a single JavaScript statement

  • True
  • False

Q.Which is the correct way to create an array in JavaScript? I) var myProg = []; II) var myArray = ["C","Java","C++","Python"]; III) var myProg = new Array();

  • I, II
  • II & III
  • I, II & III
  • I, III

Q.Code A: var x = 10; y = --x + 1; alert(y); Code B: var x = 10; y = x-- + 1; alert(y); What is the output for code A and B?

  • 10,10
  • 11,10
  • 10,11
  • 11,11

Q.What option would you specify when inserting code in a web page? script type="____"

  • JavaScript/text
  • text/language
  • text/JavaScript

 
Institute Finder



Enter Full Institute Name

Usefull Links
© 2021 Eduforum. All Rights Reserved.

Enter login details.

UserName Password

Recover Password

Enter your Registered Email Address to receive new password.
Subscribe Newsletter