Final Exam Flashcards

1
Q

Concerning web development, MDN is an acronym for:

A

Mozilla Developer Network

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

Which of the following is NOT an integrated development environment (IDE)?

A

Git Bash

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

To begin using git with a project, the first command you should issue is:

A

git init

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

Which developer tool stores your project in an online code repository and allows you to share it with others?

A

GitHub

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

You can use git inside of Visual Studio Code

A

True

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

Which developer tool tracks each change to your project on your computer?

A

git

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

What option should always be included with the command git commit?

A

-m

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

The command line interface for git is called:

A

Git Bash

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

In the Visual Studio Code file tree, a file that has a U beside it indicates it has been uploaded by git.

A

false

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

After adding your file changes to your git repository with git add, what is the next step git requires?

A

git commit

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

Using the .slice() method, complete the following code so that it returns the last 4 characters of whatever value myString holds.
myString.slice(_____);

A

-4

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

What type of data will the following line of code return?
“taco cat”.indexOf(‘taco’, 1) !== -1;

A

boolean

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

Choose the result of:
“humpty” + 3 + 2 + “dumpty”;

A

humpty32dumpty

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

If I declare a variable like this:
let myInt;
It automatically has a value of zero.

A

false

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

let myName = “Dave”;
The letter “e” has an index position of 3.

A

true

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

Choose the result of:
2 + 3 + “foot” + “ball”;

A

5football

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

let myInt = 0;
myInt++;
The variable myInt is now equal to zero because zero plus zero is still zero.

A

false

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

I need to generate a random number between 1 and 50. Help me by filling in the blank to complete the equation.
_______(Math.random() * 50) + 1;

A

Math.floor

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

Javascript variables are named using ________.

A

camelCase

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

I need to return the remainder of 13 divided by 5. Which operator achieves the result I need?

A

%

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

Which statement in a for loop is required?
Select the best answer.

A

None - all for loop statements are optional.

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

Please fill-in the blank to complete the for loop below so it will execute the loop once for each letter in any name the user enters:
var myName = ‘any-name-entered’; //do not take this string literally - It should work for Dave or Harold or Sue or whoever enters their name.

for(var x = 0; x < ____; x++) { \ case-sensitive - no spaces please
console.log(myName[x]);
}

A

myName.length

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

You cannot have over five ELSE IF statements in your IF statement

A

false

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

It is easy to create an endless loop by mistake.
What should we add to the code block of the loop below to prevent it from being an endless loop?
Select ALL answers that will work (together if necessary) to prevent the loop from being an endless loop.
var x = 1;
while(x > 0) {
console.log(x);
}

A

A break statement
x++
An IF statement to check if x > 50

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

Select the answer that best completes this sentence:
A for loop has _____ optional parts (aka expressions and aka statements - depending on the source you read).

A

three

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

An IF, ELSE IF statement must end with an ELSE to execute if none of the previous conditions were true.

A

false

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

Fill-in the blank to complete the following ternary statement. Case-sensitive. No spaces please.
shipState !== “KS” __console.log(‘No Sales Tax.’) : console.log(“We need to add sales tax.’);

A

?

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

switch(cityName) {
case “Denver”:
console.log(‘MST’);
_____;
default:
console.log(‘CST’);
}

A

break

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

I need to construct an IF statement that checks if the value of x is divisible by 2.
Select the best answer to complete the IF statement with the desired outcome.
if(_____) {
console.log(x + ‘ is divisible by 2.’);
} else {
console.log(x + ‘ is NOT divisible by 2.’);
}

A

x % 2 === 0

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

An IF statement must include an ELSE to execute if the IF condition is false.

A

false

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

Variables created in the global scope may be used inside of a local scope.

A

true

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

const age = 30;
{
const isEven = (number) => {
return number % 2 === 0;
};
console.log(isEven(age));
}
Is the above valid code that will execute without an error?

A

true

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

In our Javascript file, we define the function called timesTen() below:
function timesTen(number) {
return number * 10;
}
Now we call the function in our file like this:
timesTen(5);
What output is in the console? Pick the best answer.

A

Nothing. The code does not attempt to send any output to the console.

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

