SeniorSide Flashcards

1
Q

What are the three great virtues of a programmer?

A

Laziness, Impatience, Hubris

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

Name at least one use case for each of the commands listed in this exercise.

A

Cat- print contents of something
Ls- see the contents of current directory
Pwd- see the path of where you are
Echo- command line version of console.log
Touch- if touch a file that doesn’t exist then it gets created. Otherwise, its access time gets updated to right now
Mkdir- make new directory
Mv- renaming files or moving files
Rm- deleting or remove files, but if directory then use -r
Cp- copy a file

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

What is a GUI?

A

“gooey” graphical user interface. Ex. Finder in mac is a GUI for manipulating file system or file explorer in windows

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

What is a CLI?

A

Command line interface

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

What is Array.prototype.filter useful for?

A

creates a new array while excluding certain items

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

What is Array.prototype.map useful for?

A

creates a new array with transformed array elements

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

What is Array.prototype.reduce useful for?

A

combines the items of array into a single thing

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

What is Node.js?

A

A program that allows Javascript to be run outside of a web browser

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

What can Node.js be used for?

A

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
10
Q

What is a REPL?

A

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple, interactive computer programming environment that takes single user inputs (i.e., single expressions), evaluates (executes) them, and returns the result to the user; a program written in a REPL environment is executed piecewise.

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

When was Node.js created?

A

2009

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

What back end languages have you heard of?

A

node.js, Python, PHP, Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
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. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.[1][2]

While a computer program is a passive collection of instructions, a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being executed.

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

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

a lot, about 470 when i checked

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

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

A

Because their job is to make processes talk to each other and computer applications are made of multiple processes

You will create a client (browser application) and own server on same computer

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

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

A

Process object is global (accessible everywhere without declaring it) and 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
17
Q

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

A

use the process keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
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
19
Q

What is the JavaScript Event Loop?

A

