Final Exam Flashcards

(130 cards)

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
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).
three
26
An IF, ELSE IF statement must end with an ELSE to execute if none of the previous conditions were true.
false
27
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.');
?
28
switch(cityName) { case "Denver": console.log('MST'); _____; default: console.log('CST'); }
break
29
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.'); }
x % 2 === 0
30
An IF statement must include an ELSE to execute if the IF condition is false.
false
31
Variables created in the global scope may be used inside of a local scope.
true
32
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?
true
33
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.
Nothing. The code does not attempt to send any output to the console.
34
Fill-in the blank to complete the function definition. Case-sensitive - no spaces please. ______multiply(a, b) { return a * b); }
function
35
What type of data will this function return when called on the variable myNum? function overOneHundred(number) { return number > 100; } var myNum = 50;
boolean
36
Built-in Browser functions are referred to as ______.
methods
37
When we know we will receive a value from a function, you could also say the function will ______ a value. Select the best answer.
return
38
What is wrong with this function definition? const myFirstName = "Dave"; const myLastName = "Gray"; function myFullName(first, last) { return myFirstName + " " + myLastName; }
Inside the function definition, you need to refer to the parameterswith the parameter names first and last instead of using specific variable names.
39
const sum = (num1, num2) => { return num1 + num2; } console.log(sum(10)); What is output to the console?
NaN
40
const squared = function (number) { return number * number; } How do you call this function with a parameter of 10?
squared(10);
41
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(________);
3, 1, "Gremlin"
42
let myDog = "Tyson"; myDog = myDog.split(""); myDog = myDog.join(); console.log(myDog); What is output to the console?
T,y,s,o,n
43
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(______);
myGuitars[2]
44
const myArray = ["Pepperoni", 12.99, ["parmesanpackets", "pepper packets"], ["napkins", "paper plates"]]; How many dimensions is myArray?
2
45
Select ALL that can be stored in an array.
number boolean array string
46
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?
undefined
47
I want to add the value "Gibson Explorer" to the end of an array. Which method do I use?
.push()
48
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);
concat
49
const myArray = ["Supreme", 16.99, ["parmesan packets", "pepper packets", "napkins"], "delivery"]; Which answer holds the string value "pepper packets"?
myArray[2][1]
50
const myData = ['Dava', '23', 'true']; What type of data is in index position 1?
string
51
If I want to return the value of an object property, I must reference the ________ using dot or bracket notation.
key
52
const { name, major, gpa } = student; Utilizing destructuring, I have just defined _________.
three variables from the properties within the student object.
53
To programmatically access the property value of an object with an iterator variable, you must use _______ notation.
bracket
54
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.
true
55
A function stored in an object is referred to as a ________.
method
56
If you want to add new properties or methods to an object, you must define the object with the keyword let.
false
57
const myDegreeMap = { semester: { spring21 : { classes: ['sociology', 'math', 'programming'] } } }; Given the above object, how do I access the value "programming"?
myDegreeMap.semester.spring21.class[2];
58
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?
myRide(myCar);
59
We can access object properties with __________. Select ALL that apply.
dot notation bracket notation
60
const guitars = {make: 'Gibson', model: 'Les Paul'}; This is an example of creating a Javascript object with ________.
an Object literal
61
In the video for JavaScript Classes, they are compared to a "blueprint" or _________ for creating objects.
template
62
As a naming convention, what symbol has traditionally indicated a JavaScript property should be considered private?
_ (underscore)
63
Which symbol indicates a private field declaration within a class?
#
64
What keyword must be used when referring to properties in a class constructor?
this
65
Using a Factory Function to create objects allows the objects to have __________.
private properties and privatemethods
66
To construct a subclass based on a parent class, what keyword must be used in the declaration of the subclass?
extends
67
Identify the static JSON method:
stringify
68
When receiving JSON, which JSON method converts the string data back into an object?
parse()
69
To inherit the properties of a parent class, what keyword must be invoked in a subclass constructor?
super
70
Instead of retrieving an object property value with dot notation, it is best practice to add a ________ method that retrieves the value.
getter
71
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.
the catchID a parameter for the Catch block of code the error object we created in the Try block of code
72
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:
Catch Try Finally
73
When we want our code to create an error, we use this keyword:
throw
74
Select ALL the Javascript error types that were discussed in our class video:
TypeError ReferenceError SyntaxError
75
What keyword can we put in our code to pause its execution and instantly launch the developer console?
debugger
76
Select the properties of an Error object instance. (standard and non-standard according to MDN are both valid here)
message name stack
77
Which panel in Chrome DevTools allows you to debug JavaScript?
Sources
78
Errors may only be displayed in the console with console.error()
false
79
When debugging, Chrome DevToolsoffers many different types of _________.
breakpoints
80
The first step in debugging your code is to _____________.
reproduce the bug
81
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?
document.vody.appendChild(newDiv);
82
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.
parent
83
Select ALL of the things found within the Document Object Model (no partial credit):
nodes whitespace attributes elements
84
Which method will select only one element from the DOM?
document.getElementById()
85
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?
document.getElementsByTagName('p')[1].style.color = 'white';
86
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?
document.createTextNode()
87
The HTML Document Object Model is often referred to as _________.
a tree
88
The textContent property of an HTML element may contain HTML markup.
false
89
I need to select every other div element inside a section element with the id attribute of "view1".
document.querySelector('#view1 div:nth-of-type(2n)')
90
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)
document.getElementsByTagName('p') document.querySelectorAll('p')
91
The addEventListener has 3 parameters: the event to lister for, the function to call, and optionall, the ________.
useCapture
92
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?
Whichever element initially triggered the click event.
93
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.
readystatechange
94
Which type of storage array may still be retrieved after we close our browser and then revisit the web app at another time?
localStorage
95
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!'); });
stopPropagation()
96
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 _______.
bubbling
97
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:
button.addEventListener("click", doTheStuff, false);
98
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.
preventDefault()
99
We use event listeners instead of putting JavaScript inline in our HTML elements. This separation of concerns is a principle of _________.
Unobtrusive JavaScript
100
Look at the following line of code: document.elem.addEventListener('click',function(magic){console.log('abracadabra')}; What does "magic" refer to?
the event object
101
Which Section 508 requirement makes sure the coding of a website, software, operating systems, etc. is compatible with assistive technologies?
technical
102
The ______________specification adds the ability to modify and enhance the semantic meaning of elements in the DOM.
WAI-ARIA
103
The accessibility audit feature in Chrome Dev Tools is powered by ___________.
Lighthouse
104
Section 508 compliance is required for all organizations that provide goods or services
true
105
You can enable a screen reader in Chrome using the ______ extension
ChromeVox
106
Landmark elements are important for screen reader navigation. Select ALL of the landmark elements that help create "hot spots" on a web page.
nav header main
107
SelectALL of the ways you can provide alternative text with ARIA
aria-labelledby aria-label
108
To be legally compliant with Section 508, a web site must meet how many "main" requirements?
3
109
The _________ guidelines are organized around the POUR principles.
Web Content Accessibility
110
Semantic HTML improves A11y
true
111
Every function must be imported on a separate line.
false
112
Select ALL higher order functions that return new arrays.
filter() map()
113
users.forEach(user => { console.log(user.id)}); The above code__________.
logs the user id property of every user object contained in the users array
114
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?
filter()
115
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.
__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
users.forEach(user => { console.log(user.id) }); In the above code, what is the word user referring to?
An element in the users array.
117
A module may have more than one default export.
false
118
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?
map()
119
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?
reduce()
120
A module is required to have a default export.
false
121
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 pending promise.
122
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?
In the Accept property of the headers object.
123
When using Fetch to request data, the optional second parameter Fetch accepts is a __________.
object
124
When using Fetch to request data, the first parameter Fetch accepts is usually a ______________.
URL
125
The http POST method sends parameters in the API endpoint URL.
false
126
You may await the resolution of more than one promise within an async function.
true
127
Promises have how many possible states?
3
128
Functions must be defined with the await keyword to use async within.
false
129
The .json() method of the body mixin returns a _________
promise
130
A callback is a ____________ that is passed to a function as a parameter.
function