Fill-in the blank to complete the function definition. Case-sensitive - no spaces please.
______multiply(a, b) {
return a * b);
}

A

function

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

What type of data will this function return when called on the variable myNum?
function overOneHundred(number) {
return number > 100;
}
var myNum = 50;

A

boolean

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

Built-in Browser functions are referred to as ______.

A

methods

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

When we know we will receive a value from a function, you could also say the function will ______ a value.
Select the best answer.

A

return

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

What is wrong with this function definition?
const myFirstName = “Dave”;
const myLastName = “Gray”;
function myFullName(first, last) {
return myFirstName + “ “ + myLastName;
}

A

Inside the function definition, you need to refer to the parameterswith the parameter names first and last instead of using specific variable names.

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

const sum = (num1, num2) => {
return num1 + num2;
}
console.log(sum(10));
What is output to the console?

A

NaN

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

const squared = function (number) {
return number * number;
}
How do you call this function with a parameter of 10?

A

squared(10);

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

const myCars = [“Camaro”, “Hummer”, “Mustang”, “Tesla”];
I want to replace the array element holding the string value “Tesla” with an array element holding the string value “Gremlin”.
Please complete the following line of code to help me achieve the desired result:
myCares.splice(________);

A

3, 1, “Gremlin”

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

let myDog = “Tyson”;
myDog = myDog.split(“”);
myDog = myDog.join();
console.log(myDog);
What is output to the console?

A

T,y,s,o,n

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

const myGuitars = [“Les Paul”, “Strat”, “SG”, “Tele”];
I want to log the element of the array that holds the “SG” string value to the console.
What goes in the blank to complete the line of code:
console.log(______);

A

myGuitars[2]

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

const myArray = [“Pepperoni”, 12.99, [“parmesanpackets”, “pepper packets”], [“napkins”, “paper plates”]];
How many dimensions is myArray?

A

2

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

Select ALL that can be stored in an array.

A

number
boolean
array
string

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

const myGuitars = [‘Strat’, ‘Les Paul’, ‘Tele’, ‘Explorer’, ‘Wolfgang’];
I execute the following line of code:
delete myGuitars[0];
What is the value of myGuitars[0] now?

A

undefined

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

I want to add the value “Gibson Explorer” to the end of an array.
Which method do I use?

A

.push()

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

const myTreble = [“Vocals”, “Guitar”];
const myBass = [“Bass”, “Drums”];
Complete the following line of code with the method that combines the above arrays into one new array named myBand:
const myBand = myTreble._____(myBass);

A

concat

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

const myArray = [“Supreme”, 16.99, [“parmesan packets”, “pepper packets”, “napkins”], “delivery”];
Which answer holds the string value “pepper packets”?

A

myArray[2][1]

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

const myData = [‘Dava’, ‘23’, ‘true’];
What type of data is in index position 1?

A

string

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

If I want to return the value of an object property, I must reference the ________ using dot or bracket notation.

A

key

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

const { name, major, gpa } = student;
Utilizing destructuring, I have just defined _________.

A

three variables from the properties within the student object.

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

To programmatically access the property value of an object with an iterator variable, you must use _______ notation.

54
Q

We can add new properties and methods to Child objects, and they will also have access to the properties and methods they inherit from their Parent objects.

55
Q

A function stored in an object is referred to as a ________.

56
Q

If you want to add new properties or methods to an object, you must define the object with the keyword let.

57
Q

const myDegreeMap = {
semester: {
spring21 : {
classes: [‘sociology’, ‘math’, ‘programming’]
}
}
};
Given the above object, how do I access the value “programming”?

A

myDegreeMap.semester.spring21.class[2];

58
Q

function myRide({ make, model, year }) {
console.log(I drive a ${year} ${make} ${model}.);
}
I have an object named myCar with multiple properties including make, model, and year.
How do I call the above function?

A

myRide(myCar);

59
Q

We can access object properties with __________. Select ALL that apply.

A

dot notation
bracket notation

60
Q

const guitars = {make: ‘Gibson’, model: ‘Les Paul’};
This is an example of creating a Javascript object with ________.

A

an Object literal

61
Q

In the video for JavaScript Classes, they are compared to a “blueprint” or _________ for creating objects.

62
Q