Tool for observing when call stack is empty so it can move item from task queue to call stack (JavaScript has a concurrency model based on an event loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks. This model is quite different from models in other languages like C and Java.

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

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

A

Blocking is when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes. This happens because the event loop is unable to continue running JavaScript while a blocking operation is occurring.
Blocking methods execute synchronously and non-blocking methods execute asynchronously.
Blocking code is code executing on the call stack right now and non-blocking is code on the callback queue

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

What is a JavaScript module?

A

a javascript file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
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
23
Q

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

A

process, clearInterval

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

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

A

to provide functionality to other modules

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

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

A

Use require function and pass in path to file

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

What is a directory?

A

A folder that lists other files

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

What is a relative file path?

A

starts with ./ or leave it off

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

What is an absolute file path?

A

The full path from the root of file system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
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
30
Q

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

A

writeFile

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

Are file operations using the fs module synchronous or asynchronous?

A

both
writefile sync is blocking so is syncrhnous
whereas writeFile is asynch

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

What is JSON?

A

javascript object notation-data interchange format

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

What are serialization and deserialization and why are they useful?

A

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.
Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.

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

How to you serialize data into a JSON string using JavaScript?

A

JSON.stringify

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

How do you deserialize a JSON string using JavaScript?

A

JSON.parse

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

What is NPM?

A

Node package manager- npm consists of three distinct components:
• the website
• the Command Line Interface (CLI)
• the registry

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

What is a package in npm?

A

A file or directory that is described by a package.json file

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

How can you create a package.json with npm?

A

npm init or npm init –yes

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

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

A

Something that your application requires and just use npm install

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

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

A

Installs files inside the node_modules folder of your current directory

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

What is a client?

A

and service requesters, called clients

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

What is a server?

A

providers of a resource or service, called servers,

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

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

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

What is the format of an HTTP request message?

A

Starting line with method and target, headers, and body

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

What is the format of an HTTP response message?

A

Status line, headers, and body

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 installing it

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

What Express application method binds the server 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 register a middleware with an Express application?

A

Use method and passing in a callback function with two parameters req and res

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 object, response object, and next function call

50
Q

What is the Content-Type header of HTTP requests and responses used for?

A

The Content-Type entity header is used to indicate the media type of the resource.
In responses, a Content-Type header tells the client what the content type of the returned content actually is.

51
Q

What does express.static() return?

A

function

52
Q

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

A

Directory that the file itself is in

53
Q

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

A

Concatenates all the arguments into one string while adding backslashes

54
Q

What is the appropriate Content-Type header for requests and responses that contain JSON in their bodies?

A

application/json

55
Q

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

A

middleware that parses and body param in the request object as a JSON object, When the client sends data and server receives the data as JSON

56
Q

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

A

Its just semantics

57
Q

What is Webpack?

A

Webpack is an open-source JavaScript module bundler. It is made primarily for JavaScript, but it can transform front-end assets like HTML, CSS, and images if the corresponding loaders are included. webpack takes modules with dependencies and generates static assets representing those modules

58
Q

How do you add a devDependency to a package?

A

npm install package –save-dev

59
Q

What is an NPM script?

A

npm scripts are, well, scripts. We use scripts to automate repetitive tasks. is literally a command line command inside of package json

60
Q

How do you execute Webpack with npm run?

A

npm install build (or any other command inside script tag, it’s arbitrary)

61
Q

What is an ES6 module and how is it different from a CommonJS module?

A

have import and export vs require and module.export

browsers can use es6 modules but not commonJS

62
Q

What kind of modules can Webpack support?

A

supports a ton of module types

63
Q

What is React?

A

React is an open-source JavaScript library for building user interfaces.

64
Q

What is a React element?

A

It is an object. using JS objects to describe DOM elements

65
Q

How do you mount a React element to the DOM?

A

Render method of the reactDOM

66
Q

What is Babel?

A

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

67
Q

What is a Plug-in?

A

software component that adds extra functionality to a computer program. an enhancement

68
Q

What is a Webpack loader?

A

Loaders are transformations that are applied to the source code of a module. They allow you to pre-process files as you import or “load” them.

Webpack can apply loaders to files

69
Q

How can you make Babel and Webpack work together?

A

In webpack.config.js add the loader for babel-loader

70
Q

What is JSX?

A

Javascript syntax extension that allows you to write HTML in javascript (React)

71
Q

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

A

jsx tags compiles into React.createElement. Ex. The h1 tag is actually a function call

72
Q

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

A

Add the plugin transform react and also the babel-loader

73
Q

What is a React component?

A

Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen. function that returns react elements

74
Q

How do you define a function component in React?

A

like a regular function but with a capital letter function otherwise interpreted as HTML tag

75
Q

How do you mount a component to the DOM?

A

Render method of react dom object but make sure to have angle brackets around react element like < element />

76
Q

What are props in React?

A

Is an object that are properties of React Element

77
Q

How do you pass props to a component?

A

Prop name with equal then value

78
Q

How do you write JavaScript expressions in JSX?

A

curly braces

79
Q

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

A

map

80
Q

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

A

string that uniquely identifies item (most commonly to use ids from data)

81
Q

How do you create “class” component in React?

A

extend react.component and must have at least a render method

82
Q

How do you access props in a class component?

A

use this.props

83
Q

What is the purpose of state in React?

A

Keep track of things that change over time

84
Q

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

A

pass in event handler as a prop as a function

85
Q

What are controlled components and how do you work with them?

A

When you change (onChange), then notify us so then update state and then passes back in the new value. So input element has value with state and onChange event

86
Q

What are the three states a Promise can be in?

A

Pending, fulfilled, and rejected

87
Q

How do you handle the fulfillment of a Promise?

A

.then method and pass in a callback function

88
Q

How do you handle the rejection of a Promise?

A

.catch method and pass in callback function or put in a second callback to the then method

89
Q

What does fetch() return?

A

promise object that returns a response

90
Q

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

A

GET

91
Q

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

A

Second argument of fetch as an object with method key

92
Q

When does React call a component’s componentDidMount method?

A

After component is mounted on DOM (after first render runs)

93
Q

Name three React.Component lifecycle methods.

A

Constructor, render, componentdidmount

94
Q

How do you pass data to a child component?

A

props

95
Q

What is PostgreSQL and what are some alternative relational databases?

A

A relational database. sqlite, mySQL

96
Q

What are some advantages of learning a relational database?

A

Support good guarantees about data integrity and widely used.

97
Q

What is one way to see if PostgreSQL is running?

A

Sudo service postgresql status or check top

98
Q

What is a database schema?

A

A collection of tables. A schema defines how the data in a relational database should be organized. In relational databases, you typically have to define your schema up front and the database server will make sure that any data being written to the database conforms to that schema.

99
Q

What is a table?

A

a list of rows each having the same set of attributes

100
Q

What is a row?

A

A homogenous set of attributes. each row has same attributes

101
Q

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

A

declarative programming (issue description and it figures out what to do) language like html and css. JS is imperative(issue instructions)

102
Q

How do you retrieve specific columns from a database table?

A

Select keyword followed by a comma separated list of the identifier in double quotes

103
Q

How do you filter rows based on some specific criteria?

A

Where clause and can use comparative operators like = < > !=

104
Q

What are the benefits of formatting your SQL?

A

easier to read and change

105
Q

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

A

operators like = < > !=

106
Q

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

A

Limit clause

107
Q

How do you retrieve all columns from a database table?

A

Select *

108
Q

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

A

Order by clause

109
Q

How do you add a row to a SQL table?

A

insert into “table name” () values ()

110
Q

What is a tuple?

A

list of values

111
Q

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

A

insert into () values (), (), ()

112
Q

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

A

returning *;

113
Q

How do you update rows in a database table?

A

update “table” set “name”=’key’ where “id”=’id’

114
Q

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

A

will update everything

115
Q

How do you delete rows from a database table?

A

delete from “table name” where

116
Q

How do you accidentally delete all rows from a table?

A

delete from “table name”

117
Q

What is a foreign key?

A

data attribute that two tables have the same value of . but dont need to be same column name (so dont have to do something like [using (“supplierId”)]. but can do join “suppliers” on “products”.”supplierId” = “suppliers”.”id”

118
Q

How do you join two SQL tables?

A

select from join using

119
Q

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

A

Use the as alias

120
Q

What are some examples of aggregate functions?

A

sum, count, max, min

121
Q

What is the purpose of a group by clause?

A

Instead, you want to separate rows into groups and perform aggregate functions on those groups of rows. This is done with a group by clause.