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)
ES6 syntax
What is the difference between var, let, and const?
var defines a block-scoped variable, let defines a normal variable, const defines a constant whose reference cannot change var defines an object, let defines an array, const declares a function var defines a normal (pre-ES6) variable, let defines a block-scoped variable, const defines a constant whose reference cannot change var was introduced in ES6 to define a block-scoped variable, let is like an assert statement, const defines an array
var defines a normal (pre-ES6) variable, let defines a block-scoped variable, const defines a constant whose reference cannot change
JavaScript
___ defines the content of web pages.
HTML CSS JavaScript C#
HTML
JavaScript
(Mark all that are correct) Javascript is ___.
prototype-based single-threaded case-sensitive multi-threaded
single-threaded
case-sensitive
What does HTML stand for?
Hyper Text Markup Language Hyperlinks and Text Markup Language Home Tool Markup Language Hyper Tool Markup Language
Hyper Text Markup Language
What is the correct HTML for inserting an image?
< img src=”image.gif” alt=”MyImage”>
< image src=”image.gif” alt=”MyImage”>
< img alt=”MyImage”>image.gif
< img href=”image.gif” alt=”MyImage”>
< img src=”image.gif” alt=”MyImage”>
What elements do you need for a bare bones HTML page?
Document declaration, html, head and body elements Document Declaration, head, and body elements Document Declaration and html element Document Declaration and body element
Document declaration, html, head and body elements
How would I select all elements with the class “intro” using CSS?
#intro class="intro" .intro intro
.intro
How would I select the element if its id were “intro” using CSS?
*intro #intro .intro intro
intro
CSS stands for
Cascading Sample Sheets Colorful Style Sheets Cascading Style Sites Cascading Style Sheets
Cascading Style Sheets