Quiz Flashcards

1
Q

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

A

head 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

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

html element

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

to tell a browser which version of HTML the page is using

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

html, body, head, h1, p, a, span, ul, ol, li…

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 provide additional information about the contents of an element

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

Give an example of an HTML entity

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

always appear to start on a 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

appear to continue on the same line as their neighboring elements

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

full width available of its parent element (container), and height of content length

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

width and height of parent element, non-adjustable

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

ol is numbered, while ul is bullet points

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

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 element (anchor)

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

What is an absolute URL?

A

domain name followed by the path to a specific page

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

What is a relative URL?

A

when linking to other pages within the same site

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

by using ../ to go up one folder, then followed by a file name (or could be a folder name)

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

by using the name of the child folder, followed by a forward slash, then the file name
childfolder/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

by using ../../ to go up two folders, then followed by a file name (or could be a folder name)

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

by using the file name (or ./)

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

houses form controls/ group inputs together to capture submitted information

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

??

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 elements.

A

“text” “password” “email” “radio” “checkbox” “file” “submit” “image”

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

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

A

inline element

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?
html, head, body, doctype, title, meta
26
What purpose do the thead and tbody elements serve?
accessibility, semantically divide elements, styling purposes
27
Give two examples of data that would lend itself well to being displayed in a table.
schedule, tabular data - statistics, database
28
What are the names of the individual pieces of a CSS rule?
selector and declaration
29
In CSS, how do you select elements by their class attribute?
.class
30
In CSS, how do you select elements by their type?
tag name
31
In CSS, how do you select an element by its id attribute?
#id
32
Which CSS property pushes boxes away from each other?
margin
33
Which CSS property add space between a box's content and its border?
padding
34
What CSS properties make up the box model?
margin, border, padding
35
Name three different types of values you can use to specify colors in CSS.
color name, hex, rgb, rgba
36
What is a pseudo-class?
allows to change the appearance of elements when a user is interacting with them :hover :active :focus
37
What are CSS pseudo-classes useful for?
engaging
38
Name at least two units of type size in CSS.
px em rem % 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
41
What is the default flex-wrap of a flex container?
no wrap
42
Why do two div elements "vertically stack" on one another by default?
block elements take up 100% width by default
43
What is the result flex-direction of an element with display: flex?
asdf
44
What is the default value for the position property of HTML elements?
static
45
How does setting position: relative on an element affect document flow?
same as static, doesn't affect document flow
46
How does setting position: relative on an element affect where it appears on the page?
moves the element in relation to where it would have been in normal flow
47
How does setting position: absolute on an element affect document flow?
taken out of normal flow, no longer affects the position of other elements
48
How does setting position: absolute on an element affect where it appears on the page?
relative to non-static position parent////
49
How do you constrain an absolutely positioned element to a containing block?
set the parent container as non-static
50
What are the four box offset properties?
top bottom left right
51
What is the purpose of variables?
to store values
52
How do you declare a variable
var = ;
53
How do you initialize a variable?
= on declared variable
54
What characters are allowed in variable names?
letters, numbers, _, $
55
What does it mean to say that variable names are "case sensitive"?
apple and Apple are different
56
What is the purpose of a string?
texts
57
What is the purpose of a number?
numbers
58
What is the purpose of a boolean?
to show true and false
59
What does the = operator mean in JavaScript?
assign a value
60
How do you update the value of a variable?
assign a new value
61
What is the difference between null and undefined?
null is assigned to show empty value, undefined is to show no value has been assigned, (null is an object, which is a mistake)
62
Why is it a good habit to include "labels" when you log values to the browser console?
to show what values are being logged
63
Give five examples of JavaScript primitives.
number, string, boolean, undefined, bigint, symbol
64
What data type is returned by an arithmetic operation?
number
65
What is string concatenation?
connecting strings together
66
What purpose(s) does the + plus operator serve in JavaScript?
adding numbers, concatenating strings
67
What data type is returned by comparing two values ( . ===, etc)?
boolean
68
What does the += "plus-equals" operator do?
add a value to a variable, and assign that value to the variable
69
What are objects used for?
to create model of something
70
What are object properties?
variables as opposed to functions
71
Describe object literal notation?
{ }
72
How do you remove a property from an object?
delete keyword
73
What are the two ways to get or update the value of a property?
. (member operator) and constructor [ ]
74
What are arrays used for?
storing lists of data, anything that needs numerically indexed
75
Describe array literal notation.
[ ]
76
How are arrays different from "plain" objects?
indexed, objects are non-iterable
77
What number represents the first index of an array?
0
78
What is the length property of an array?
array.length;
79
How do you calculate the last index of an array?
array[array.length - 1]
80
What is a function in JavaScript?
performs a set of tasks, reapeat
81
Describe the parts of a function definition.
function name(parameter) {return}
82
Describe the parts of a function call.
function() or function(para)
83
When comparing them side-by-side, what are the differences between a function call and a function definition?
name of function and argument, while definition has the.. definition
84
What is the difference between a parameter and an arguement?
parameter represents data that function will be called with, argument represents the actual data that's been passed on to the function
85
Why are function parameters useful?
pass info to function that function needs
86
What two effects does a return statement have on the behavior of a function?
causes the function to produce a value we can use, prevents any more code in the function's code block from being run
87
Why do we log things to the console?
to debug
88
What is a method?
a function that is a property of an object
89
How do you remove the last element from an array?
.pop()
90
How do you round a number down to the nearest integer?
round
91
How do you generate a random number?
.random() * range of the number
92
How do you delete an element from an array?
splice(position, how many to delete, inserting item)
93
How do you break a string up into an array?
split(string)
94
Do string methods change the original string? How would you check if you weren't sure?
console.log()
95
Roughly how many string methods are there according to the MDN Web docs?
40s
96
Is the return value of a function or method useful in every situation?
no
97
Roughly how many array methods are there according to the MDN Web docs?
a lot, 40s?
98
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN
99
Give 6 examples of comparison operators.
> < == === <= >= != !==
100
What data type do comparison expressions evaluate to?
boolean
101
What is the purpose of an if statement?
decision making
102
is else required in order to use an if statement?
no
103
Describe the syntax (structure) of an if statement?
if (condition) { statement }
104
What are the three logical operators?
! && ||
105
How do you compare two different expressions in the same condition?
( ) comparison ( )
106
What is the purpose of a loop?
to iterate through a process multiple times
107
What is the purpose of a condition expression in a loop?
loops start and stop
108
What does "iteration" mean in the context of loops?
repeat
109
When does the condition expression of a while loop get evaluated?
before statement
110
When does the initialization expression of a for loop get evaluated?
once before loop begins
111
When does the condition expression of a for loop get evaluated?
before each evaluation
112
When does the final expression of a for loop get evaluated?
at the end of each loop iteration
113
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
114
What does the ++ increment operator do?
increment by 1
115
How do you iterate through the keys of an object?
for var in object
116
What are the four components of "the Cascade".
source order, inheritance, specificity, !important
117
What does the term "source order" mean with respect to CSS?
specificity
118
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritance
119
List the three selector types in order of increasing specificity .
element class id
120
Why is using !important considered bad practice?
harder to debug
121
Why do we log things to the console?
to see what's there
122
What is a "model"?
DOM Tree
123
Which "document" is being referred to in the phrase Document Object Model?
html document
124
What is the word "object" referring to in the phrase Document Object Model?
different part of the page loaded in the browser window
125
What is a DOM Tree?
connected nodes that represent the model | consists of 4 main types of nodes
126
Give two examples of document methods that retrieve a single element from the DOM.
getElementById(), querySelector()
127
Give one example of a document method that retireves multiple elements from the DOM at once.
getElementsByClassName(), getElementsByTagName(), querySelectorAll()
128
Why might you want to assign the return value of a DOM query to a variable?
when working with an element more than once
129
What console method allows you to inspect the properties of a DOM element object?
console.dir()
130
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
131
What does document.querySelector() take as its argument and what does it return?
takes CSS selector, returns the first matching element
132
What does document.querySelectorAll() take as its argument and what does it return?
takes CSS selector, returns a NodeList of all matching elements
133
Why do we log things to the console?
to test and debug
134
What is the purpose of events and event handling?
user interaction
135
What do [ ] square brackets mean in function and method syntax documentation?
optional
136
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener()
137
What is a callback function?
a function passed into another function as an argument, which is then invoked inside the outer function
138
What object is passed into an event listener callback when the event fires?
event object
139
What is the event.target? if you weren't sure, how would you check? Where could you get more information about it?
where interaction occurred, MDN, debugger
140
What is the difference between these two snippets of code? element. addEventListener('click', handleClick) element. addEventListener('click', handleClick())
the latter won't wait for the event
141
What is the className property of element objects?
gets and sets the value of the class attribute
142
How do you update the CSS class attribute of an element using JavaScript?
elementNodeReference.className = 'new-class'
143
What is the textContent property of element objects?
represents the text content of the node and its descendants
144
How do you update the text within an element using JavaScript?
elementNodeReference.textContent = 'new string'
145
Is the event parameter of an event listener callback always useful?
no
146
Would this assignment be simpler or more complicated if we didn't use a variable to keep track of the number of clicks?
It would've been more complicated to keep track
147
Why is storing information about a program in variables better than only storing it in the DOM?
much easier to manipulate more than once, don't depend on DOM
148
What does the transform property do?
manipulate images
149
Give four examples of CSS transform functions.
rotate(), scale(), skew(), translate()
150
What event is fired when a user places their cursor in a form control?
'focus'
151
What event is fired when a user's cursor leaves a form control?
'blur'
152
What event is fired as a user changes the value of a form control?
'input'
153
What event is fired when a user clicks the "submit" button within a ?
'submit'
154
What does the event.preventDefault() method do?
prevents default action
155
What does submitting a form without event.preventDefault() do?
reloads the page, send the info
156
What property of a form element object contains all of the form's controls?
elements
157
What property of form a control object gets and sets its value?
value
158
What is one risk of writing a lot of code without checking to see if it works so far?
once finished, you don't know what's broken
159
What is an advantage of having your console open when writing a JavaScript program?
easier to follow and debug early, access tools
160
Does the document.createElement() method insert a new element into the page?
no, only creates a new element
161
How do you add an element as a child to another element?
parentNode.appendChild('childNode')
162
What do you pass as the arguments to the element.setAttribute() method?
('attribute', 'value')
163
What steps do you need to take in order to insert a new element into the page?
appendChild to the corresponding parent element, set correct attribute for CSS rules
164
What is the textContent property of an element object for?
setting the text content of the element
165
Name two ways to set the class attribute of a DOM element.
setAttribute(), className, classList
166
What are two advantages of defining a function to create something (like the work of creating a DOM tree)?
re using, debug
167
The transition property is shorthand for which four CSS properties?
transition-property, transition-duration, transition-timing-function, transition-delay
168
Give two examples of media features that you can query in an @media rule.
width, height
169
Which HTML meta tag is used in mobile-responsive web pages?
content width?
170
what is the event.target?
target of the event (most specific element interacted with)
171
Why is it possible to listen for events on one element that actually happen its descendent elements?
event delegation analyzes bubbled events to find a match on child elements
172
What DOM element property tells you what type of element it is?
event.target.tagName
173
What does the element.closest() method take as its argument and what does it return?
string of element name, returns itself or matching ancestor, or null
174
How can you remove an element from the DOM?
ChildNode.remove()
175
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 event listener to the parent element
176
What is the event.target?
target of the event (most specific element interacted with)
177
What is the affect of setting an element to display: none?
hides the element
178
What does the element.matches() method take as an argument and what does it return?
string representing the selector to test
179
How can you retrieve the value of an element's attribute?
getAttribute()
180
At what steps of the solution would it be helpful to log things to the console?
every few steps
181
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?
add event listeners to each tab
182
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?
write code block that checks the tab's attribute as many as the tabs
183
What is a breakpoint in responsive Web design?
at which point the media query applies
184
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?
allows to react to the container size
185
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?
cascading, happens afterwards, it overwrites
186
What is JSON?
a text-based data format following JavaScript object syntax
187
What are serialization and deserialization?
Converting a string to a native object is called deserialization, while converting a native object to a string so it can be transmitted across the network is called serialization.
188
Why are serialization and deserialization useful?
provides a well accepted standard for transferring data
189
How do you serialize a data structure into a JSON string using JavaScript?
JSON.stringify()
190
How do you deserialize a JSON into a data structure using JavaScript?
JSON.parse()
191
How do you store data in localStorage?
localStorage.setItem('key', 'value')
192
How do you retrieve data from localStorage?
localStorage.getItem('key')
193
What data type can localStorage save in the browser?
string
194
When does the 'beforeunload' event fire on the window object?
when the page is about to close
195
What is method
function that is part of an object
196
How can you tell the difference between a method definition and a method call?
definition: writing the code, call: call the function to use
197
Describe method definition syntax (structure).
var obj = {key: function (param) {code}};
198
Describe method call syntax (structure).
obj.key();
199
How is a method different from any other function?
property of an object
200
What is the defining characteristic of Object-Oriented Programming?
objects can contain data and method
201
What are four "principles" of Object-Oriented Programming?
abstraction, encapsulation, inheritance, polymorphism
202
What is "abstraction"?
working with complex things in simple ways
203
What does API stand for?
application programming interface
204
What is the purpose of an API?
simplifies programming by abstracting the underlying implementation and only exposing objects or actions the developer needs.
205
What is 'this' in Javascript?
an implicit parameter of all JS functions, keyword
206
What does it mean to say that 'this' is an "implicit parameter"?
not explicitly written in function definition, but accesible by the function
207
When is the value of 'this' determined in a function; call time or definition time?
determined at call time
208
``` What does 'this' refer to in the following code snippet? var character = { firstName: 'Mario', greet: function ( ) { var message = 'It\'s-a-me, ' + this.firstName + '!'; console.log(message); } }; ```
character object
209
Given the above 'character' object, what is the result of the following code snippet? Why? character.greet();
It's-a-me, Mario!
210
``` Given the above character object, what is the result of the following code snippet? Why? var hello = character.greet; hello(); ```
It's-a-me, undefined!
211
How can you tell what the value of 'this' will be for a particular function or method definition?
object that contains 'this'
212
How can you tell what the value of 'this' is for a particular function or method call?
left of . of the method call
213
What kind of inheritance does the JavaScript programming language use?
prototypical
214
What is a prototype in JavaScript?
object with functionality that other object can delegate their work to
215
How it is possible to call methods on strings, arrays, and numbers even though those methods don't actually exist on objects, arrays, and numbers?
attach prototypes to object and call any
216
If an object does not have it's own property or method by a given key, where does JavaScript look for it?
prototype chain ex) array -> Array -> Object
217
What does the 'new' operator do?
1. Creates a blank, plain JavaScript object; 2. Links (sets the constructor of) the newly created object to another object by setting the other object as its parent prototype; 3. Passes the newly created object from Step 1 as the 'this' context; 4. Returns 'this' if the function doesn't return an object
218
What property of JavaScript functions can store shared behavior for instances created with 'new'?
prototype
219
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
220
What is a "callback" function?
a function passed into another function as an argument
221
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(); - using once
222
How can you set up a function to be called repeatedly without using a loop?
setInterval()
223
What is the default time delay if you omit the 'delay' parameter from 'setTimeout()' or 'setInterval()'?
0
224
What do 'setTimeout()' and 'setInterval()' return?
1. a positive integer value which identifies the timer created by the call to setTimeout() 2. an interval ID which uniquely identifies the interval
225
What is a client?
request services
226
What is a server?
answer request from client, provides service
227
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
228
What three things are on the start-line of an HTTP 'request' message?
1. HTTP method - describes the action 2. request target - usually a URL, path 3. HTTP version - defines the structure
229
What three things are on the start-line of an HTTP 'response' message?
1. protocol version 2. status code 3. status text
230
What are HTTP headers?
specifies the request, or describe the body | info related to request
231
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN
232
Is a body required for a valid HTTP request or response message?
optional
233
What is AJAX?
a programming practice of building complex, dynamic webpages using a technology known as XMLHttpRequest / a technique for loading data into part of a page without having to refresh the entire page
234
What does the AJAX acronym stand for?
Asynchronous JavaScript And XML
235
Which object is built into the browser for making HTTP requests in JavaScript?
XMLHttpRequest
236
What event is fired by 'XMLHttpRequest' objects when they are finished loading the data from the server?
'load'
237
An 'XMLHttpRequest' object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?
addEventListener is part of EventTarget | both are descendent of EventTarget
238
What is a code block? What are some examples of a code block?
{}, if, else, for, do while, while, try catch
239
What does block scope mean?
within curly braces
240
What is the scope of a variable declared with const or let?
block-scoped
241
What is the difference between let and const?
let: block-scope, cannot redeclare, does not initialize after hoisting, must use let for callback function in a for loop, not part of global object as a property, declare let early or TDZ with reference error const: read-only, block-scope, immediately initialize, TDZ, Object.freeze(), can be used in for...of
242
Why is it possible to .push() a new value into a const variable that points to an Array?
read-only doesn't mean that the actual value to which the const variable reference is immutable
243
How should you decide on which type of declaration to use?
use const unless let is needed
244
What is destructuring, conceptually?
assigns properties of an object or values of an array to individual variables
245
What is the syntax for Object destructuring?
let { property: variable } = object;
246
What is the syntax for Array destructuring?
let [x, y, z] = array;
247
How can you tell the difference between destructuring and creating Object / Array literals?
{ } = vs = { }
248
What is the syntax for writing a template literal?
let variable = `string ${variablename}`;
249
What is "string interpolation"?
substitute part of the string for the values of variables or expressions
250
What is the syntax for defining an arrow function?
(param1, param2) => expression;
251
When an arrow function's body is left without curly braces, what changes in its functionality?
curly brace is not needed, unless a statement is used - return
252
How is the value of this determined within an arrow function?
arrow function captures the `this` value of the enclosing context instead of creating its own `this` context
253
What is a CLI?
command-line interface
254
What is a GUI?
graphical user interface
255
Give at least one use case for each of the commands listed in this exercise.
man: reference manual cat: view file contents and concatenating them/ create file with content ls: list current directory pwd: print current working directory echo: display line of text touch: change file timestamps/ create file with no content mkdir: make directories/ folders mv: move/rename files rm: remove files or directories cp: copy files and directories
256
What are the three virtues of a great programmer?
laziness, impatience, hubris
257
What is Node.js?
an asynchronous event-driven JavaScript runtime, | allows javascript to be run outside of a web browser
258
What can Node.js be used for?
, to build backends for web applications, command-line programs, or any kind of automation
259
What is a REPL?
read-eval-print
260
When was Node.js created?
2009
261
What back end languages have you heard of?
php, python
262
My questions reading about Node.js
event-driven, concurrent connections, OS threads are employed? -> thread-based networking?, not dead-locking because no locks, no direct I/O so no blocking, event loop as a runtime construct, child_process.fork(), cluster module for load balancing
263
What is a computer process?
the instance of a computer program that is being executed by one or many threads, containing the program code and its activity
264
Roughly how many computer processes are running on your host operating system (Activity Monitor)?
500
265
Why should a full stack Web developer know that computer processes exist?
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.
266
What is the 'process' object in a Node.js program?
a 'global' that provides information about, and control over, the current Node.js process
267
How do you 'access' the process object in a Node.js program?
process, because it's global variable (otherwise need 'require')
268
What is the data type of 'process.argv' in Node.js?
object
269
What is a JavaScript module?
individual js file, performs a small task
270
What values are passed into a Node.js module's local scope?
exports, require, module, __filename, __dirname
271
Give two examples of truly global variables in a Node.js program.
global, process, console
272
What is the purpose of 'module.exports' in a Node.js module?
to make the module readable by another file, for ease of transmit info
273
How do you import functionality into Node.js module from another Node.js module?
const variable = require(./path);
274
What is the JavaScript Event Loop?
look at the stack, if call stack is empty, move task queue to call stack
275
What is different between "blocking" and "non-blocking" with respect to how code is executed?
blocking - synchronous, prevents other codes to run | non-blocking - asychronous
276
What is a directory?
location
277
What is a relative file path?
path from the current location
278
What is an absolute file path?
path from the root location
279
What module does Node.js include for manipulating the file system?
fs
280
What method is available in the Node.js 'fs' module for writing data to a file?
fs.writeFile()
281
Are file operations using the 'fs' module synchronous or asynchronous?
asynchronous
282
What is a client?
sends request
283
What is a server?
fullfill or does not fullfil response, provides service
284
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
285
What is on the first line of an HTTP request message?
http version
286
What is on the first line of an HTTP response message?
http version,
287
What are HTTP headers?
s
288
Is a body required for a valid HTTP message?
no
289
What is NPM?
software registry to share and borrow packages, to manage private development
290
What is a package?
directory with files containing reusable code
291
How can you create a 'package.json' with 'npm'
npm init (--yes) for default
292
What is a dependency and how do you add one to a package?
object that maps a package name to a version range, | npm install -P by default
293
What happens when you add a dependency to a package with 'npm'?
download the module, add to package.json
294
How do you add 'express' to your package dependencies?
npm install express --save (save not required anymore) | npm init
295
What Express application method starts the server and binds it to a network 'port'?
listen()
296
How do you mount a middleware with an Express application?
app.use('mount path', function....
297
Which object does an Express application pass to your middleware to manage the request/response lifecycle of the server?
res.send or req.send
298
What is the appropriate 'Content-Type' header for HTTP messages that contain JSON in their bodies?
application/json !!!!!!!!!
299
What is the significance of an HTTP request's method?
passes desired outcome
300
What does the express.json() middleware do and when would you need it?
returns middleware that only parses JSON and only looks at requests where the Content-Type header matches the type option.
301
What is PostgreSQL and what are some alternative relational databases?
relational database, MySQL, SQL Server by Microsoft, Oracle by Oracle Corporation
302
What are some advantages of learning a relational database?
many problem domains can be modeled well, support good guarantees about data integrity, very flexible structure
303
What is one way to see if PostgreSQL is running
sudo service postgresql status or top
304
What is a database schema?
collection of tables
305
What is a table?
list of rows
306
What is a row?
entry with the same set of attributes
307
What is SQL and how is it different from language like JavaScript?
declarative language, others are imparative
308
How do you retrieve specific columns from a database table?
select
309
How do you filter rows based on some specific criteria?
where
310
What are the benefits of formatting your SQL?
readability
311
What are four comparison operators that can be used in a 'where' clause?
> >= <= < =
312
How do you limit the number of rows returned in a result set?
limit
313
How do you retrieve all columns from a database table?
*
314
How do you control the sort order of a result set?
order of , desc
315
How do you add a row to a SQL table?
insert into "table"
316
What is a tuple?
list of values
317
How do you add multiple rows to a SQL table at once?
separate tuple by comma (' '), (' ')
318
How do you get back the row being inserted into a table without a separate 'select' statement?
returning * or "column"
319
How do you update rows in a database table?
update "table" set "value" = ' ' where "column" = ' '
320
Why is it important to include a where clause in your update statements?
otherwise updates everything
321
How do you delete rows from a database table?
delete from "table" | where "column" = ' '
322
How do you accidentally delete all rows from a table?
not including where clause
323
What is a foreign key?
key that connects to another table
324
How do you join two SQL tables?
select " " from "table1" join "table2" using ("id")
325
How do you temporarily rename columns or tables in a SQL statement?
select "column"."colName" as "newName"
326
What are some examples of aggregate functions?
count, sum, max, min, avg
327
What is the purpose of a 'group by' clause?
to remove duplicates, to collapse/group based on specific columns
328
What are the three states a Promise can be in?
pending, fulfilled, rejected
329
How do you handle the fulfillment of a Promise?
.then
330
How do you handle the rejection of a Promise?
.then(.., onRejection) .catch(onRejection)
331
What is 'Array.prototype.filter' useful for?
creating a new array that meets a certain condition
332
What is 'Array.prototype.map' useful for?
creating a new array that has all indexes of an array manipulated
333
What is 'Array.prototype.reduce' useful for?
creating a new array that performs more complex callback function
334
What is "syntactic sugar"?
syntax within a programming language that is designed to make things easier to read or to express
335
What is the typeof an ES6 class?
function
336
Describe ES6 class syntax.
``` class Name { constructor(var) { } funcName() { } static funcName2() { } } ```
337
What is "refactoring"?
process of restructuring existing computer code without changing its external behavior
338
What is Webpack?
static module bundler for modern JS application into a JS file, builds dependency graphs
339
How do you add a 'devDependency' to a package?
npm install --save-dev package-name
340
What is an NPM script?
script for cli command to automate tasks
341
How do you execute Webpack with 'npm run'?
npm run name-of-script-under-scripts-in-package.json
342
How are ES Modules different from CommonJS modules?
more compact syntax, structure can be statically analyzed (for static checking, optimization), support for cyclic dependencies is better, async loading
343
What kind of modules can Webpack support?
ecma 2015, amd, commonJS, assets, webassembly modules
344
What is React?
a JS library for building user interfaces
345
What is a React element?
object ,, DOM,,,,,
346
How do you mount a React element to the DOM?
import ReactDOM, use render method
347
What is Babel?
a JS compiler, toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JS in current and older browsers or environments/ and JSX
348
What is a Plug-in?
software component that adds a specific feature to an existing computer program, enabling customization
349
What is a Webpack loader?
transformations that are applied to the source code of a module
350
How can you make Babel and Webpack work together?
install babel-loader, use webpack.config.js
351
What is JSX?
a syntax extension to JS, using HTML syntax with JS
352
Why must the React object be imported when authoring JSX in a module?
uses React method i.e. createElement
353
How can you make Webpack and Babel work together to convert JSX into valid JS?
@babel/plugin-transform-react-jsx
354
What is a React component?
reusable part of UI, accept inputs and return React elements describing what should appear on the screen
355
How do you define a function component in React?
like a normal function, first letter should be capitalized
356
How do you mount a component to the DOM?
ReactDOM.render(element, parent)
357
What are props in React?
object that's passed as an argument
358
How do you pass props to a component?
prop => <>{prop.text}<>
359
How do you write JS expressions in JSX?
regular JS expressions wrapped in { }
360
How do you create "class" component in React?
class 'name' extends React.Component
361
How do you access props in a class component?
this.props
362
What is the purpose of state in React?
to determine what to display
363
How do you pass an event handler to a React element?
pass 'onClick' attribute, define function that handles the event
364
What 'Array' method is commonly used to create a list of React elements?
Array.map()
365
What is the best value to use as a "key" prop when rendering lists?
unique id
366
What are controlled components?
An input form element whose value is controlled by React, the React component that renders a form also controls what happens in that form on subsequent user input
367
What two props must you pass to an input for it to be "controlled"?
value, onChange
368
What does 'express.static()' return?
returns middleware
369
What is the local '__dirname' variable in a Node.js module?
returns string absolute path to parent directory
370
What does the 'join()' method of Node's 'path' module do?
join and return path of parameters
371
What does 'fetch()' return?
promise object
372
What is the default request method used by 'fetch()'?
get
373
How do you specify the request method ('get','post',etc) when calling 'fetch'?
second argument
374
When does React call a component's 'componentDidMount' method?
after constructor() -> static getDerivedStateFromProps() -> render() -> componentDidMount()
375
Name three React.Component lifecylce methods.
componentDidMount, componentDidUpdate, componentWillUnmount
376
How do you pass data to a child component?
props
377
What must the return value of 'myFunction' be if the following expression is possible? myFunction()();
return function
378
``` What does this code do? const wrap = value => () => value; ```
function that returns function ultimately returns original function???
379
In JavaScript, when is a function's scope determined; when it is called or when it is defined?
when it's defined
380
What allows JavaScript functions to "remember" values from their surroundings?
closure??