Senior Side Flashcards

1
Q

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

A

denoted by braces.

function definitions
conditional blocks
loop blocks

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

What does block scope mean?

A

declaring a variable inside the code block

variables only exist inside that 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

let variables can have values reassigned but the variable itself cannot be redeclared to another name. Const variables can’t be reassigned and redeclared.

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

only the reference cannot be changed but the value itself can be changed

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

if you are going to be reassigning the variable then use let and if not then use const

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

backticks and any variable or expression inside ${}

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

What is “string interpolation”?

A

substitute an expression or variable into a template literal

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

What is destructuring, conceptually?

A

unpacking values from arrays and assigning them into variables

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

variable declaration curly braces property keys equal sign and object being destructed

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

variable declaration square brackets elements and array being destructured

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

destructuring happens on the left side

creating happens on the right 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

doesn’t need a return keyword

implicit return

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

at definition 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

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
Give at least one use case for each of the commands listed.
man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp
A
man - look at manual
cat - concatenate files or print output
ls - list directory contents
pwd - print working directory
echo - display line of text
touch - change file timestamps
mkdir - make directories
mv - move (rename) files
rm - remove files
cp - copy files and directories
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the three virtues of a great programmer?

A

laziness, anger, hubris

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

What is Node.js?

A

javascript environment where you can run code outside of the browser

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

What can Node.js be used for?

A

build back end 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
22
Q

What is a REPL?

A

Read–eval–print loop

reads input, evals input, and prints

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

When was Node.js created?

A

2009

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

What back end languages have you heard of?

A