As a naming convention, what symbol has traditionally indicated a JavaScript property should be considered private?

A

_ (underscore)

63
Q

Which symbol indicates a private field declaration within a class?

64
Q

What keyword must be used when referring to properties in a class constructor?

65
Q

Using a Factory Function to create objects allows the objects to have __________.

A

private properties and privatemethods

66
Q

To construct a subclass based on a parent class, what keyword must be used in the declaration of the subclass?

67
Q

Identify the static JSON method:

68
Q

When receiving JSON, which JSON method converts the string data back into an object?

69
Q

To inherit the properties of a parent class, what keyword must be invoked in a subclass constructor?

70
Q

Instead of retrieving an object property value with dot notation, it is best practice to add a ________ method that retrieves the value.

71
Q

try {
throw new Error(‘This is a customerror.’);
}
catch(e) {
console.error(${e.name}: ${e.message});
}
//In the code above, what does e represent? Select ALL that apply.

A

the catchID
a parameter for the Catch block of code
the error object we created in the Try block of code

72
Q

We can create blocks of code for error handling… especially when working with user input.
Select ALL the code block names we use for error handling:

A

Catch
Try
Finally

73
Q

When we want our code to create an error, we use this keyword:

74
Q

Select ALL the Javascript error types that were discussed in our class video:

A

TypeError
ReferenceError
SyntaxError

75
Q

What keyword can we put in our code to pause its execution and instantly launch the developer console?

76
Q

Select the properties of an Error object instance. (standard and non-standard according to MDN are both valid here)

A

message
name
stack

77
Q

Which panel in Chrome DevTools allows you to debug JavaScript?

78
Q

Errors may only be displayed in the console with console.error()

79
Q

When debugging, Chrome DevToolsoffers many different types of _________.

A

breakpoints

80
Q

The first step in debugging your code is to _____________.

A

reproduce the bug

81
Q

I have a div with an id attribute of “divOne”. It is inside the body element.
I create a new div like this: var newDiv = document.createElement(‘div’);
I want to add my newDiv to the document AFTER divOne. Which line of code achieves my goal?

A

document.vody.appendChild(newDiv);

82
Q

I create a div element on my page. Inside the div element, I create a paragraph element.
When discussing the relationship of the div element to the paragraph element, the div is referred to as the ________of the paragraph.

83
Q

Select ALL of the things found within the Document Object Model (no partial credit):

A

nodes
whitespace
attributes
elements

84
Q

Which method will select only one element from the DOM?

A

document.getElementById()

85
Q

There are 5 paragraphs in the DOM. I need to change the text color of the 2nd paragraph to white.
Which line of code will achieve my goal?

A

document.getElementsByTagName(‘p’)[1].style.color = ‘white’;

86
Q

I have created a paragraph with javascript. I still need to create the text to go in it.
Which method do I use to create the text?

A

document.createTextNode()

87
Q

The HTML Document Object Model is often referred to as _________.

88
Q

The textContent property of an HTML element may contain HTML markup.

89
Q

I need to select every other div element inside a section element with the id attribute of “view1”.

A

