Senior Side Flashcards

(114 cards)

1
Q

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

A

{ } ; functions, loops, conditionals

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

What does block scope mean?

A

only variables within the block are avalible to use

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

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

A

block scope

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

What is the difference between let and const?

A

let can be reassigned; const cannot

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

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

A

Since the value of const is still the same array just changing the contents within

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

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

A

Use const first then decide if let it needed

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

What is destructuring, conceptually?

A

unpack values from array/properties into distinct variables

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

What is the syntax for Object destructuring?

A

const/let {propKeys: (new name) = objectName (from which object) }

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

What is the syntax for Array destructuring?

A

const/let [propKeys: (new name) = arrayName (from which array) ]

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

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

A

Which side is the = on

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

What is the syntax for writing a template literal?

A

use ` ` and ${ } for variables (instead of concatenation)

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

What is “string interpolation”?

A

Using ${ } for variables

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

What is the syntax for defining an arrow function?

A

(parameters) => { } OR () => {}

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

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

A

Automatically returns expression

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

How is the value of this determined within an arrow function?

A

enclosing scope; defined w/in function definition (usually at function call)

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

What is Node.js?

A

asynchronous event driven JS routine; executes JS outside the browser

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

What can Node.js be used for?

A

designed to build scalable network apps (command / http servers/clients)

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

What is a REPL?

A

Read-Event-Print loop

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

When was Node.js created?

A

2009

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

What is a CLI?

A

Command Line Interface

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

What is a GUI?

A

graphical user interface

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

What does the “man” command do?

A

the manual for other commands

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

What does the “cat” command do?

A

reads the file and can combine files

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

ls command?

A

