Senior Side Flashcards

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
Q

pwd command?

A

print name of current working directory

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

echo command?

A

display a line of text

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

touch command?

A

if it exists, update the file timestamp or else, create it

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

mkdir command?

A

make directory (-parents)

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

mv command?

A

move (rename) files

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

rm command?

A

remove files (-f force)

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

cp command?

A

copy files & directories

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

What is a computer process?

A

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.

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

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

A

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

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

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

A

process.argv[]

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

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

A

An array

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

What is a JavaScript module?

A

seprate JavaScript files

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

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

A

__dirname, __filename, exports, module, require()

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

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

A

export code (a module) to another file; make avalible to other modules

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

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

A

require()

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

What is the JavaScript Event Loop?

A

takes callbacks from callback que & puts it back into the stack after everything else has ran

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

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

A

how code sits in the stack. Blocking need to finish before other can run. Non-blocking runs after the stack is clear

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

What is a directory?

A

file system (folder)

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

What is a relative file path?

A

points to a file relative to the page

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

What is an absolute file path?

A

a full URL to a different file

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

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

A

‘fs’

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

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

A

fs.writeFile( )

47
Q

Are file operations using the fs module synchronous or asynchronous?

A

both

48
Q

What is NPM?

A

software registry; website, CLI, registry

49
Q

What is a package?

A

module/file in a directory that can be added to your file and utilized

50
Q

How can you create a package.json with npm?

A

mpm init -y

51
Q

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

A

nmp install _____

52
Q

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

A

node_modules directory gets created w/ fs

53
Q

How do you add express to your package dependencies?

A
  1. nmp init -y

2. nmp install express

54
Q

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

A

app.listen(3000, )

55
Q

How do you mount a middleware with an Express application?

A

app.use(path, callback)

56
Q

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

A

req & res

57
Q

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

A

application/json

58
Q

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

A

semantic

59
Q

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

A

mount the middleware; need it to get json body from client

60
Q

What is a database schema?

A

collection of tables

61
Q

What is a table?

A

a list of rows

62
Q

What is a row?

A

data with the same attribute

63
Q

What is one way to see if PostgreSQL is running?

A

Use the top command

64
Q

What is a foreign key?

A

a column (attribute) that has the same values on separate tables (unique identifier)

65
Q

How do you join two SQL tables?

A

join “tableName” using (“foreignKey”)

66
Q

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

A

using the “as” keyword

67
Q

How do you delete rows from a database table?

A

using the “delete” keyword with the table name

68
Q

How do you accidentally delete all rows from a table?

A

not including the “WHERE” clause

69
Q

How do you update rows in a database table?

A

using the “UPDATE” clause

70
Q

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

A

So you do not change every single row (the entire column)

71
Q

How do you add a row to a SQL table?

A

using the “INSERT” clause

72
Q

What is a tuple?

A

values for the corresponding attributes

73
Q

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

A

use multiple tuples separated by commas

74
Q

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

A

use the “returning *”

75
Q

What is Array.prototype.reduce useful for?

A

to take an array and create a single value by combining the array

76
Q

What is Array.prototype.map useful for?

A

creates a new array populated w/ results of callback function going through each element of the array

77
Q

What is Array.prototype.filter useful for?

A

creates a new array w/ elements that pass the test implemented by the callback function

78
Q

What is “syntactic sugar”?

A

syntax designed to make things easier to read/express

79
Q

What is the typeof an ES6 class?

A

function

80
Q

Describe ES6 class syntax.

A

class keyword { }

81
Q

What is “refactoring”?

A

restructuring exisiting code w/out changing the external behavior

82
Q

What is Webpack?

A

Writes modules & supports any module format & handles resources & assests

83
Q

How do you add a devDependency to a package?

A

using –save-dev (or -D) when installing with npm

84
Q

What is an NPM script?

A

Inside the package.json; properties store so reference in the terminal

85
Q

How do you execute Webpack with npm run?

A

add build to the package.json and the npm run build in the terminal

86
Q

How are ES Modules different from CommonJS modules?

A

uses imports and export (export default for one fucnction/class per file) and

87
Q

What kind of modules can Webpack support?

A

ECMA Script Modules, CommonJS Modules, AMD Modules, assests, Web Assebly Modules

88
Q

What is React?

A

JS library for building user interfaces

89
Q

What is a React element?

A

describes what you want to see on the screen (ex: const element = <h1> Hello </h1>)

90
Q

How do you mount a React element to the DOM?

A

Using the React.createElement( )

91
Q

What is Babel?

A

a JS complier (converts new JS syntax into older JS syntax)

92
Q

What is a Plug-in?

A

not needed for program to run, but can be added in addition to customize

93
Q

What is a Webpack loader?

A

allow you to pre-process files as you import/load them; can transform files from a diff language to JS

94
Q

How can you make Babel and Webpack work together?

A

installing the bable-loader

95
Q

What is JSX?

A

syntax extension to JS tha allows us to write HTML; JSX produces react “elements”

96
Q

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

A

When using JSX we are calling on methods from React; JSX tags = React.createElement( )

97
Q

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

A

install bable loader and the extra plugin

98
Q

What is a React component?

A

a function/class

99
Q

How do you define a function component in React?

A

regular JS function except the name must be capitalized

100
Q

How do you mount a component to the DOM?

A

using the react.render( )

101
Q

What are props in React?

A

act as attributes in JSX files; similar to an argument in JS

102
Q

How do you pass props to a component?

A

using props as a parameter

103
Q

How do you write JavaScript expressions in JSX?

A

write a function with the name capitalized

104
Q

How do you create “class” component in React?

A

class keyword, extends React.Component, { }, render( ),

105
Q

How do you access props in a class component?

A

using the “this” object

106
Q

What is the purpose of state in React?

A

Save for future reference; keep track of values that change over time

107
Q

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

A

needs to start with on / as a prop / with camel case; render( ) gets element from return value

108
Q

What are controlled components?

A

takes its current value through props and notifies changes through callbacks like onChange

109
Q

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

A

props (value) and state (change)

110
Q

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

A

map( )

111
Q

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

A

a string that is an unique identifier (usually an id prop)

112
Q

What does express.static( ) return?

A

middleware function

113
Q

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

A

a string of the directory name of the current module

114
Q

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

A

joins all given path segments ((hello, hi) -> /hello/hi)