Quiz Questions Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

on the “head” tag

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

Where do you put visible content about the HTML document?

A

on the “body” tag

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

Where do the “head” and “body” tags go in a valid HTML document?

A

between the “HTML” tags.

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

What is the purpose of a “DOCTYPE!” declaration?

A

for the browsers to know which type of HTML it is.

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

Give five examples of HTML element tags.

A

h1,h2,h3,p,span,head,body etc

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

What is the purpose of HTML attributes?

A

to give extra information about the HTML

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

Give an example of an HTML entity (escape character).

A

less than or greater than

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

How do block-level elements affect the document flow?

A

they take up the whole space/appear on the new line

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

How do inline elements affect the document flow?

A

they only take as much as they need/continue on the same line

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

What are the default width and height of a block-level element?

A

width: 100%
height: as much as needed

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

What are the default width and height of an inline element?

A

whatever is needed.

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

What is the difference between an ordered list and an unordered list in HTML?

A

Ordered list comes with numbering while unordered list comes with bullet point.

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

Is an HTML list a block element or an inline element?

A

it is a block element.

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

What HTML tag is used to link to another website?

A

“a” tag

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

What is an absolute URL?

A

actual location to the site

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

What is a relative URL?

A

relative path to the source. for instance, a source located on the same server but on a different level.

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

How do you indicate the relative link to a parent directory?

A

add “../” (go up one directory to parent)

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

How do you indicate the relative link to a child directory?

A

go directly in. just input the file name

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

How do you indicate the relative link to a grand parent directory?

A

add “../../”

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

How do you indicate the relative link to the same directory?

A

type the final file name

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

What is the purpose of an HTML form element?

A

group inputs together and utilization of the data. (collecting data)

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

Give five examples of form control elements.

A

adding text, choosing option, submitting form, uploading files, drop down

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

Give three examples of type attributes for HTML “input” elements.

A

password,text,radio

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

Is an HTML “input” element a block element or an inline element?

A

Inline

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

What are the six primary HTML elements for creating tables?

A

table, tr, td, th, thead, tbody, tfoot

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

What purpose do the thead and tbody elements serve?

A

allows us to style in different method, easier for people using screen reader.

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

Give two examples of data that would lend itself well to being displayed in a table.

A

schedules, tabular data

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

What are the names of the individual pieces of a CSS rule?

A

selector, declaration block

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

In CSS, how do you select elements by their class attribute?

A

adding a “.”

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

In CSS, how do you select elements by their type?

A

name itself

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

In CSS, how do you select an element by its id attribute?

A

add an hastag (you dont really wanna use id for css styling)

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

what are the three ways to specify color in CSS?

A

hex, rgb, built in value

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

What CSS properties make up the box model?

A

border, margin, padding

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

Which CSS property pushes boxes away from each other?

A

margin.

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

Which CSS property add space between a box’s content and its border?

A

padding.

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

What is a pseudo-class?

A

keyword added to a selector that specifies a special state of the selected element

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

What are CSS pseudo-classes useful for?

A

give added functionality.

more customization

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

Name at least two units of type size in CSS.

A

pixels, percentage,(r)em

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

What CSS property controls the font used for the text inside an element?

A

font-family

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

What is the default flex-direction of a flex container?

A

horizontal (row)

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

What is the default flex-wrap of a flex container?

A

no wrap

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

What is the default value for the position property of HTML elements?

A

static

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

How does setting position: relative on an element affect document flow?

A

no effect on doc flow

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

How does setting position: relative on an element affect where it appears on the page?

A

relative to where it would be (based on original place)

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

How does setting position: absolute on an element affect document flow?

A

moves it from the doc page

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

How does setting position: absolute on an element affect where it appears on the page?

A

attaches to the parents position

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

How do you constrain an absolutely positioned element to a containing block?

A

make the container non-static

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

What are the four box offset properties?

A

top bottom left right.

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

What is the purpose of variables?

A

to store information

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

How do you declare a variable?

A

var (name of var) = “”

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

How do you initialize (assign a value to) a variable?

A

assignment operator “= “

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

What characters are allowed in variable names?

A

_ , $ no numerals at the beginning / no space

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

What is the purpose of a number?

A

determining the values

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

