Senior Flashcards

1
Q

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

A

A code block refers to code within curly brackets. i.e. for, if, function

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

What does block scope mean?

A

block scope means that the variable defined within a block will not be accessible from outside the block.

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

You can update let but you can’t update const

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

This happens because the constant is storing a reference to the array.

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

Ask yourself if you’re going to need to update that variable later.

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

What is the syntax for writing a template literal?

A

Hello my name is ${variable}.

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

What is “string interpolation”

A

the ability to substitute part of the string for the values of variables or expressions

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

What is destructuring, conceptually?

A

extracting data from arrays or objects

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

What is the syntax for Object destructuring?

A

let { property1: variable1, property2: variable2 } = object

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

What is the syntax for Array destructuring?

A

let [ x, y, z ] = array

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

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

A

brackets on the left side

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

( ) => { }

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

implicit returns

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

value of this is determined during the definition time whereas in a regular function, this is defined in call time

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

What is a CLI?

A

Command Line Interface

- processes commands to a computer in the form of lines of text

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

What is a GUI?

A

Graphical User Interface

- a form of user interface that allows users to interact with electronic devices through graphical icons

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

What is Node.js?

A

Node.js is a program that allows JavaScript to be run outside of a web browser. It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

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

What can Node.js be used for?

A

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

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

What is a REPL?

A

Read-eval-print loop
- a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user.

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

When was Node.js created?

A

2009

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

What back end languages have you heard of?

A

JavaScript, PHP, Ruby, Python, Java, Go, Node JS

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

What is a computer process?

A

a running instance of a program

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

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

A

back end stuff like client side, api, and databases

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

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

A

a global object that provides information about the current working process

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

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

A

just type process

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

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

A

array of strings

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

What is a JavaScript module?

A

A single JavaScript file

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

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

A

exports, require, module, __filename, __dirname

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

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

A

console, process

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

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

A

It’s purpose is so that the function/object/array can be used in a different module (js file)

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

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

A

require function

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

What is the JavaScript Event Loop?

A

The Event Loop is what allows us to asynchronously call functions.

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

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

A

something is blocking when something is currently processing in the call stack, something that is non blocking is running but not part of the call stack like webAPIs

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

What is a directory?

A

a file system which contains references to other computer files/directories

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

What is a relative file path?

A

refers to a location that is relative to a current directory

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

What is an absolute file path?

A

always contains the root element and the complete directory list required to locate the file

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

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

A

fs module

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

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

A

fs.writeFile( )

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

Are file operations using the fs module synchronous or asynchronous

A

asynchronous

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

What is NPM?

A

Node Package Manager

It’s a way to reuse code from other developers and also a way to share your code with them

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

What is a package?

A

The reusable code

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

How can you create a package.json with npm?

A

npm init

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

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

A

When you install an npm package using npm install, you are installing it as a dependency.
npm install

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

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

A

npm will download dependencies that are listed in package.json

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

How do you add express to your package dependencies?

A

npm install express

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

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

A

listen

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

How do you mount a middleware with an Express application?

A

app.use

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

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

A

request, response, and the next middleware function in the application’s request-response cycle

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

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

A

application/json

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

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

A
  • it parses incoming requests with JSON payloads

- when we need to parse incoming data

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

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

A

semantics, describes what we are trying to do

- express our intent

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

What is PostgreSQL and what are some alternative relational databases?

A

A relational database

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

What are some advantages of learning a relational database?

A
  • they support good guarantees about data integrity
  • they can store and modify data in a way that makes data corruption as unlikely as possible
  • most widely used kind of database
55
Q

What is one way to see if PostgreSQL is running?

A
  • top command

- postgreSQL status

56
Q

What is a database schema?

A
  • a collection of tables
  • a rule how data gets stored
  • a schema defines how the data in a relational database should be organized
57
Q

What is a table?

A

a database object that organizes and stores data in a structured format
- a list of rows

58
Q

What is a row?

A
  • a list of attributes
59
Q

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

A

SQL is imperative vs JS is declarative

60
Q

How do you retrieve specific columns from a database table?

A

select and from

61
Q

How do you filter rows based on some specific criteria?

A

where clause with the category name and value name

  • = operator is a comparison operator not assignment
  • has to evaluate true or false
62
Q

What are the benefits of formatting your SQL?

A

easier to read

easier to debug

63
Q

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

A

= != < >

64
Q

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

A

limit clause

65
Q

How do you retrieve all columns from a database table?

A

*

66
Q

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

A

order by clause

67
Q

How do you add a row to a SQL table?

A

insert into

68
Q

What is a tuple?

A

a list of values

69
Q

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

A

specifying more than one tuple of values, separated by commas

70
Q

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

A

returning *

71
Q

How do you update rows in a database table?

A

update and where clause

72
Q

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

A

So you don’t accidentally update a large amount of your data