document.querySelector(‘#view1 div:nth-of-type(2n)’)

90
Q

I need to select ALL of the paragraph elements int he DOM. Which method or methods will let me do this? (Select ALL that apply)

A

document.getElementsByTagName(‘p’)
document.querySelectorAll(‘p’)

91
Q

The addEventListener has 3 parameters: the event to lister for, the function to call, and optionall, the ________.

A

useCapture

92
Q

Look at the following line of code:
document.element.addEventListener(‘click’, function(event) {console.log(event.target)};
We are listening for the click event. When a click occurs, it calls the anonymous function. What is the event.target referring to?

A

Whichever element initially triggered the click event.

93
Q

Before calling an initApp() function, it is good practice to listen for the DOMContentLoaded event OR the ________ event of the document so we know the DOM elements we want to select exist.

A

readystatechange

94
Q

Which type of storage array may still be retrieved after we close our browser and then revisit the web app at another time?

A

localStorage

95
Q

I am adding a click event listener to a div. The div is a child of the body element.
The body element already has a click event. If I click on the div, the click event of the body will also occur.
Help me complete this code by filling the blank (exact match, case-sensitive) to prevent the click event of the body from firing.
document.myDiv.addEventListener(‘click’, function(e){
e._______________;
console.log(‘I hope you get it!’);
});

A

stopPropagation()

96
Q

When anevent triggers on the element that creates the event, and then moves outward to trigger the same event on a container element, it is called event _______.

97
Q

I have created a function named doTheStuff. Select the line of code that calls doTheStuff with a click event listener when the button is clicked:

A

button.addEventListener(“click”, doTheStuff, false);

98
Q

I have an HTML form. I want to apply form validation via JavaScript instead of letting the form submit right away. To keep this from happening, JavaScript lets me apply _________ to the submit event.

A

preventDefault()

99
Q

We use event listeners instead of putting JavaScript inline in our HTML elements. This separation of concerns is a principle of _________.

A

Unobtrusive JavaScript

100
Q

Look at the following line of code:
document.elem.addEventListener(‘click’,function(magic){console.log(‘abracadabra’)};
What does “magic” refer to?

A

the event object

101
Q

Which Section 508 requirement makes sure the coding of a website, software, operating systems, etc. is compatible with assistive technologies?

102
Q

The ______________specification adds the ability to modify and enhance the semantic meaning of elements in the DOM.

103
Q

The accessibility audit feature in Chrome Dev Tools is powered by ___________.

A

Lighthouse

104
Q

Section 508 compliance is required for all organizations that provide goods or services

105
Q

You can enable a screen reader in Chrome using the ______ extension

106
Q

Landmark elements are important for screen reader navigation. Select ALL of the landmark elements that help create “hot spots” on a web page.

A

nav
header
main

107
Q

SelectALL of the ways you can provide alternative text with ARIA

A

aria-labelledby
aria-label

108
Q

To be legally compliant with Section 508, a web site must meet how many “main” requirements?

109
Q

The _________ guidelines are organized around the POUR principles.

A

Web Content Accessibility

110
Q

Semantic HTML improves A11y

111
Q

Every function must be imported on a separate line.

112
Q

Select ALL higher order functions that return new arrays.

A

filter()
map()

113
Q

users.forEach(user => { console.log(user.id)});
The above code__________.

A

logs the user id property of every user object contained in the users array

114
Q

I receive user data in JSON format. I need to exclude all users under the age of 21.
What higher order function will I likely use to achieve this goal?

115
Q

I have a module with three functions: add(), subtract(), and multiply().
I want to import all three functions.
Select all of the correct statement to accomplish this.

A

__import * as Calculator from “./myFile.js”;
__import { add} from “./myFile.js”;
import { subtract } from “./myFile.js”;
import { multiply } from “./myFile.js”;
__import { add, subtract, multiply } from “./myFile.js”;

116
Q

users.forEach(user => { console.log(user.id) });
In the above code, what is the word user referring to?

A

An element in the users array.

117
Q

A module may have more than one default export.

118
Q

I receive user data in JSON format that has a field containing each user’s average monthly purchase amount. I need to create a new array from this data containing an annual purchase projection for each user by multiplying their average monthly purchase by 12.
What higher order function will I most likely use to achieve this goal?

119
Q

I receive user data in JSON format. I need to add all of the user ages together for a sum total as the first step for calculating an average age.
What higher order function will I likely use to achieve this goal?

120
Q

A module is required to have a default export.

121
Q

If I attempt to return the value of a fetch() call immediately without using a thenable or the await keyword, what will I receive?

A

A pending promise.

122
Q

By telling the receiving API what type of data we expect returned, we may receive different data. Where do we put this information in our fetch() call?

A

In the Accept property of the headers object.

123
Q

When using Fetch to request data, the optional second parameter Fetch accepts is a __________.

124
Q

When using Fetch to request data, the first parameter Fetch accepts is usually a ______________.

125
Q

The http POST method sends parameters in the API endpoint URL.

126
Q

You may await the resolution of more than one promise within an async function.

127
Q

Promises have how many possible states?

128
Q

Functions must be defined with the await keyword to use async within.

129
Q

The .json() method of the body mixin returns a _________

130
Q

A callback is a ____________ that is passed to a function as a parameter.