What is the purpose of a boolean?

A

to determine which script should run.

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

What does the = operator mean in JavaScript?

A

equal. setting the value

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

How do you update the value of a variable?

A

set a new valuee

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

What does the = operator mean in JavaScript?

A

equal. setting the value / assignment operator

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

How do you update the value of a variable?

A

set a new value

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

What is the difference between null and undefined?

A

null: invalid object/ intentional empty value
undefined: no argument (type undefined) / unintentional no value.

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

Why is it a good habit to include “labels” when you log values to the browser console?

A

easy to go thru

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

What data type is returned by an arithmetic operation?

A

number

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

What is string concatenation?

A

adding two strings together

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

What purpose(s) does the + plus operator serve in JavaScript?

A

addition, concatenation

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

What data type is returned by comparing two values (, ===, etc)?

A

boolean value

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

What does the += “plus-equals” operator do?

A

x+=y ->

x = x+y

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

What are objects used for?

A

to model real life object

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

What are object properties?

A

variables within the object

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

Describe object literal notation.

A

var (name) = {

properties : value }

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

How do you remove a property from an object?

A

use delete operator

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

What are the two ways to get or update the value of a property?

A

. or []

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

What are arrays used for?

A

to store list of data

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

Describe array literal notation.

A

[ ]

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

How are arrays different from “plain” objects?

A

they have orders

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

What number represents the first index of an array?

A

0

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

What is the length property of an array?

A

measures the length of the array

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

How do you calculate the last index of an array?

A

array.length -1

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

What is a function in JavaScript?

A

object that can be called and execute the code block.

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

Describe the parts of a function definition.

A

function + name of the function + (parameters) {code block}

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

Describe the parts of a function call.

A

function name with ( )

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

When comparing them side-by-side, what are the differences between a function call and a function definition?

A

function definition defines the function, while calling the function actually execute the defined function.

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

What is the difference between a parameter and an argument?

A

parameter is the placeholder for the argument

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

Why are function parameters useful?

A

it could be modified

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

Why are function parameters useful?

A

it allows function to pass on

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

Why do we log things to the console?

A

to check the result

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

What is a method?

A

function which is a property of an object.

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

How is a method different from any other function?

A

built into the object

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

How do you remove the last element from an array?

A

pop()

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

How do you round a number down to the nearest integer?

A

math.round

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

How do you generate a random number?

A

math.random

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

How do you delete an element from an array?

A

splice

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

How do you append an element to an array?

A

push

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

How do you break a string up into an array?

A

split

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

Do string methods change the original string? How would you check if you weren’t sure?

A

no. and use console.log

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

Roughly how many string methods are there according to the MDN Web docs?

A

~40

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

Is the return value of a function or method useful in every situation?

A

no

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

Roughly how many array methods are there according to the MDN Web docs?

A

~30

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

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

MDN

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

Give 6 examples of comparison operators.

A

== , != , === , !==, >,

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

What data type do comparison expressions evaluate to?

A

boolean

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

What is the purpose of an if statement?

A

to see whether the condition is met

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

Is else required in order to use an if statement?

A

no

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

Describe the syntax (structure) of an if statement.

A

if (condition) {“code block”}

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

What are the three logical operators?

A

&& (both needs to be true)
|| (either one)
! (inverts the boolean value)

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

How do you compare two different expressions in the same condition?

A

logical operator

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

What is the purpose of a loop?

A

to check the condition and run til it meets the condition.

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

What is the purpose of a condition expression in a loop?

A

serves as a counter (how many time it will run)

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

What does “iteration” mean in the context of loops?

A

each execution

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

When does the condition expression of a while loop get evaluated?

A

before the condition expression

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

When does the initialization expression of a for loop get evaluated?

A

evaluated once before the iteration

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

When does the condition expression of a for loop get evaluated?

A

after the final expression.

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

When does the final expression of a for loop get evaluated?

A

after the iteration

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

Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?

A

break

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

What does the ++ increment operator do?

A

increment

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

How do you iterate through the keys of an object?

A

for .. in loop

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

What are the four components of “the Cascade”.

A

inheritance
source order
specificity
position

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

What does the term “source order” mean with respect to CSS?

A

priority on which style gets applied

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

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

inheritance

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

