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
Q

What is a computer process?

A

a single program running on your computer

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

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

A

a lot. around 300

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

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

A

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

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

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

A

an object 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
29
Q

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

A

process is a global variable

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

What is a JavaScript module?

A

a single .js file

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

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

A

process and console

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

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

A

tells you what code can be accessed by other files

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

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

A

require function with the the file name and a ./ in front which indicates look at the current

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

What is the JavaScript Event Loop?

A

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

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

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

A

blocking code is code that is currently blocking the call stack

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

What is a directory?

A

a folder. a collection of files

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

What is a relative file path?

A

points to a file relative to the current page.

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

What is an absolute file path?

A

the full URL to a file

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

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

A

writeFile method

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

Are file operations using the fs module synchronous or asynchronous?

A

they’re both synch and asynch

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

What is a client?

A

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

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

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

A

GET

46
Q

What is on the first line of an HTTP request message?

A

request type

/ is the beginning of the target

47
Q

What is on the first line of an HTTP response message?

A

version, status code, and status text

48
Q

What are HTTP headers?

A

meta data about the request and response

49
Q

Is a body required for a valid HTTP message?

A

no

50
Q

What is NPM?

A

world’s largest software registry.
website,
command line interface,
registry

51
Q

What is a package?

A

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
Q

How can you create a package.json with npm?

A

cd into the folder and run the command: npm init –yes

53
Q

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

A

npm install (name of package here)

54
Q

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

A

downloads the package from the npm registry

55
Q

How do you add express to your package dependencies?

A

npm install express

56
Q

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

A

listen() method

57
Q

How do you mount a middleware with an Express application?

A

middleware method on express app like GET

58
Q

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

A

request response

req res

59
Q

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

A

request response

req res

60
Q

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

A

application/json charset= utf8

61
Q

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

A

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
Q

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

A

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
Q

What is PostgreSQL and what are some alternative relational databases?

A

relational database management system

MySQL, SQL Server by Microsoft, and Oracle by Oracle Corporation.

64
Q

What are some advantages of learning a relational database?

A

Many problem domains can be modeled well using a relational database.
support good guarantees about data integrity

65
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

66
Q

What is a database schema?

A

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
Q

What is a table?

A

Relational databases store data in relations, commonly referred to as tables

68
Q

What is a row?

A

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
Q

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

A

SQL is declarative programming language. There’s not really logic in it. You don’t tell what SQL to do

70
Q

How do you retrieve specific columns from a database table?

A

select keyword from keywords with values in double quotes

71
Q

How do you filter rows based on some specific criteria?

A

where

72
Q

What are the benefits of formatting your SQL?

A

consistent style and readability

73
Q

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

A

= greater than, less than, and not equals

74
Q

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

A

limit

75
Q

How do you retrieve all columns from a database table?

A

select *

76
Q

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

A

order by

77
Q

How do you add a row to a SQL table?

A

insert

78
Q

What is a tuple?

A

a list of values

79
Q

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

A

comma separated list of tuple1, tuple2, …

80
Q

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

A

with a returning asterisk

81
Q

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

A

to target specific rows

82
Q

How do you delete rows from a database table?

A

delete from name_of_table

where name_of_column = something

83
Q

How do you accidentally delete all rows from a table?

A

delete from name_of_table

84
Q

How do you accidentally delete all rows from a table?

A

delete from name_of_table

85
Q

What is a foreign key?

A

the attributes that connect two different tables

86
Q

How do you join two SQL tables?

A

with the join clause category using the foreign key

87
Q

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

A

as keyword

88
Q

What are some examples of aggregate functions?

A

sum(), count(), min(), max(), average()

89
Q

What is the purpose of a group by clause?

A

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

90
Q

What are the three states a Promise can be in?

A

pending, fulfilled, rejected

91
Q

How do you handle the fulfillment of a Promise?

A

then method

pass it a function

92
Q

How do you handle the rejection of a Promise?

A

optional second part of then method

or catch

93
Q

What is Array.prototype.filter useful for?

A

when you only want certain things from an array

94
Q

What is Array.prototype.map useful for?

A

apply the same function to every element of that array and return an array

95
Q

What is Array.prototype.reduce useful for?

A

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
Q

What is “syntactic sugar”?

A

syntax that makes it easier for people to read

97
Q

What is the typeof an ES6 class?

A

function

98
Q

Describe ES6 class syntax.

A

class keyword, function name curly braces constructor function parentheses, parameters curly braces this. parameter = parameter closing curly brace

99
Q

What is “refactoring”?

A

the process of restructuring existing computer code without changing its external behavior

100
Q

What is Webpack?

A

a static module bundler for modern JavaScript applicatons

101
Q

How do you add a devDependency to a package?

A

npm install [jquery] –save-dev

102
Q

What is an NPM script?

A

shortcut commands that runs a code that we installed on devDependencies and other npm registry files

103
Q

How do you execute Webpack with npm run?

A

npm run [name]

104
Q

How are ES Modules different from CommonJS modules?

A

different syntax

105
Q

What kind of modules can Webpack support?

A

ECMAScript Modules
CommonJS modules
AMD modules

106
Q

What is React?

A

React is a declarative, efficient, and flexible JavaScript library for building user interfaces.

107
Q

What is a React element?

A

A react element is plain object describing a component instance or DOM Node and its desired properties

108
Q

How do you mount a React Element to the DOM?

A

wit the ReactDOM.render() method

109
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 or environments

110
Q

What is a Plug-in

A

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

111
Q

What is a Webpack loader?

A

transformations that are applied to the source code of a module

112
Q

How you make Babel and Webpack work together?

A

with the webpack loaders