Week 7 Quiz Multiple Choice Flashcards

1
Q

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
A

Compares value equality as well as data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which is not a JavaScript data type?

Number
String
Boolean
Function
Object
Null
Undeclared
A

Undeclared

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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"]
A

var colors = [“red”, “green”, “blue”]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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!”;

A

document.getElementById(“demo”).innerHTML = “Hello World!”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does DOM stand for?

Document Object Model

Documented Object Model

Document Objective Modeling

Dormant Object Model
A

Document Object Model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following gets an HTML element with ID = “Main”

document.getElementById(“Main”);

document.getElementWithId(“Main”);

window.getElementById(“Main”);

document.parseForId(“Main);

A

document.getElementById(“Main”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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”>

A

< script src=”my.js”>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How many elements does the following array have
[1,2,’3’]

1

2

3

FALSE
A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which method do you call to output information to the Developer’s Console?

console.log

console.print

console.talk

console.out
A

console.log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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(){?});

A

elem.addEventListener(“click”, function(){?});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

JSON stands for

Java Object Notes

JavaScript Objective Notation

JavaScript Object Notation

Java Objective Notation
A

JavaScript Object Notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following methods of the JSON object will convert data from a string to an object.

stringify()

parse()

convertString()

convertObject()
A

parse()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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.
A

Search for a variable with a provided name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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.
A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

JSON parsing

How would you convert an object to JSON in JavaScript?

JSON.parse(obj)

JSON.stringify(obj)

obj.jsonParse()

obj.jsonStringify()
A

JSON.stringify(obj)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

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
A

var defines a normal (pre-ES6) variable, let defines a block-scoped variable, const defines a constant whose reference cannot change

17
Q

JavaScript
___ defines the content of web pages.

HTML

CSS

JavaScript

C#
A

HTML

18
Q

JavaScript
(Mark all that are correct) Javascript is ___.

prototype-based

single-threaded

case-sensitive

multi-threaded
A

single-threaded

case-sensitive
19
Q

What does HTML stand for?

Hyper Text Markup Language

Hyperlinks and Text Markup Language

Home Tool Markup Language

Hyper Tool Markup Language
A

Hyper Text Markup Language

20
Q

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”>

A

< img src=”image.gif” alt=”MyImage”>

21
Q

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
A

Document declaration, html, head and body elements

22
Q

How would I select all elements with the class “intro” using CSS?

#intro

class="intro"

.intro

intro
A

.intro

23
Q

How would I select the element if its id were “intro” using CSS?

*intro

#intro

.intro

intro
A

intro

24
Q

CSS stands for

Cascading Sample Sheets

Colorful Style Sheets

Cascading Style Sites

Cascading Style Sheets
A

Cascading Style Sheets

25
Q

A CSS selector is

a special keyword in CSS

the name of a styling option which we can modify.

an assignable value for a property.

a string of text used to target elements in an HTML document
A

a string of text used to target elements in an HTML document

26
Q

A CSS property is

a special keyword in CSS

the name of a styling option which we can modify.

an assignable value for a property.

a string of text used to target elements in an HTML document
A

the name of a styling option which we can modify.

27
Q

What HTML element allows for internal CSS to be added to the HTML page?

< style>

< css>

< head>

< body>

A

< style>

28
Q

Which CSS property controls the text size?

font-size

font-style

text-style

text-size
A

font-size

29
Q

Which of the following is correct about CSS?

CSS is used to control the style of a web document in a simple and easy way.

CSS is the acronym for "Cascading Style Sheets".

You can write CSS once and then reuse same sheet in multiple HTML pages.

All of the above.
A

All of the above.
Explanation : All of the above options are correct.

30
Q

What does the “this” keyword do in JavaScript?

refers to the invoking function or object to which it is attached

always refers to the global scope

you can never be sure what it will refer to

a special function that will create a new object
A

refers to the invoking function or object to which it is attached

31
Q

Which of the following is an inline element.

< div >

< span >

< ul >

< article >

< section >
A

< span >

32
Q

Which element displays a title in the tab of the browser?

< !doctype >

< title >

< head >

< body >
A

< title >