List the three selector types in order of increasing specificity.

A

type

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

Why is using !important considered bad practice?

A

it can override the specificity

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

Why do we log things to the console?

A

to see the result. checkpoint

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

What is a “model”?

A

recreation of something.DOM tree, it is stored in the browsers’ memory.
consists of 4 main types of nodes.

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

Which “document” is being referred to in the phrase Document Object Model?

A

HTML doc. entire page/ object

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

What is the word “object” referring to in the phrase Document Object Model?

A

element

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

What is a DOM Tree?

A

the model made of objects

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

Give two examples of document methods that retrieve a single element from the DOM.

A

getElementByID()

querySelector()

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

Give one example of a document method that retrieves multiple elements from the DOM at once.

A

getElementsByClassName()
getElementsByTagName()
querySelectorAll()

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

Why might you want to assign the return value of a DOM query to a variable?

A

to save the browser looking through the DOM tree to find the same element again.

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

What console method allows you to inspect the properties of a DOM element object?

A

console.dir()

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

Why would a tag need to be placed at the bottom of the HTML content instead of at the top?

A

so that javascript loads after the HTML

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

What does document.querySelector() take as its argument and what does it return?

A

class,id, element, css selector

gives the location of the node

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

What does document.querySelectorAll() take as its argument and what does it return?

A

class,id,element,css selector
return in Node list (array like object)
gives out the whole elements within the DOM

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

Why do we log things to the console?

A

to see the result

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

What is the purpose of events and event handling?

A

for the user interaction with the page.

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

What do [] square brackets mean in function and method syntax documentation?

A

optional

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

What method of element objects lets you set up a function to be called when a specific type of event occurs?

A

addEventListener()

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

What is a callback function?

A

a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action

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

What object is passed into an event listener callback when the event fires?

A

event object

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

What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?

A

where the interaction occurred. debugger.

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

What is the difference between these two snippets of code?

A

2nd one will load right up. (one with the ()) so don’t put ().

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

What is the className property of element objects?

A

string with the associated element

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

How do you update the CSS class attribute of an element using JavaScript?

A

using className method

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

What is the textContent property of element objects?

A

represents the text content of the element property and its descendants.

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

How do you update the text within an element using JavaScript?

A

element.textContent =’ ‘

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

Is the event parameter of an event listener callback always useful?

A

no

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

Would this assignment be simpler or more complicated if we didn’t use a variable to keep track of the number of clicks?

A

more complicated

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

Why is storing information about a program in variables better than only storing it in the DOM?

A

quicker access / securiity

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

What does the transform property do?

A

property lets you rotate, scale, skew, or translate an element

148
Q

Give four examples of CSS transform functions.

A

rotate,scale,skew, translate

149
Q

What event is fired when a user places their cursor in a form control?

A

focus

150
Q

What event is fired when a user’s cursor leaves a form control?

A

blur

151
Q

What event is fired as a user changes the value of a form control?

A

input

152
Q

What event is fired when a user clicks the “submit” button within a ?

A

submit

153
Q

What does the event.preventDefault() method do?

A

prevents page from reloading to a blank page.

154
Q

What does submitting a form without event.preventDefault() do?

A

it will erase all the text area

155
Q

What is one risk of writing a lot of code without checking to see if it works so far?

A

it might not work

156
Q

What is an advantage of having your console open when writing a JavaScript program?

A

to check everytime

157
Q

Does the document.createElement() method insert a new element into the page?

A

no, the element node is stored in a variable.

158
Q

How do you add an element as a child to another element?

A

appendChild()

159
Q

What steps do you need to take in order to insert a new element into the page?

A

create element , create text node(optional, but recommended), append text to element, appendChild()

160
Q

What is the textContent property of an element object for?

A

to be added to the element node

161
Q

What do you pass as the arguments to the element.setAttribute() method?

A

name, value

162
Q

Name two ways to set the class attribute of a DOM element.

A

set attribute, class Name

163
Q

What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?

A

easy/ time efficient

164
Q

The transition property is shorthand for which four CSS properties?

A

transition-property, transition-duration, transition-timing-function, and transition-delay.

165
Q

Give two examples of media features that you can query in an @media rule.

A

width ; height

166
Q