Java, C, C++, Python, C#, Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a computer process?
a single program running on your computer
26
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
a lot. around 300
27
Why should a full stack Web developer know that computer processes exist?
Full stack Web development is based on making multiple processes work together to form one application, so having at least a cursory awareness of computer processes is necessary
28
What is the process object in a Node.js program?
an object that provides information about, and control over, the current node.js process
29
How do you access the process object in a Node.js program?
process is a global variable
30
What is the data type of process.argv in Node.js?
array of strings
31
What is a JavaScript module?
a single .js file
32
What values are passed into a Node.js module's local scope?
exports, require, module, __filename, __dirname
33
Give two examples of truly global variables in a Node.js program.
process and console
34
What is the purpose of module.exports in a Node.js module?
tells you what code can be accessed by other files
35
How do you import functionality into a Node.js module from another Node.js module?
require function with the the file name and a ./ in front which indicates look at the current
36
What is the JavaScript Event Loop?
event loop is a process that keeps running and checks whether the call stack is empty or not. If the call stack is empty, it pushed the first item of the message queue into the call stack for execution
37
What is different between "blocking" and "non-blocking" with respect to how code is executed?
blocking code is code that is currently blocking the call stack
38
What is a directory?
a folder. a collection of files
39
What is a relative file path?
points to a file relative to the current page.
40
What is an absolute file path?
the full URL to a file
41
What module does Node.js include for manipulating the file system?
fs module
42
What method is available in the Node.js fs module for writing data to a file?
writeFile method
43
Are file operations using the fs module synchronous or asynchronous?
they're both synch and asynch
44
What is a client?
piece of computer hardware or software that accesses a service made available by a server as part of the client–server model of computer networks
45
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
46
What is on the first line of an HTTP request message?
request type | / is the beginning of the target
47
What is on the first line of an HTTP response message?
version, status code, and status text
48
What are HTTP headers?
meta data about the request and response
49
Is a body required for a valid HTTP message?
no
50
What is NPM?
world's largest software registry. website, command line interface, registry
51
What is a package?
reusable code. just a directory with one or more files in it that has a file called package.json that holds some meta data about the package
52
How can you create a package.json with npm?
cd into the folder and run the command: npm init --yes
53
What is a dependency and how to you add one to a package?
npm install (name of package here)
54
What happens when you add a dependency to a package with npm?
downloads the package from the npm registry
55
How do you add express to your package dependencies?
npm install express
56
What Express application method starts the server and binds it to a network PORT?
listen() method
57
How do you mount a middleware with an Express application?
middleware method on express app like GET
58
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request response | req res
59
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request response | req res
60
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json charset= utf8
61
What does the express.json() middleware do and when would you need it?
it parses incoming requests with JSON payloads and is based on body-parser. when your app needs to know how to parse JSON request bodies.
62
What is the significance of an HTTP request's method?
determines what action SHOULD be done with the given resource but programmer can make it do whatever if empty code block, then httpie freezes for 30s
63
What is PostgreSQL and what are some alternative relational databases?
relational database management system | MySQL, SQL Server by Microsoft, and Oracle by Oracle Corporation.
64
What are some advantages of learning a relational database?
Many problem domains can be modeled well using a relational database. support good guarantees about data integrity
65
What is one way to see if PostgreSQL is running?
sudo service postgresql status
66
What is a database schema?
A collection of tables is called a schema. 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.
67
What is a table?
Relational databases store data in relations, commonly referred to as tables
68
What is a row?
A table is a list of rows each having the same set of attributes. For example, all students in a "students" table could have "firstName", "lastName", and "dateOfBirth" attributes.
69
What is SQL and how is it different from languages like JavaScript?
SQL is declarative programming language. There's not really logic in it. You don't tell what SQL to do
70
How do you retrieve specific columns from a database table?
select keyword from keywords with values in double quotes
71
How do you filter rows based on some specific criteria?
where
72
What are the benefits of formatting your SQL?
consistent style and readability
73
What are four comparison operators that can be used in a where clause?
= greater than, less than, and not equals
74
How do you limit the number of rows returned in a result set?
limit
75
How do you retrieve all columns from a database table?
select *
76
How do you control the sort order of a result set?
order by
77
How do you add a row to a SQL table?
insert
78
What is a tuple?
a list of values
79
How do you add multiple rows to a SQL table at once?
comma separated list of tuple1, tuple2, ...
80
How do you get back the row being inserted into a table without a separate select statement?
with a returning asterisk
81
Why is it important to include a where clause in your update statements?
to target specific rows
82
How do you delete rows from a database table?
delete from name_of_table | where name_of_column = something
83
How do you accidentally delete all rows from a table?
delete from name_of_table
84
How do you accidentally delete all rows from a table?
delete from name_of_table
85
What is a foreign key?
the attributes that connect two different tables
86
How do you join two SQL tables?
with the join clause category using the foreign key
87
How do you temporarily rename columns or tables in a SQL statement?
as keyword
88
What are some examples of aggregate functions?
sum(), count(), min(), max(), average()
89
What is the purpose of a group by clause?
to separate rows into groups and perform aggregate functions on those groups of rows
90
What are the three states a Promise can be in?
pending, fulfilled, rejected
91
How do you handle the fulfillment of a Promise?
then method | pass it a function
92
How do you handle the rejection of a Promise?
optional second part of then method | or catch
93
What is Array.prototype.filter useful for?
when you only want certain things from an array
94
What is Array.prototype.map useful for?
apply the same function to every element of that array and return an array
95
What is Array.prototype.reduce useful for?
Executes a "reducer" callback function on each element of the array Passes the return value from the calculation on the preceding element The return value of reduce() is a single value
96
What is "syntactic sugar"?
syntax that makes it easier for people to read
97
What is the typeof an ES6 class?
function
98
Describe ES6 class syntax.
class keyword, function name curly braces constructor function parentheses, parameters curly braces this. parameter = parameter closing curly brace
99
What is "refactoring"?
the process of restructuring existing computer code without changing its external behavior
100
What is Webpack?
a static module bundler for modern JavaScript applicatons
101
How do you add a devDependency to a package?
npm install [jquery] --save-dev
102
What is an NPM script?
shortcut commands that runs a code that we installed on devDependencies and other npm registry files
103
How do you execute Webpack with npm run?
npm run [name]
104
How are ES Modules different from CommonJS modules?
different syntax
105
What kind of modules can Webpack support?
ECMAScript Modules CommonJS modules AMD modules
106
What is React?
React is a declarative, efficient, and flexible JavaScript library for building user interfaces.
107
What is a React element?
A react element is plain object describing a component instance or DOM Node and its desired properties
108
How do you mount a React Element to the DOM?
wit the ReactDOM.render() method
109
What is Babel?
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
110
What is a Plug-in
a software component that adds a specific featuer to an existing computer program
111
What is a Webpack loader?
transformations that are applied to the source code of a module
112
How you make Babel and Webpack work together?
with the webpack loaders