Week 7 Quiz Multiple Choice Flashcards
What is === operator?
Compares equality and, if equal, assigns the value of the left operator to the value of the right Compares value equality as well as data type Basic assignment operator Basic comparison operator
Compares value equality as well as data type
Which is not a JavaScript data type?
Number String Boolean Function Object Null Undeclared
Undeclared
What is the correct way to write a JavaScript array?
var colors = 1 = ("red"), 2 = ("green"), 3 = ("blue") var colors = (1:"red", 2:"green", 3:"blue") var colors = "red", "green", "blue" var colors = ["red", "green", "blue"]
var colors = [“red”, “green”, “blue”]
demo.innerHTML = “Hello World!”;
What is the correct JavaScript syntax to change the content of the HTML element?
document.getElementByName(“demo”).innerHTML = “Hello World!”;
document.getElementById(“demo”).innerHTML = “Hello World!”;
document.getElement(“demo”).innerHTML = “Hello World!”;
document.getElementById(“demo”).innerHTML = “Hello World!”;
What does DOM stand for?
Document Object Model Documented Object Model Document Objective Modeling Dormant Object Model
Document Object Model
Which of the following gets an HTML element with ID = “Main”
document.getElementById(“Main”);
document.getElementWithId(“Main”);
window.getElementById(“Main”);
document.parseForId(“Main);
document.getElementById(“Main”);
What is the correct syntax for referring to an external script called “my.js”
< script> my.js
< script name=”my.js”>
< script href=”my.js”>
< script src=”my.js”>
< script src=”my.js”>
How many elements does the following array have
[1,2,’3’]
1 2 3 FALSE
3
Which method do you call to output information to the Developer’s Console?
console.log console.print console.talk console.out
console.log
Given the following, which of the following correctly binds the click event to an element?
< button id=”clicker” >Click Me< /button > … var elem = document.getElementById(“clicker”);
elem.addEventListener(“click”, function(){?});
elem.attachEventListener(“click”, function(){?});
elem.addEventListener(“mouseclick”, function(){?});
elem.attachEvent(“mouseclick”, function(){?});
elem.addEventListener(“click”, function(){?});
JSON stands for
Java Object Notes JavaScript Objective Notation JavaScript Object Notation Java Objective Notation
JavaScript Object Notation
Which of the following methods of the JSON object will convert data from a string to an object.
stringify() parse() convertString() convertObject()
parse()
Fetch API
Fetch can be used to:
Get a field value from an object. Extract data from a promise. Send an HTTP request. Search for a variable with a provided name.
Search for a variable with a provided name.
Which of the following is correct about messageListenerInterface attribute in @javax.ejb.MessageDrivenBean annotation?
It is used to specify name of the message driven bean. it is used to specify message listener interface for the message driven bean. It is used to specify the JNDI name of the message driven bean. It is used to specify the configuration details of the message-driven bean in operational environment of the message driven bean.
It is used to specify message listener interface for the message driven bean.
Explanation : messageListenerInterface attribute in @javax.ejb.MessageDrivenBean annotation is used to specify message listener interface for the message driven bean.
JSON parsing
How would you convert an object to JSON in JavaScript?
JSON.parse(obj) JSON.stringify(obj) obj.jsonParse() obj.jsonStringify()
JSON.stringify(obj)