Which HTML meta tag is used in mobile-responsive web pages?

A

view-port

167
Q

What is the event.target?

A

location of event being fired

168
Q

Why is it possible to listen for events on one element that actually happen its descendent elements?

A

event bubbling

169
Q

What DOM element property tells you what type of element it is?

A

tag name

170
Q

What does the element.closest() method take as its argument and what does it return?

A

takes in selector, returns itself or closest parent.

171
Q

How can you remove an element from the DOM?

A

remove()

172
Q

If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?

A

addEventListener to the parent.

173
Q

What is the event.target?

A

element that was interacted with the event

174
Q

What is the affect of setting an element to display: none?

A

you cant see it

175
Q

What does the element.matches() method take as an argument and what does it return?

A

takes in string represent; returns boolean value

176
Q

How can you retrieve the value of an element’s attribute?

A

getAttribute()

177
Q

At what steps of the solution would it be helpful to log things to the console?

A

as much as possible

178
Q

If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?

A

multiple event listener

179
Q

If you didn’t use a loop to conditionally show or hide the views in the page, how would your JavaScript code be written instead?

A

series of conditional statements

180
Q

What is a breakpoint in responsive Web design?

A

The points at which a media query is introduced

181
Q

What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a “column” class in a responsive layout?

A

because it goes with ratio

182
Q

If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will “win”. Why is that?

A

specificity will override the later one .

183
Q

What is JSON?

A

text-based data format following JavaScript object syntax.

184
Q

What are serialization and deserialization?

A

serialization : process of turning an object in memory into a stream of bytes so you can do stuff like store it on disk or send it over the network.

deserialization : turning a stream of bytes into an object in memory.

185
Q

Why are serialization and deserialization useful?

A

its useful to convert data type.

186
Q

How do you serialize a data structure into a JSON string using JavaScript?

A

JSON.stringify()

187
Q

How do you deserialize a JSON string into a data structure using JavaScript?

A

JSON.parse()

188
Q

How to you store data in localStorage?

A

window.localStorage

189
Q

How to you store data in localStorage?

A

localStorage.setItem()

190
Q

What data type can localStorage save in the browser?

A

UTF-16 DOMstring

191
Q

When does the ‘beforeunload’ event fire on the window object?

A

event is fired when the window, the document and its resources are about to be unloaded.

192
Q

What is a method?

A

a function which is a property of an object / form of a procedure

193
Q

How can you tell the difference between a method definition and a method call?

A

method def = writing the code for the function

method call = calling with argument

194
Q

Describe method definition syntax (structure).

A

obj var , obj, property name, assigned function

195
Q

Describe method call syntax (structure).

A

dot notation and call

196
Q

How is a method different from any other function?

A

it is a property

197
Q

What is the defining characteristic of Object-Oriented Programming?

A

objects can store the data and behave like a method

198
Q

What does API stand for?

A

application programming interface

199
Q

What is “abstraction”?

A

to be able to work with (possibly) complex things in simple ways

200
Q

What is this in JavaScript?

A

implicit parameter of all JavaScript functions.

201
Q

What does it mean to say that this is an “implicit parameter”?

A

it is available in a function’s code block even though it was never included in the function’s parameter list or declared with var

202
Q

When is the value of this determined in a function; call time or definition time?

A

when the function is called

203
Q

What does this refer to in the following code snippet?

A

‘character’

204
Q

Given the above character object, what is the result of the following code snippet? Why?

A

Its a-me Mario

205
Q

Given the above character object, what is the result of the following code snippet? Why?

A

its a-me undef

206
Q

How can you tell what the value of this will be for a particular function or method definition?

A

when the function is called , take a look at the object that is left of the dot.

207
Q

How can you tell what the value of this is for a particular function or method call?

A

whatever the function calls

208
Q

How can you tell what the value of this will be for a particular function or method definition?

A

the object

209
Q

How can you tell what the value of this is for a particular function or method call?

A

whatever the function called ‘this’

210
Q

What kind of inheritance does the JavaScript programming language use?

A

prototype-based inheritance

211
Q

What is a prototype in JavaScript?

A

an object that has functionality that allows the objects to have the function

212
Q

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?

A

we can add them

213
Q