list directory contents (-a for all -classify)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
pwd command?
print name of current working directory
26
echo command?
display a line of text
27
touch command?
if it exists, update the file timestamp or else, create it
28
mkdir command?
make directory (-parents)
29
mv command?
move (rename) files
30
rm command?
remove files (-f force)
31
cp command?
copy files & directories
32
What is a computer process?
a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity.
33
What is the process object in a Node.js program?
The process object is a global that provides information about, and control over, the current Node.js process.
34
How do you access the process object in a Node.js program?
process.argv[]
35
What is the data type of process.argv in Node.js?
An array
36
What is a JavaScript module?
seprate JavaScript files
37
What values are passed into a Node.js module's local scope?
__dirname, __filename, exports, module, require()
38
What is the purpose of module.exports in a Node.js module?
export code (a module) to another file; make avalible to other modules
39
How do you import functionality into a Node.js module from another Node.js module?
require()
40
What is the JavaScript Event Loop?
takes callbacks from callback que & puts it back into the stack after everything else has ran
41
What is different between "blocking" and "non-blocking" with respect to how code is executed?
how code sits in the stack. Blocking need to finish before other can run. Non-blocking runs after the stack is clear
42
What is a directory?
file system (folder)
43
What is a relative file path?
points to a file relative to the page
44
What is an absolute file path?
a full URL to a different file
45
What module does Node.js include for manipulating the file system?
'fs'
46
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile( )
47
Are file operations using the fs module synchronous or asynchronous?
both
48
What is NPM?
software registry; website, CLI, registry
49
What is a package?
module/file in a directory that can be added to your file and utilized
50
How can you create a package.json with npm?
mpm init -y
51
hat is a dependency and how to you add one to a package?
nmp install _____
52
What happens when you add a dependency to a package with npm?
node_modules directory gets created w/ fs
53
How do you add express to your package dependencies?
1. nmp init -y | 2. nmp install express
54
What Express application method starts the server and binds it to a network PORT?
app.listen(3000, )
55
How do you mount a middleware with an Express application?
app.use(path, callback)
56
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req & res
57
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
58
What is the significance of an HTTP request's method?
semantic
59
What does the express.json() middleware do and when would you need it?
mount the middleware; need it to get json body from client
60
What is a database schema?
collection of tables
61
What is a table?
a list of rows
62
What is a row?
data with the same attribute
63
What is one way to see if PostgreSQL is running?
Use the top command
64
What is a foreign key?
a column (attribute) that has the same values on separate tables (unique identifier)
65
How do you join two SQL tables?
join "tableName" using ("foreignKey")
66
How do you temporarily rename columns or tables in a SQL statement?
using the "as" keyword
67
How do you delete rows from a database table?
using the "delete" keyword with the table name
68
How do you accidentally delete all rows from a table?
not including the "WHERE" clause
69
How do you update rows in a database table?
using the "UPDATE" clause
70
Why is it important to include a where clause in your update statements?
So you do not change every single row (the entire column)
71
How do you add a row to a SQL table?
using the "INSERT" clause
72
What is a tuple?
values for the corresponding attributes
73
How do you add multiple rows to a SQL table at once?
use multiple tuples separated by commas
74
How to you get back the row being inserted into a table without a separate select statement?
use the "returning *"
75
What is Array.prototype.reduce useful for?
to take an array and create a single value by combining the array
76
What is Array.prototype.map useful for?
creates a new array populated w/ results of callback function going through each element of the array
77
What is Array.prototype.filter useful for?
creates a new array w/ elements that pass the test implemented by the callback function
78
What is "syntactic sugar"?
syntax designed to make things easier to read/express
79
What is the typeof an ES6 class?
function
80
Describe ES6 class syntax.
class keyword { }
81
What is "refactoring"?
restructuring exisiting code w/out changing the external behavior
82
What is Webpack?
Writes modules & supports any module format & handles resources & assests
83
How do you add a devDependency to a package?
using --save-dev (or -D) when installing with npm
84
What is an NPM script?
Inside the package.json; properties store so reference in the terminal
85
How do you execute Webpack with npm run?
add build to the package.json and the npm run build in the terminal
86
How are ES Modules different from CommonJS modules?
uses imports and export (export default for one fucnction/class per file) and
87
What kind of modules can Webpack support?
ECMA Script Modules, CommonJS Modules, AMD Modules, assests, Web Assebly Modules
88
What is React?
JS library for building user interfaces
89
What is a React element?
describes what you want to see on the screen (ex: const element =

Hello

)
90
How do you mount a React element to the DOM?
Using the React.createElement( )
91
What is Babel?
a JS complier (converts new JS syntax into older JS syntax)
92
What is a Plug-in?
not needed for program to run, but can be added in addition to customize
93
What is a Webpack loader?
allow you to pre-process files as you import/load them; can transform files from a diff language to JS
94
How can you make Babel and Webpack work together?
installing the bable-loader
95
What is JSX?
syntax extension to JS tha allows us to write HTML; JSX produces react "elements"
96
Why must the React object be imported when authoring JSX in a module?
When using JSX we are calling on methods from React; JSX tags = React.createElement( )
97
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
install bable loader and the extra plugin
98
What is a React component?
a function/class
99
How do you define a function component in React?
regular JS function except the name must be capitalized
100
How do you mount a component to the DOM?
using the react.render( )
101
What are props in React?
act as attributes in JSX files; similar to an argument in JS
102
How do you pass props to a component?
using props as a parameter
103
How do you write JavaScript expressions in JSX?
write a function with the name capitalized
104
How do you create "class" component in React?
class keyword, extends React.Component, { }, render( ),
105
How do you access props in a class component?
using the "this" object
106
What is the purpose of state in React?
Save for future reference; keep track of values that change over time
107
How to you pass an event handler to a React element?
needs to start with on / as a prop / with camel case; render( ) gets element from return value
108
What are controlled components?
takes its current value through props and notifies changes through callbacks like onChange
109
What two props must you pass to an input for it to be "controlled"?
props (value) and state (change)
110
What Array method is commonly used to create a list of React elements?
map( )
111
What is the best value to use as a "key" prop when rendering lists?
a string that is an unique identifier (usually an id prop)
112
What does express.static( ) return?
middleware function
113
What is the local __dirname variable in a Node.js module?
a string of the directory name of the current module
114
What does the join( ) method of Node's path module do?
joins all given path segments ((hello, hi) -> /hello/hi)