Objects Flashcards

1
Q

The individual instructions in JavaScript are referred to as functions.

True or False?

A

False

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

Which of the following is the proper symbol to reference at the beginning of a section of comments that includes multiple lines?

//

*/

/*

(/)

A

/*

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

You need to write code that will increase the value of a variable by 5. Which of the following is valid? Choose all that apply.

=+5

+=5

++5

+5

A

+=5 and +5

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

Which of the following operators is used to reduce the amount of code that would normally be required for an IF statement in JavaScript?

Ternary

Equality

Numeric

Data

A

Ternary

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

Which of the following loops is preferred due to a decreased amount of code to execute the same functionality?

For

If

While

Do while

A

For

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

Which of the following is not accurate syntax?

Function myFunction()

function myFunction()

new function ()

new object()

A

function myFunction()

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

Given the following array, var cars = [“Volvo”, “Mazda”, “Toyota”] how would you access the value of Mazda?

Cars[Mazda]

Cars[2]

Cars[3]

None of the above

A

None of the above

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

Which of the following uses the best practices for casing in JavaScript?

myVariableName

myFUNCTION

MyFunctionName

MyFunctionName

A

myVariableName

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

In a JavaScript IF statement the parentheses indicate the code to be executed if the condition evaluates to True.

True or False?

A

False

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

Which option is available to prevent code developers from having to write large if statements that have multiple else if clauses?

Slice

For loop

Do…while

Switch

A

Switch

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

To create a loop or iteration you can simply replace the word if with which of the following?

Function

Variable

While

For

A

While

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

Which of the following is the most frequently used type of loop?

If

While

Do…while

For

A

For

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

Which of the following is incredibly important when creating a loop to ensure that you don’t write an infinite loop?

Check the condition

Increment the variable

Set the index

None of the above

A

Increment the variable

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

You want to create a reusable section of JavaScript code that you can associate with an object. What keyword should you use to begin?

Formula

Method

Function

Property

A

Function

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

Which of the following keywords will terminate the current iteration of the loop when it is encountered but not the loop itself?

Break

Continue

Switch

End

A

Continue

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

When you are working with external JavaScript files the files themselves do not contain script tags.

True or False?

A

True

17
Q

Which of the following would be the proper syntax for writing an alert that said: “Welcome to JavaScript”?

msgBox(“Welcome to javaScript”)

alert(“Welcome to javaScript”)

alertBox(“Welcome to javaScript”)

window.show(“Welcome to javaScript”)

A

alert(“Welcome to JavaScript”)

18
Q

What is the appropriate syntax for creating a function in JavaScript?

function:myFunction;

function myFunction ()

function:myFunction()

function = myFunction()

A

function myFunction ()

19
Q

Once a function has been declared what is the next step to using that function?

Invoking it

Defining it

Methodizing it

Using it as an object property

A

Invoking it

20
Q

Which of the following is not accurate syntax?

var b = “This is a string”

var c = “This is a string”

var a = “This is a string

a = “This is a string”

A

var a = “This is a string