If an object does not have it’s own property or method by a given key, where does JavaScript look for it?

A

prototype chain.

214
Q

What does the new operator do?

A

lets developers create an instance of a user-defined object type or of one of the built-in object types that has a constructor function.

215
Q

What does the instanceof operator do?

A

tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object.

216
Q

What property of JavaScript functions can store shared behavior for instances created with new?

A

prototype

217
Q

What is a “callback” function?

A

function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.

218
Q

Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?

A

setTimer()

219
Q

How can you set up a function to be called repeatedly without using a loop?

A

setInterval

220
Q

What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?

A

1000ms

221
Q

What do setTimeout() and setInterval() return?

A

boolean

222
Q

What is a client?

A

service requesters

223
Q

What is a server?

A

providers of a resource or service

224
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET method

225
Q

What three things are on the start-line of an HTTP request message?

A

http methods
request target
http version

226
Q

What three things are on the start-line of an HTTP response message?

A

protocol version
status code
status text

227
Q

What are HTTP headers?

A

specifying the request, or describing the body included in the message.

228
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN

229
Q

Is a body required for a valid HTTP request or response message?

A

No.

230
Q

What is AJAX?

A

A technique for loading data into part of a page without having to refresh the entire page. asynchronous communication request.

231
Q

What does the AJAX acronym stand for?

A

Asynchronous JavaScript and XML

232
Q

Which object is built into the browser for making HTTP requests in JavaScript?

A

XMLHttpRequest.

233
Q

What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?

A

Event that can be used to trigger a javaScript function that will process the data and incorporate it.
load event.

234
Q

Bonus Question: An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?

A

descendent of the same function so it gets inherited.

235
Q

What is a code block? What are some examples of a code block?

A

{}

236
Q

What is the scope of a variable declared with const or let?

A

block

237
Q

What is the difference between let and const?

A

values can’t be reassigned.

238
Q

What does block scope mean?

A

area within if, switch conditions or for and while loops

239
Q

Why is it possible to .push() a new value into a const variable that points to an Array?

A

because CONST is immutable

240
Q

How should you decide on which type of declaration to use?

A

if it needs to be mutable, use LET, if not, use CONST.

241
Q

What is the syntax for Array destructuring?

A

let/const [“variables”] = “source array literal”

242
Q

How can you tell the difference between destructuring and creating Object/Array literals?

A

if its happening on the left side, its restructuring. If its on the right, creation.

243
Q

What is the syntax for writing a template literal?

A

backticks ``

244
Q

What is “string interpolation”?

A

substituting string with the variable.

245
Q

What is the syntax for writing a template literal?

A

backticks ${var_name}

246
Q

What is a CLI?

A

command-line interfaces.

247
Q

What is a GUI?

A

graphical user interface

248
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

doesnt require a return

249
Q

What are the three virtues of a great programmer?

A

laziness impatience hubris

250
Q

What is the syntax for defining an arrow function?

A

(parameter) => {statement}

251
Q

What is Node.js?

A

program that allows JavaScript to be run outside of a web browser

252
Q

What can Node.js be used for?

A

commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform

253
Q

What is a REPL?

A

Read–eval–print loop

254
Q

When was Node.js created?

A

2009

255
Q

What back end languages have you heard of?

A

NaN

256
Q

What is a computer process?

A

the instance of a computer program that is being executed by one or many threads.

257
Q

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

~450

258
Q

Why should a full stack Web developer know that computer processes exist?

A

Full stack Web development is based on making multiple processes work together to form one application, so having at least a cursory awareness of computer processes is necessary.

259
Q

What is the process object in a Node.js program?

A

The process object is a global that provides information about, and control over, the current Node.js process

260
Q

How do you access the process object in a Node.js program?

A

node process

261
Q

What is the data type of process.argv in Node.js?

A

array

262
Q

What is a JavaScript module?

A

a single .js file.

263
Q

Give two examples of truly global variables in a Node.js program.

A

__filename , __dirname

264
Q

What values are passed into a Node.js module’s local scope?

A

exports , require, module, __filename, __dirname

265
Q

Give two examples of truly global variables in a Node.js program.

A

process, console.

266
Q

What is the purpose of module.exports in a Node.js module?

A

transmit information within file

267
Q

