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
How do you import functionality into a Node.js module from another Node.js module?
Use require function and pass in path to file
26
What is a directory?
A folder that lists other files
27
What is a relative file path?
starts with ./ or leave it off
28
What is an absolute file path?
The full path from the root of file system
29
What module does Node.js include for manipulating the file system?
fs
30
What method is available in the Node.js fs module for writing data to a file?
writeFile
31
Are file operations using the fs module synchronous or asynchronous?
both writefile sync is blocking so is syncrhnous whereas writeFile is asynch
32
What is JSON?
javascript object notation-data interchange format
33
What are serialization and deserialization and why are they useful?
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.
34
How to you serialize data into a JSON string using JavaScript?
JSON.stringify
35
How do you deserialize a JSON string using JavaScript?
JSON.parse
36
What is NPM?
Node package manager- npm consists of three distinct components: • the website • the Command Line Interface (CLI) • the registry
37
What is a package in npm?
A file or directory that is described by a package.json file
38
How can you create a package.json with npm?
npm init or npm init --yes
39
What is a dependency and how to you add one to a package?
Something that your application requires and just use npm install
40
What happens when you add a dependency to a package with npm?
Installs files inside the node_modules folder of your current directory
41
What is a client?
and service requesters, called clients
42
What is a server?
providers of a resource or service, called servers,
43
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
44
What is the format of an HTTP request message?
Starting line with method and target, headers, and body
45
What is the format of an HTTP response message?
Status line, headers, and body
46
How do you add express to your package dependencies?
npm installing it
47
What Express application method binds the server to a network PORT?
.listen
48
How do you register a middleware with an Express application?
Use method and passing in a callback function with two parameters req and res
49
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request object, response object, and next function call
50
What is the Content-Type header of HTTP requests and responses used for?
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
What does express.static() return?
function
52
What is the local __dirname variable in a Node.js module?
Directory that the file itself is in
53
What does the join() method of Node's path module do?
Concatenates all the arguments into one string while adding backslashes
54
What is the appropriate Content-Type header for requests and responses that contain JSON in their bodies?
application/json
55
What does the express.json() middleware do and when would you need it?
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
What is the significance of an HTTP request's method?
Its just semantics
57
What is Webpack?
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
How do you add a devDependency to a package?
npm install package –save-dev
59
What is an NPM script?
npm scripts are, well, scripts. We use scripts to automate repetitive tasks. is literally a command line command inside of package json
60
How do you execute Webpack with npm run?
npm install build (or any other command inside script tag, it's arbitrary)
61
What is an ES6 module and how is it different from a CommonJS module?
have import and export vs require and module.export | browsers can use es6 modules but not commonJS
62
What kind of modules can Webpack support?
supports a ton of module types
63
What is React?
React is an open-source JavaScript library for building user interfaces.
64
What is a React element?
It is an object. using JS objects to describe DOM elements
65
How do you mount a React element to the DOM?
Render method of the reactDOM
66
What is Babel?
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
What is a Plug-in?
software component that adds extra functionality to a computer program. an enhancement
68
What is a Webpack loader?
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
How can you make Babel and Webpack work together?
In webpack.config.js add the loader for babel-loader
70
What is JSX?
Javascript syntax extension that allows you to write HTML in javascript (React)
71
Why must the React object be imported when authoring JSX in a module?
jsx tags compiles into React.createElement. Ex. The h1 tag is actually a function call
72
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Add the plugin transform react and also the babel-loader
73
What is a React component?
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
How do you define a function component in React?
like a regular function but with a capital letter function otherwise interpreted as HTML tag
75
How do you mount a component to the DOM?
Render method of react dom object but make sure to have angle brackets around react element like < element />
76
What are props in React?
Is an object that are properties of React Element
77
How do you pass props to a component?
Prop name with equal then value
78
How do you write JavaScript expressions in JSX?
curly braces
79
What Array method is commonly used to create a list of React elements?
map
80
What is the best value to use as a "key" prop when rendering lists?
string that uniquely identifies item (most commonly to use ids from data)
81
How do you create "class" component in React?
extend react.component and must have at least a render method
82
How do you access props in a class component?
use this.props
83
What is the purpose of state in React?
Keep track of things that change over time
84
How to you pass an event handler to a React element?
pass in event handler as a prop as a function
85
What are controlled components and how do you work with them?
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
What are the three states a Promise can be in?
Pending, fulfilled, and rejected
87
How do you handle the fulfillment of a Promise?
.then method and pass in a callback function
88
How do you handle the rejection of a Promise?
.catch method and pass in callback function or put in a second callback to the then method
89
What does fetch() return?
promise object that returns a response
90
What is the default request method used by fetch()?
GET
91
How do you specify the request method (GET, POST, etc.) when calling fetch?
Second argument of fetch as an object with method key
92
When does React call a component's componentDidMount method?
After component is mounted on DOM (after first render runs)
93
Name three React.Component lifecycle methods.
Constructor, render, componentdidmount
94
How do you pass data to a child component?
props
95
What is PostgreSQL and what are some alternative relational databases?
A relational database. sqlite, mySQL
96
What are some advantages of learning a relational database?
Support good guarantees about data integrity and widely used.
97
What is one way to see if PostgreSQL is running?
Sudo service postgresql status or check top
98
What is a database schema?
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
What is a table?
a list of rows each having the same set of attributes
100
What is a row?
A homogenous set of attributes. each row has same attributes
101
What is SQL and how is it different from languages like JavaScript?
declarative programming (issue description and it figures out what to do) language like html and css. JS is imperative(issue instructions)
102
How do you retrieve specific columns from a database table?
Select keyword followed by a comma separated list of the identifier in double quotes
103
How do you filter rows based on some specific criteria?
Where clause and can use comparative operators like = < > !=
104
What are the benefits of formatting your SQL?
easier to read and change
105
What are four comparison operators that can be used in a where clause?
operators like = < > !=
106
How do you limit the number of rows returned in a result set?
Limit clause
107
How do you retrieve all columns from a database table?
Select *
108
How do you control the sort order of a result set?
Order by clause
109
How do you add a row to a SQL table?
insert into "table name" () values ()
110
What is a tuple?
list of values
111
How do you add multiple rows to a SQL table at once?
insert into () values (), (), ()
112
How to you get back the row being inserted into a table without a separate select statement?
returning *;
113
How do you update rows in a database table?
update "table" set "name"='key' where "id"='id'
114
Why is it important to include a where clause in your update statements?
will update everything
115
How do you delete rows from a database table?
delete from "table name" where
116
How do you accidentally delete all rows from a table?
delete from "table name"
117
What is a foreign key?
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
How do you join two SQL tables?
select from join using
119
How do you temporarily rename columns or tables in a SQL statement?
Use the as alias
120
What are some examples of aggregate functions?
sum, count, max, min
121
What is the purpose of a group by clause?
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.