73
Q

How do you delete rows from a database table?

A

delete from and where clause

74
Q

How do you accidentally delete all rows from a table?

A

if you don’t have a where clause

75
Q

What is a foreign key?

A

A column or multiple columns that is used to establish a link between the data in two different tables

76
Q

How do you join two SQL tables?

A

join table using foreign key

77
Q

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

A

as

78
Q

What are some examples of aggregate functions?

A

avg, count, max, min, sum

79
Q

What is the purpose of a group by clause?

A

separate rows into groups and perform aggregate functions on those groups of rows.

80
Q

What are the three states a Promise can be in?

A

pending, fulfilled, rejected

81
Q

How do you handle the fulfillment of a Promise?

A

.then

82
Q

How do you handle the rejection of a Promise?

A

.catch

83
Q

What is Array.prototype.filter useful for?

A

filter an array based on a specific condition

84
Q

What is Array.prototype.map useful for?

A

iterate over an array and manipulate each item into a new array

85
Q

What is Array.prototype.reduce useful for?

A

executes a reducer function on each element of the array and returns a single output value

86
Q

What is “syntactic sugar”?

A

syntax that is designed to make things easier to read or to express

87
Q

What is the typeof an ES6 class?

A

function

88
Q

Describe ES6 class syntax.

A
class Example {
     constructor( ) {
 } }
89
Q

What is “refactoring”?

A

change the structure of the code but the behavior remains the same

90
Q

What is Webpack?

A

It’s a tool that lets you bundle your JS applications

91
Q

How do you add a devDependency to a package?

A

–save-dev

92
Q

What is an NPM script?

A

a convenient way to bundle common shell commands for your project

93
Q

How do you execute Webpack with npm run ?

A

add a script and npm run (script name)

94
Q

How are ES Modules different from CommonJS modules

A

syntax is different, ES Module syntax is part of the language, CommonJS is a community library, static vs dynamic

95
Q

What kind of modules can Webpack support?

A

ECMAscript, CommonJS, AMD modules, and Web Assembly

96
Q

What is React?

A

JavaScript framework for building user interfaces

97
Q

What is a React element?

A

it is a plain object that describes what the DOM should look like

98
Q

How do you mount a React element to the DOM?

A

ReactDOM.render( )

99
Q

What is Babel?

A

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

100
Q

What is a Plug-in?

A

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

101
Q

What is a Webpack loader?

A

loaders are the 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.

102
Q

How can you make Babel and Webpack work together?

A

babel-loader

103
Q

What is JSX?

A

a syntax extension to JavaScript

104
Q

Why must the React object be imported when authoring JSX in a module? (import React from ‘react’)

A

After Babel transformed your code which is written with JSX elements, into the React. createElement calls, you can see where React is used

  • because it is used in the final code that Babel outputs
  • the <h1> is actually React.createElement( )</h1>
105
Q

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

A

jsx transform

babel loader

106
Q

What is a React component?

A

javascript function/class that returns a react element

107
Q

How do you define a function component in React?

A

constructor functions

108
Q

How do you mount a component to the DOM?

A

ReactDOM.render( )

109
Q

What are props in React?

A

props are objects passed into React components as an arguments

110
Q

How do you pass props to a component?

A

by using attribute-like values on the react element

111
Q

How do you write JavaScript expressions in JSX?

A

using { }

112
Q

How do you create “class” component in React?

A

define a class that extends the Component and has a render function

113
Q

How do you access props in a class component?

A

props property of the this object

- this.props

114
Q

What is the purpose of state in React?

A

to represent the current situation of the component

- the values you put in state changes over time

115
Q

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

A

onClick={ }

116
Q

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

A

pass it in as props but camelCased with { } for the values

117
Q

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

A

map

118
Q

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

A

unique primitive

119
Q

What are controlled components?

A

An input form element whose value is controlled by React

120
Q

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

A

onChange, value

121
Q

What does express.static( ) return?

A

middleware function

122
Q

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

A

the absolute path of the directory containing the current module

123
Q

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

A

joins all given ‘path’ segments together and normalizes the resulting path

124
Q

What does fetch( ) return?

A

promise

125
Q

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

A

GET

126
Q

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

A

pass an init obj

127
Q

When does React call a component’s componentDidMount method?

A

after the first successful render( )

128
Q

Name three React.Component lifecycle methods.

A

ComponentDidMount( )
ComponentDidUpdate( )
ComponentWillUnmount( )

129
Q

How do you pass data to a child component?

A

props

130
Q

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

myFunction( ) ( );

A

return function definition

131
Q

What does this code do?

const wrap = value => ( ) => value;

A

an anonymous function is being defined and in the code block, another anonymous function is being defined and the return value is value and all of that is being assigned to the const variable wrap

132
Q

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

A

when it is defined

133
Q

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

A

closures