Quiz Questions Flashcards

(366 cards)

1
Q

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

A

In the header element

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

In the body element

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

Where do the and tags go in a valid HTML document?

A

The header element goes below the html tag, and the body goes below the header tag.

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

What is the purpose of a declaration?

A

Instruction to the browser on which version of HTML the page is written in

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
  1. h1
  2. p
  3. div
  4. body
  5. html
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

Attributes control an elements behavior

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

® &

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

Take up all the width available
Starts on a new line
Has a top and bottom margin by default

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

Only takes up as much width as necessary

Does not start on a new 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

The width is the entirety of the available space on the page

The height is the height of whatever content is in the element

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

The default width and height are based on the content that reside in the element

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

An ordered list uses numbers to form a list that has a specific order while an unordered list uses bullet points and does not have a specific order to the elements

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

They are block elements

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

an a element tag

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

What is an absolute URL?

A

Uses a http or https and links to an outside website

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

What is a relative URL?

A

Links to a page within the same directory

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

../ (Parent directory)

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

/ (folder) / (child directory)

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

../../(Grandparent directory)

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

./(same directory)

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

Collect data from a user or visitor of your site

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
input
label
select
text area 
button
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

radio
email
text

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
What are the six primary HTML elements for creating tables?
``` table thead tbody tr th td ```
26
What purpose do the thead and tbody elements serve?
To specify which elements are in the header and body of the table created
27
Give two examples of data that would lend itself well to being displayed in a table.
Class grades | Schedules
28
What are the names of the individual pieces of a CSS rule?
``` Selector Declaration block Declaration Property Value ```
29
In CSS, how do you select elements by their class attribute?
.class { | }
30
In CSS, how do you select elements by their type?
type { | }
31
In CSS, how do you select an element by its id attribute?
``` #id { } ```
32
Name three different types of values you can use to specify colors in CSS.
Hexadecimal Keywords RGB (also HSL)
33
What CSS properties make up the box model?
Content Margin Padding Border
34
Which CSS property pushes boxes away from each other?
Margin
35
Which CSS property add space between a box's content and its border?
Padding
36
What is a pseudo-class?
Keyword added to a selector to specify a specific state
37
What are CSS pseudo-classes useful for?
Helps add style when certain actions are performed by user (i.e. hover, focus)
38
Name at least two units of type size in CSS.
px, em, pt, %
39
What CSS property controls the font used for the text inside an element?
font-family
40
What is the default flex-direction of a flex container?
row (left-to-right)
41
What is the default flex-wrap of a flex container?
nowrap
42
Why do two div elements "vertically stack" on one another by default?
They are block level elements
43
What is the default flex-direction of an element with display: flex?
row (left-to-right)
44
What is the default value for the position property of HTML elements?
Static, normal flow
45
How does setting position: relative on an element affect document flow?
It does not
46
How does setting position: relative on an element affect where it appears on the page?
Does not change unless you have offset properties
47
How does setting position: absolute on an element affect document flow?
Removed from document flow
48
How does setting position: absolute on an element affect where it appears on the page?
It will reposition to top left of parent that is non-static unless it is contained
49
How do you constrain an absolutely positioned element to a containing block?
Make sure parent is non-static
50
What are the four box offset properties?
top, bottom, left, right
51
What are the four components of "the Cascade".
Source Order, Inheritance, Specificity and !important
52
What does the term "source order" mean with respect to CSS?
the order in which css rule sets are in your style sheet will define their specificity
53
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
by inheriting the properties from all the parent elements inheritance
54
List the three selector types in order of increasing specificity.
type -> class -> ID
55
Why is using !important considered bad practice?
It makes debugging hard and breaks the natural cascading in style sheets
56
What is the purpose of variables?
Store data
57
How do you declare a variable?
using var before a name for the variable
58
How do you initialize (assign a value to) a variable?
using the = operator and adding a value after it with a semicolon at the end
59
What characters are allowed in variable names?
letter, underscores, dollar signs, numbers but cannot start with a number and cannot contain spaces
60
What does it mean to say that variable names are "case sensitive"?
The capitalization of variable names matters and must be typed with consistent capitalization
61
What is the purpose of a string?
To store text or characters within a variable
62
What is the purpose of a number?
To store numerical data within a variable
63
What is the purpose of a boolean?
To store a value of true or false to a variable to create true/false statements
64
What does the = operator mean in JavaScript?
Means a value is assigned to a variable
65
How do you update the value of a variable?
Reassign a value to it
66
What is the difference between null and undefined?
Null is an object while undefined is a type | Undefined means no value is set to it yet, where as null is intentional absence
67
Why is it a good habit to include "labels" when you log values to the browser console?
Makes debugging your code easier and checking your results
68
Give five examples of JavaScript primitives.
Boolean, Null, Undefined, String, Number
69
What data type is returned by an arithmetic operation?
number
70
What is string concatenation?
combines two or more strings together
71
What purpose(s) does the + plus operator serve in JavaScript?
for arithmetic or string concatenation
72
What data type is returned by comparing two values (, ===, etc)?
boolean
73
What does the += "plus-equals" operator do?
adds the value on the right, to the variable on the left, and then assigns that value back into the variable on the left
74
What are objects used for?
Objects group together a set of variables and functions to create a model of a something you would recognize from the real world
75
What are object properties?
Storing information
76
Describe object literal notation.
The object is the curly braces and their contents Each key is separated from its value by a colon Separate each property and method with a comma
77
How do you remove a property from an object?
using the delete operator
78
What are the two ways to get or update the value of a property?
dot notation and bracket notation hotel.name = 'Park'; or hotel['name] = 'Park';
79
What are arrays used for?
Creating a list of values that are related to each other.
80
Describe array literal notation.
var (variable name) = []
81
How are arrays different from "plain" objects?
They use index numbers as keys
82
What number represents the first index of an array?
0
83
What is the length property of an array?
the number of values in an array
84
How do you calculate the last index of an array?
the length of an array minus 1
85
What is a function in JavaScript?
a set of statements that takes an input and performs a task or calculates a value as an output
86
Describe the parts of a function definition.
``` function functionName(parameters) { } ```
87
Describe the parts of a function call.
functionName(arguments);
88
When comparing them side-by-side, what are the differences between a function call and a function definition?
function call doesn't need the word function before it, defn does
89
What is the difference between a parameter and an argument?
a parameter is in the function definition, where an argument is the value passed in the function when called
90
Why are function parameters useful?
Allow passing of information in the function
91
What two effects does a return statement have on the behavior of a function?
Ends the function | Returns a value to the calling function
92
Why do we log things to the console?
To check that we are getting the correct results
93
What is a method?
A function that is the property of an object
94
How is a method different from any other function?
Regular functions aren't associated with objects, methods are
95
How do you remove the last element from an array?
.pop()
96
How do you round a number down to the nearest integer?
Math.floor()
97
How do you generate a random number?
Math.random()
98
How do you delete an element from an array?
.splice()
99
How do you append an element to an array?
.push()
100
How do you break a string up into an array?
.split()
101
Do string methods change the original string? How would you check if you weren't sure?
They do not. You can check by using console.log()
102
Roughly how many string methods are there according to the MDN Web docs?
40 ish
103
Is the return value of a function or method useful in every situation?
No
104
Roughly how many array methods are there according to the MDN Web docs?
30 ish
105
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN
106
Give 6 examples of comparison operators.
>, =, <=, ===. !==, !=
107
What data type do comparison expressions evaluate to?
Boolean
108
What is the purpose of an if statement?
Making logical comparisons
109
Is else required in order to use an if statement?
Else is optional
110
Describe the syntax (structure) of an if statement.
if (condition) { instruction; }
111
What are the three logical operators?
&&, ||, !
112
How do you compare two different expressions in the same condition?
Using logical operators
113
What is the purpose of a loop?
Repeating through code multiple times until we tell it to stop
114
What is the purpose of a condition expression in a loop?
To tell the computer to keep looping that coding or to stop based on value of true or false
115
What does "iteration" mean in the context of loops?
How many times to go through the loop
116
When does the condition expression of a while loop get evaluated?
Before each pass through of the loop
117
When does the initialization expression of a for loop get evaluated?
One time before the first loop begins
118
When does the condition expression of a for loop get evaluated?
Once before every iteration
119
When does the final expression of a for loop get evaluated?
end of each for loop
120
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
121
What does the ++ increment operator do?
Increase value of a variable by 1
122
How do you iterate through the keys of an object?
using a for in loops of the object and pushing the key values of that object
123
Why do we log things to the console?
To check that our results are accurate, makes debugging issues easier
124
What is a "model"?
the DOM tree, or the model of the web page
125
Which "document" is being referred to in the phrase Document Object Model?
all the elements and information in the HTML
126
What is the word "object" referring to in the phrase Document Object Model?
Each node represents an object in the document
127
What is a DOM Tree?
The document model containing document nodes, element nodes, attribute nodes and text nodes.
128
Give two examples of document methods that retrieve a single element from the DOM.
getElementById() | querySelector()
129
Give one example of a document method that retrieves multiple elements from the DOM at once.
getElementsByClassName() | querySelectorAll()
130
Why might you want to assign the return value of a DOM query to a variable?
In case we need to access a particular node in the DOM
131
What console method allows you to inspect the properties of a DOM element object?
Console.dir()
132
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
The browser needs to parse all of the elements in the HTML page before the JavaScript code can access them.
133
What does document.querySelector() take as its argument and what does it return?
A CSS selector and returns the first element in the document with that selector
134
What does document.querySelectorAll() take as its argument and what does it return?
A CSS selector and returns a node list of the document's elements that match the specified selectors
135
Why do we log things to the console?
To make sure that we are getting the expected results
136
What is the purpose of events and event handling?
to execute code based on an event that happens to an element
137
Are all possible parameters required to use a JavaScript method or function?
No
138
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener()
139
What is a callback function?
A function passed in another function as an argument
140
What object is passed into an event listener callback when the event fires?
The function which we want to execute
141
What is the event.target? If you weren't sure, how would you check? Where could you get more information about it?
The element that triggered the event. By checking the console and MDN
142
What is the difference between these two snippets of code? element.addEventListener('click', handleClick) element.addEventListener('click', handleClick())
One calls a function and one is a definition
143
What is the className property of element objects?
sets the value of the class attribute of the specified element
144
How do you update the CSS class attribute of an element using JavaScript?
elementNodeReference.className =
145
What is the textContent property of element objects?
the text content of the node and its descendants
146
How do you update the text within an element using JavaScript?
elementNodeReference.textContent = or innerHTML
147
Is the event parameter of an event listener callback always useful?
No
148
Would this assignment be simpler or more complicated if we didn't use a variable to keep track of the number of clicks?
More complicated
149
Why is storing information about a program in variables better than only storing it in the DOM?
Easier to maintain code and you can track it much easier
150
What does the transform property do?
lets you rotate, scale, skew, or translate an element
151
Give four examples of CSS transform functions.
rotate, scale, skew, translate
152
What event is fired when a user places their cursor in a form control?
focus
153
What event is fired when a user's cursor leaves a form control?
blur
154
What event is fired as a user changes the value of a form control?
input
155
What event is fired when a user clicks the "submit" button within a form?
submit
156
What does the event.preventDefault() method do?
prevents the default action from happening | i.e. page reloading on submit
157
What does submitting a form without event.preventDefault() do?
reloads the page and pushes form to url
158
What property of a form element object contains all of the form's controls.
elements
159
What property of form a control object gets and sets its value?
value
160
What is one risk of writing a lot of code without checking to see if it works so far?
Makes debugging harder, more code to look through
161
What is an advantage of having your console open when writing a JavaScript program?
You can see errors as they happen
162
Does the document.createElement() method insert a new element into the page?
No, just creates the elements until we append to existing element
163
How do you add an element as a child to another element?
append.Child()
164
What do you pass as the arguments to the element.setAttribute() method?
name, value
165
What steps do you need to take in order to insert a new element into the page?
Create element Create text node Add text node to element Add element to DOM
166
What is the textContent property of an element object for?
sets text content for a specific node
167
Name two ways to set the class attribute of a DOM element.
.className | setAttribute()
168
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
its reusable and dynamically creates
169
Give two examples of media features that you can query in an @media rule.
width height color
170
Which HTML meta tag is used in mobile-responsive web pages?
viewport meta tag
171
What is the event.target?
Reference to where the event was fired
172
Why is it possible to listen for events on one element that actually happen its descendent elements?
Because events bubble up
173
What DOM element property tells you what type of element it is?
tagName
174
What does the element.closest() method take as its argument and what does it return?
takes a css selector and retuns the element that is closest to the target
175
How can you remove an element from the DOM?
remove()
176
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?
add the listener to the parent
177
What is the event.target?
the target of the event being fired
178
What is the affect of setting an element to display: none?
does not show up on the screen
179
What does the element.matches() method take as an argument and what does it return?
css selector as an argument and checks if the selector matches the element
180
How can you retrieve the value of an element's attribute?
getAttribute()
181
At what steps of the solution would it be helpful to log things to the console?
all the time
182
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?
It would act independently from other tabs
183
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?
You wouldnt be able to check each element
184
The transition property is shorthand for which four CSS properties?
transition-delay transition-duration transition-property transition-timing-function
185
What is JSON?
common data interchange format used to send and store information in computer systems
186
What are serialization and deserialization?
Serialization is the 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 is the reverse process: turning a stream of bytes into an object in memory.
187
Why are serialization and deserialization useful?
Allow us to transfer data between different computer systems
188
How do you serialize a data structure into a JSON string using JavaScript?
JSON.stringify()
189
How do you deserialize a JSON string into a data structure using JavaScript?
JSON.parse()
190
How to you store data in localStorage?
localStorage.setItem()
191
How to you retrieve data from localStorage?
localStorage.getItem()
192
What data type can localStorage save in the browser?
string data
193
When does the 'beforeunload' event fire on the window object?
when they are about to be unloaded
194
What is a breakpoint in responsive Web design?
Defined pixel value in which when the screen reaches a point, a transformation happens, where media queries are introduced
195
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?
Dynamically adapts as the screen changes
196
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?
CSS source order media query below another one has less precedence
197
What is a method?
A method is a function which is a property of an object.
198
How can you tell the difference between a method definition and a method call?
Definition is inside an object as a property with a function value, call is objectName.methodName
199
Describe method definition syntax (structure).
property name: function
200
Describe method call syntax (structure).
objectName.methodName()
201
How is a method different from any other function?
Associated with an object
202
What is the defining characteristic of Object-Oriented Programming?
It has to do with grouping similar functions and values in objects (Encapsulation)
203
What are the four "principles" of Object-Oriented Programming?
Abstraction, Inheritance, Encapsulation, Polymorphism
204
What is "abstraction"?
Working with complex things in simple ways
205
What does API stand for?
Application programming interface
206
What is the purpose of an API?
Allows applications to talk to eachother
207
What is this in JavaScript?
Refers to the object it belongs to
208
What does it mean to say that this is an "implicit parameter"?
Is the object of the method it belongs to
209
When is the value of this determined in a function; call time or definition time?
call time
210
What does this refer to in the following code snippet?
the object character
211
Given the above character object, what is the result of the following code snippet? Why?
It's-a-me, Mario! | this.firstName = Mario
212
Given the above character object, what is the result of the following code snippet? Why?
It's-a-me, undefined! Function is called, but this is no longer part of the character object, therefore doesnt exist
213
How can you tell what the value of this is for a particular function or method call? Exercise
The property
214
What kind of inheritance does the JavaScript programming language use?
prototypal
215
What is a prototype in JavaScript?
the mechanism by which JavaScript objects inherit features from one another
216
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?
They are inherited
217
If an object does not have it's own property or method by a given key, where does JavaScript look for it?
prototype
218
What does the new operator do?
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
219
What property of JavaScript functions can store shared behavior for instances created with new?
prototype | __proto__
220
What does the instanceof operator do?
tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object
221
What is a "callback" function?
a function passed into another function as an argument
222
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?
setTimeout()
223
How can you set up a function to be called repeatedly without using a loop?
setInterval()
224
What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?
0 seconds
225
What do setTimeout() and setInterval() return?
an identifying value you can use later when you need to clear the interval
226
What is a client?
a piece of computer hardware or software that accesses a service made available by a server
227
What is a server?
a piece of computer hardware or software (computer program) that provides functionality for other programs or devices
228
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
229
What three things are on the start-line of an HTTP request message?
HTTP Method, Request Target, HTTP Version
230
What three things are on the start-line of an HTTP response message?
Protocol version, status code, status text
231
What are HTTP headers?
let the client and the server pass additional information with an HTTP request or response
232
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN
233
Is a body required for a valid HTTP request or response message?
No
234
What is Ajax?
technique for loading data into part of a page without having to refresh entire page
235
What does the AJAX acronym stand for?
Asynchronous JavaScript and XML
236
Which object is built into the browser for making HTTP requests in JavaScript?
XMLHttpRequest
237
What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?
load
238
An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?
prototypal inheritance
239
What is a code block? What are some examples of a code block?
Code within curly braces | Function, if statement
240
What does block scope mean?
Within curly braces, variables defined within are only available there
241
What is the scope of a variable declared with const or let?
Block
242
What is the difference between let and const?
const cannot be reassigned, let can
243
Why is it possible to .push() a new value into a const variable that points to an Array?
We can change values but not reassign them
244
How should you decide on which type of declaration to use?
Depends on if the value is going to be reassigned or not
245
What is the syntax for writing a template literal?
wrapping string in backticks | ${var} to substitute
246
What is "string interpolation"?
substituting allows embedded values and expressions into string
247
What is destructuring, conceptually?
provides an alternative way to assign properties of an object to variables
248
What is the syntax for Object destructuring?
let { firstName: fname, lastName: lname } = person;
249
What is the syntax for Array destructuring?
let [x, y, z] = getScores();
250
How can you tell the difference between destructuring and creating Object/Array literals?
Curly vs square brackets
251
What is the syntax for defining an arrow function?
let add = (x, y) => x + y;
252
When an arrow function's body is left without curly braces, what changes in its functionality?
do not need to specify return
253
How is the value of this determined within an arrow function?
this inside an arrow function is equivalent to the global object
254
What is a CLI?
a command line program that accepts text input to execute operating system functions
255
What is a GUI?
type of user interface through which users interact with electronic devices via visual indicator representations
256
What are the three virtues of a great programmer?
laziness, impatience, hubris
257
What is Node.js?
an asynchronous event-driven JavaScript runtime
258
What can Node.js be used for?
build scalable network applications
259
What is a REPL?
a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user
260
When was Node.js created?
2009
261
What back end languages have you heard of?
Python PHP C++
262
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
30+
263
Why should a full stack Web developer know that computer processes exist?
Having an understanding of processes helps know whats going on when
264
What is the process object in a Node.js program?
a global that provides information about, and control over, the current Node.js process
265
How do you access the process object in a Node.js program?
process
266
How do you access the process object in a Node.js program?
Just use it or use require('process')
267
What is the data type of process.argv in Node.js?
Array
268
What is a JavaScript module?
A file
269
What values are passed into a Node.js module's local scope?
exports, require, module, __filename, and __dirname
270
Give two examples of truly global variables in a Node.js program.
global | setInterval
271
What is the purpose of module.exports in a Node.js module?
specify what in that file are able to be used in another file it is called
272
How do you import functionality into a Node.js module from another Node.js module?
require() and then use its return value
273
What is the JavaScript Event Loop?
a constantly running process that monitors both the callback queue and the call stack
274
What is different between "blocking" and "non-blocking" with respect to how code is executed?
Blocking methods execute synchronously and non-blocking methods execute asynchronously
275
What is a directory?
Collection of files
276
What is a relative file path?
refers to a location that is relative to a current directory
277
What is an absolute file path?
full path, starts with the root element and ends with the other subdirectories
278
What module does Node.js include for manipulating the file system?
fs
279
What method is available in the Node.js fs module for writing data to a file?
writeFile()
280
Are file operations using the fs module synchronous or asynchronous?
asynchronous
281
What is NPM?
package manager for the JavaScript programming language
282
What is a package?
a directory with one or more files in it | reusable, self containing code
283
How can you create a package.json with npm?
npm init --yes
284
What is a dependency and how to you add one to a package?
another package that your package needs in order to work npm install (package name)
285
What happens when you add a dependency to a package with npm?
will add all the dependencies that the dependency has as all
286
How do you add express to your package dependencies?
npm install express --save
287
What Express application method starts the server and binds it to a network PORT?
listen()
288
How do you mount a middleware with an Express application?
const app = express(); app.use(function (req, res, next) { console.log('Time:', Date.now()); next(); });
289
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request and response
290
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
291
What is the significance of an HTTP request's method?
indicate the desired action to be performed for a given resource
292
What does the express.json() middleware do and when would you need it?
deal with the (incoming) data (object) in the body of the request
293
What is PostgreSQL and what are some alternative relational databases?
a powerful, free, open source Relational Database Management System (RDBMS) alternatives: MySQL, SQL Server, Oracle
294
What are some advantages of learning a relational database?
support good guarantees about data integrity can store and modify data in a way that makes data corruption as unlikely as possible arguably the most widely used kind of database
295
What is one way to see if PostgreSQL is running?
top command
296
What is a database schema?
A collection of tables, describes the table
297
What is a table?
all data stored in relations
298
What is a row?
record of the data
299
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language JavaScript is imperative where you basically tell the JavaScript runtime what to do and how to do it
300
How do you retrieve specific columns from a database table?
a select statement example: select "name", "price" from "products";
301
How do you filter rows based on some specific criteria?
using a where clause
302
What are the benefits of formatting your SQL?
enhance readability and keep consistent styling
303
What are four comparison operators that can be used in a where clause?
, =, !=
304
How do you limit the number of rows returned in a result set?
limit at end of statement
305
How do you retrieve all columns from a database table?
*
306
How do you control the sort order of a result set?
order by
307
How do you add a row to a SQL table?
insert into "table" (" ") | values (' ')
308
What is a tuple?
a list of values
309
How do you add multiple rows to a SQL table at once?
enter the values on a new line
310
How do you get back the row being inserted into a table without a separate select statement?
returning *;
311
How do you update rows in a database table?
update "table nam" set "header" = 100 where "header" = 24;
312
Why is it important to include a where clause in your update statements?
to target a specific row
313
How do you delete rows from a database table?
delete from "table" where "column header" = 24 returning *;
314
How do you accidentally delete all rows from a table?
Not specifying what row you want to delete
315
What is a foreign key?
set of attributes in a table that refers to the primary key of another table
316
How do you join two SQL tables?
example: select * from "products" join "suppliers" using ("supplierId");
317
How do you temporarily rename columns or tables in a SQL statement?
Example: | "products"."name" as "product"
318
What are some examples of aggregate functions?
sum() avg() count()
319
What is the purpose of a group by clause?
used to group rows that have the same values
320
What are the three states a Promise can be in?
pending, fufilled, rejected
321
How do you handle the fulfillment of a Promise?
promiseObject.then(value) => {}
322
How do you handle the rejection of a Promise?
promiseObject.catch(error) => {}
323
What is Array.prototype.filter useful for?
filtering an array to get specific results
324
What is Array.prototype.map useful for?
creates a new array populated with the results of calling a provided function on every element in the calling array
325
What is Array.prototype.reduce useful for?
return a calculation from an array
326
What is "syntactic sugar"?
designed to make things easier to read or to express
327
What is the typeof an ES6 class?
returns a string indicating the type of the unevaluated operand
328
Describe ES6 class syntax.
template for creating objects that encapsulate data with code to work on that data ``` ex: class Rectangle { constructor(height, width) { this.height = height; this.width = width; } } ```
329
What is "refactoring"?
restructuring existing computer code—changing the factoring—without changing its external behavior
330
What is Webpack?
bundle JavaScript files for usage in a browser
331
How do you add a devDependency to a package?
--save-dev
332
What is an NPM script?
convenient way to bundle common shell commands for your project
333
How do you execute Webpack with npm run?
npm run build
334
How are ES Modules different from CommonJS modules?
pre-parsed in order to resolve further imports before code is executed, using import from or export
335
What kind of modules can Webpack support?
ES6 modules. CommonJS modules. AMD modules
336
What is React?
JavaScript library that is used for building user interfaces
337
What is a React element?
an object that virtually describes the DOM nodes that a component represents
338
How do you mount a React element to the DOM?
ReactDOM.render(element, container[, callback])
339
What is Babel?
used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers
340
What is a Plug-in?
a software component that adds a specific feature to an existing computer program
341
What is a Webpack loader?
node-based utilities built for webpack to help webpack to compile and/or transform a given type of resource that can be bundled as a javascript module
342
How can you make Babel and Webpack work together?
use a babel loader
343
What is JSX?
JSX is an extension to the JavaScript language syntax which provides a way to structure component rendering using syntax familiar to many developers. It is similar in appearance to HTML
344
Why must the React object be imported when authoring JSX in a module?
Because JSX is syntactic sugar for react create element
345
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
load the transform react jsx plugin
346
What is a React component?
independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML
347
How do you define a function component in React?
``` function Welcome(props) { return

Hello,{props.name

; } ```
348
How do you mount a component to the DOM?
ReactDOM.render()
349
What are props in React?
arguments passed into React components
350
How do you pass props to a component?
function parameter
351
How do you write JavaScript expressions in JSX?
surround the JavaScript code in { } brackets
352
How do you create "class" component in React?
you need to extend React.Component
353
How do you access props in a class component?
this.props
354
What is the purpose of state in React?
represent an information about the component's current situation
355
How to you pass an event handler to a React element?
onClick={function} | instead of onClick = "function()"
356
What are controlled components?
a component that renders form elements and controls them by keeping the form data in the component's state
357
What two props must you pass to an input for it to be "controlled"?
value | onChange()
358
What does express.static() return?
An object
359
What is the local __dirname variable in a Node.js module?
tells you the absolute path of the directory containing the currently executing file
360
What does the join() method of Node's path module do?
all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path
361
What does fetch() return?
returns the data of the format JSON or XML. This method returns a promise
362
What is the default request method used by fetch()?
.then()
363
How do you specify the request method (GET, POST, etc.) when calling fetch?
specify a method: (POST, etc)
364
When does React call a component's componentDidMount method?
After the component is mounted to the DOM
365
Name three React.Component lifecycle methods.
componentWillUnmount(), componentDidUpdate(), componentDidMount()
366
How do you pass data to a child component?
using the props