How do you import functionality into a Node.js module from another Node.js module?

A

assign to module.exports and assign require on the other file.

268
Q

What is the JavaScript Event Loop?

A

executing the code, collecting and processing events, and executing queued sub-tasks.

269
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

blocking would stop the execution of the other code blocks.

270
Q

What is a directory?

A

location of the file

271
Q

What is a relative file path?

A

path of the file relative to the directory

272
Q

What is an absolute file path?

A

full path of the file

273
Q

What module does Node.js include for manipulating the file system?

A

fs

274
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writeFile

275
Q

Are file operations using the fs module synchronous or asynchronous?

A

asynchronous

276
Q

What is NPM?

A

world’s largest software registry share packages

277
Q

What is a package?

A

reusable codes. directory to the files including package.json

278
Q

How can you create a package.json with npm?

A

npm init –yes

279
Q

What is a dependency and how to you add one to a package?

A

Packages required by your application in production.

npm install.

280
Q

What happens when you add a dependency to a package with npm?

A

it gets add to your package.json’s dependency. node module gets downloaded.

281
Q

How do you add express to your package dependencies?

A

npm install express

282
Q

What Express application method starts the server and binds it to a network PORT?

A

listen method

283
Q

How do you mount a middleware with an Express application?

A

‘use’ method

284
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req/res

285
Q

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

.json

286
Q

What is the significance of an HTTP request’s method?

A

it executes the desired action

287
Q

What does the express.json() middleware do and when would you need it?

A

It parses incoming requests with JSON payloads and is based on body-parser. use it when we need to parse the data.

288
Q

What is PostgreSQL and what are some alternative relational databases?

A

a powerful, open source object-relational database system. ex: MySQL (also free), SQL Server by Microsoft, and Oracle by Oracle Corporation.

289
Q

What are some advantages of learning a relational database?

A

they support good guarantees about data integrity. They can store and modify data in a way that makes data corruption as unlikely as possible.

290
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

291
Q

What is a database schema?

A

collection of tables

292
Q

What is a table?

A

where Relational databases store data

293
Q

What is a row?

A

each entries for the table contains attributes

294
Q

What is SQL and how is it different from languages like JavaScript?

A

primary way of interacting with relational databases.SQL is a declarative programming language.

295
Q

How do you retrieve specific columns from a database table?

A

Select statement

296
Q

How do you filter rows based on some specific criteria?

A

where

297
Q

What are the benefits of formatting your SQL?

A

readability

298
Q

What are four comparison operators that can be used in a where clause?

A

= , > ,

299
Q

How do you limit the number of rows returned in a result set?

A

limit

300
Q

How do you retrieve all columns from a database table?

A

*

301
Q

How do you control the sort order of a result set?

A

in order by (desc, ascending is default)

302
Q

How do you add a row to a SQL table?

A

insert into

303
Q

What is a tuple?

A

a list of values

304
Q

How do you add multiple rows to a SQL table at once?

A

Data rows can be batch inserted into a database table by specifying more than one tuple of values, separated by commas

305
Q

How do you get back the row being inserted into a table without a separate select statement?

A

returning * (or specify the column you want)

306
Q

How do you update rows in a database table?

A

update clause

307
Q

Why is it important to include a where clause in your update statements?

A

to only target specific rows.

308
Q

How do you delete rows from a database table?

A

delete from

309
Q

How do you accidentally delete all rows from a table?

A

if you dont use where clause.

310
Q

What is a foreign key?

A

commonly shared column which links two or more tables

311
Q

How do you join two SQL tables?

A

join clause

312
Q

How do you temporarily rename columns or tables in a SQL statement?

A

“as” clause

313
Q

What are some examples of aggregate functions?

A

max(),min(),avg()

314
Q

What is the purpose of a group by clause?

A

grouping using one column

315
Q

What are the three states a Promise can be in?

A

pending: initial state, neither fulfilled nor rejected.
fulfilled: meaning that the operation was completed successfully.
rejected: meaning that the operation failed.

316
Q

How do you handle the fulfillment of a Promise?

A

use then method

317
Q

How do you handle the rejection of a Promise?

A

use catch method

318
Q

What is Array.prototype.filter useful for?

A

when going over the array and trying to find a desired value

319
Q

What is Array.prototype.map useful for?

A

when applying function to the whole array values.

320
Q

What is Array.prototype.reduce useful for?

A

when you need to merge the array.

321
Q

What is “syntactic sugar”?

A

syntax within a programming language that is designed to make things easier to read or to express.

322
Q

What is the typeof an ES6 class?

A

function

323
Q

Describe ES6 class syntax.

A

Classes are a template for creating objects

324
Q

What is “refactoring”?

A

the process of restructuring existing computer code—changing the factoring—without changing its external behavior.

325
Q

What is Webpack?

A

a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser

326
Q

How do you add a devDependency to a package?

A

npm install –save-dev (module)

327
Q

What is an NPM script?

A

use scripts to automate repetitive tasks

328
Q

How do you execute Webpack with npm run?

A

npm run build

329
Q

How are ES Modules different from CommonJS modules?

A
Similar to CommonJS, they have a compact syntax, a preference for single exports and support for cyclic dependencies.
Similar to AMD, they have direct support for asynchronous loading and configurable module loading.
330
Q

What kind of modules can Webpack support?

A

ECMA 6, AMD

331
Q

What is React?

A

A JavaScript library for building user interfaces

332
Q

What is a React element?

A

object created using react

333
Q

How do you mount a React element to the DOM?

A

reactDom.render(element,container)

334
Q

What is Babel?

A

Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments

335
Q

What is a Plug-in?

A

is a software component that adds a specific feature to an existing computer program

336
Q

What is a Webpack loader?

A

transformations that are applied to the source code of a module

337
Q

How can you make Babel and Webpack work together?

A

loader, webpack.config.js

338
Q

What is JSX?

A

syntax extension to JavaScript.

339
Q

Why must the React object be imported when authoring JSX in a module?

A

to find it helpful as a visual aid when working with UI inside the JavaScript code. It also allows React to show more useful error and warning messages.

340
Q

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

webpack.config.js

341
Q

What is a React component?

A

Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.

342
Q

How do you define a function component in React?

A

write a function as you would do in JavaScript

343
Q

How do you mount a component to the DOM?

A

ReactDOM.render(file, container)

344
Q

What are props in React?

A

object argument with data and returns a React element

345
Q

How do you pass props to a component?

A

component name = value

346
Q

How do you write JavaScript expressions in JSX?

A

by surrounding it with {}

347
Q

How do you create “class” component in React?

A

StartWithCapitalLetter extend React.Component:

render()

348
Q

How do you access props in a class component?

A

this.

349
Q

What is the purpose of state in React?

A

State is similar to props, but it is private and fully controlled by the component.

350
Q

How do you pass an event handler to a React element?

A

use attribute.

React events are named using camelCase, rather than lowercase.
With JSX you pass a function as the event handler, rather than a string.

351
Q

What Array method is commonly used to create a list of React elements?

A

map

352
Q

What is the best value to use as a “key” prop when rendering lists?

A

use a string that uniquely identifies a list item among its siblings

353
Q

What are controlled components?

A

An input form element whose value is controlled by React

354
Q

What two props must you pass to an input for it to be “controlled”?

A

handleChange, handleSubmit

355
Q

What does express.static() return?

A

returns middleware

356
Q

What is the local __dirname variable in a Node.js module?

A

returns abs path

directory name of the current file

357
Q

What does the join() method of Node’s path module do?

A

combines the path into one

358
Q

What does fetch() return?

A

it returns a promise containing the response

359
Q

What is the default request method used by fetch()?

A

GET

360
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

manipulate init

361
Q

When does React call a component’s componentDidMount method?

A

componentDidMount() is invoked immediately after a component is mounted

362
Q

Name three React.Component lifecycle methods.

A

componentWillUpdate, componentDidMount(), componentWillUnmount

363
Q

How do you pass data to a child component?

A

pass in props

364
Q

What must the return value of myFunction be if the following expression is possible?
myFunction()();

A

function

365
Q
What does this code do?
const wrap = value => () => value;
A

parameter of first function

366
Q

In JavaScript, when is a function’s scope determined; when it is called or when it is defined?

A

defined

367
Q

What allows JavaScript functions to “remember” values from their surroundings?

A

closure