Senior Side Flashcards

1
Q

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

A

A code block is code grouped together with curly braces. Examples of this are after an if statement, for loop, or while loop. The code that will be executed if those conditions are met, or code to execute while we are iterating through the loop.

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 anytime there is a block of code within curly brackets, it’s going to create a specific environment for that particular code 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

They are both 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 allows reassignment, while const cannot be reassigned.

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

Because you’re changing the value of the array the const variable points to

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

Use let when you know the value of the variable will change, and use const for every other variable.

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

Variable declaration, variable name, assignment operator, opening backtick, string, closing backtick.

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 and objects and assign them to 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

Keyword for variable declaration, opening curly bracket, property name, colon, variable name, assignment operator, object name you’re destructuring from

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

Keyword for variable declaration, opening square bracket, variable name, closing square bracket, assignment operator, name of array you’re destructuring

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

if the curly braces or square brackets are on the left hand side of the assignment operator, it’s destructuring. If they’re on the right it’s creation.

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

For destructuring, what questions should you ask?

A

const { title: book1Title, author: book1Author, libraryID: book1LibraryID } = book1

What is being destructured?
example: title, author and libraryID

Where is it being destructured from?
example: From the book object

What is it being assigned to?
example: assigned to const variables title, author, and libraryID

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

What is the syntax for defining an arrow function?

A

Opening parentheses, parameter list, closing parentheses, arrow, expression wrapped in curly braces

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

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

Implicit return

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

How is the value of this determined within an arrow function?

A

The value of this is determined when the arrow function is DEFINED, not when it’s CALLED

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

What is a CLI?

A

A command line interface, which receives commands from a user in the form of lines of text

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

What is a GUI?

A

A graphical user interface, which 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
19
Q

Give at least one use case for each of the commands listed

A

Man - read the manual of any given command
Cat - concatenate files and prints them to your terminal
Ls - list the contents of a directory
Pwd - prints the current working directory
Echo - displays a line of text (think console.log for command line)
Touch - update timestamps to the file and creates a file
Mkdir - make a new directory
Mv - move or rename files
Rm - remove files or directories
Cp - copy files and directories

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

What is Node.js?

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

What can Node.js be used for?

A

to build back ends for Web applications, scalable systems, 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. It’s a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user (example: Google Dev Tools)

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

When was Node.js created?

A

May 27th, 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

Scripting - Python, JavaScript, Ruby, PHP, Perl
Compiled - C, C++, Golang, Haskell, Crystal, Rust
Partially compiled (jvm) - Java, Scala, Clojure, Kotlin
Partially compiled (.net clr) - C#, F#

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, and control over, the current Node.js 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

By using require(‘process’), or you can grab it out of thin air since it’s global

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

An 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

Blocks of encapsulated code that communicates with an external application on the basis of their related functionality

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 and 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

To make values and functionality available to other modules

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

Using module.exports to be able to export to another module, then use require with the relative path in string format

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

What is the JavaScript Event Loop?

A

a runtime model that is responsible for executing the code, collecting and processing events, and executing queued tasks

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

Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn’t block execution

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

What is a directory?

A

A collection of a group of files

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

What is a relative file path?

A

A file path that that is relative to the current directory you’re working in

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

What is an absolute file path?

A

A file path 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

writeFile method

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

Both. You get to pick.

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

What is a client?

A

A piece of hardware or software the sends requests to servers

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

What is a server?

A

A piece of hardware or software that sends responses to clients

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 on the first line of an HTTP request message?

A

HTTP Method (GET, POST), target (URL), HTTP version

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

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

A

Protocol version, status code, and status text

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

What are HTTP headers?

A

let the client and the server pass additional information with an HTTP request or response (kind of like the body of an html document)

47
Q

Is a body required for a valid HTTP message?

A

No

48
Q

What is NPM?

A

The website, the command line interface (CLI), and registry

49
Q

What is a package?

A

A directory with a package.json and with one or more files that contain bits of reusable code

50
Q

How can you create a package.json with npm?

A

Navigate to the root directory of your package and use the ‘npm init’ command with the –yes or -y flag

51
Q

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

A

Something your package needs in order to run. Create the package.json, then the ‘npm install (package name)’ in your root directory

52
Q

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

A

It updates the dependency property and installs the node modules

53
Q

How do you add express to your package dependencies?

A

‘npm install express’

54
Q

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

A

The listen method

55
Q

How do you mount a middleware with an Express application?

A

Using app.use() with req and res as arguments

56
Q

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

A

Request object and response object

57
Q

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

A

application/json

58
Q

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

A

It parses the incoming JSON request bodies, and you need it if you plan on handling incoming JSON request bodies

59
Q

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

A

The client expressing it’s intent, but the server can do whatever it wants

60
Q

What is PostgreSQL and what are some alternative relational databases?

A

PostgreSQL is a powerful, free, open source Relational Database Management System (RDBMS). Alternative relational databases are MySQL, SQL Server by Microsoft, and Oracle by Oracle Corporation.

61
Q

What are some advantages of learning a relational database?

A

They’re everywhere and if you learn one you’ll be able to use others because many relational databases use the same language.

62
Q

What is one way to see if PostgreSQL is running?

A

Use ‘sudo service postgresql status’ in the command line

63
Q

What is a database schema?

A

A collection of tables that defines how the data in a relational database should be organized

64
Q

What is a table?

A

A list of rows each having the same set of attributes

65
Q

What is a row?

A

A data record within a table

66
Q

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

A

SQL is a language used to interact with databases. It’s different from JavaScript because its declarative, meaning you describe the results you want and the programming environment comes up with its own plan for getting those results

67
Q

How do you retrieve specific columns from a database table?

A

Select statement, column(s) name in quotes (separated by commas), from clause, table name in quotes, end with semicolon

68
Q

How do you filter rows based on some specific criteria?

A

Where clause, column name in double quotes, =, column value in single quotes

69
Q

What are the benefits of formatting your SQL?

A

Consistent format and readability

70
Q

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

A

=, >, <, !=

71
Q

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

A

Limit clause, integer

72
Q

How do you retrieve all columns from a database table?

A

Select keyword, *

73
Q

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

A

Order by clause, criteria. Optionally add desc at the end

74
Q

How do you add a row to a SQL table?

A

Insert clause

75
Q

What is a tuple?

A

A list of values

76
Q

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

A

Insert clause, then put the tuple in parentheses, with values separated by commas

77
Q

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

A

Returning clause

78
Q

How do you update rows in a database table?

A

Update statement

79
Q

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

A

So you don’t update every row in the table

80
Q

How do you delete rows from a database table?

A

Delete statement

81
Q

How do you accidentally delete all rows from a table?

A

Not including the where clause

82
Q

What is a foreign key?

A

An ID from a table in a database that is linked to another table in a database that it can reference.

83
Q

How do you join two SQL tables?

A

Join clause with tables name in quotes then ‘using’ clause with foreign key in parenthesis and quotes

84
Q

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

A

From TABLE as ALIAS_NAME

85
Q

What are some examples of aggregate functions?

A

count(), sum(), avg(), every(), min()

86
Q

What is the purpose of a group by clause?

A

To organize data into similar groups

87
Q

What are the three states a Promise can be in?

A

Pending, rejected, fulfilled

88
Q

How do you handle the fulfillment of a Promise?

A

Then method, pass a callback function to deal with success case

89
Q

How do you handle the rejection of a Promise?

A

Catch method, pass a callback function to deal with failure case

90
Q

What is Array.prototype.filter useful for?

A

Returning a new array while excluding some elements

91
Q

What is Array.prototype.map useful for?

A

Returning a new array with modifications to elements

92
Q

What is Array.prototype.reduce useful for?

A

To reduce multiple values in an array to a single value

93
Q

What is “syntactic sugar”?

A

Taking a computer language and making it “sweeter” or more clear and concise for humans to read and understand

94
Q

What is the typeof an ES6 class?

A

Function

95
Q

Describe ES6 class syntax.

A
class NAMEOFCLASS {
     constructor(parameters) {
          this.parameters = parameters;
      }
}
96
Q

What is “refactoring”?

A

Reworking code to make it cleaner and/or more efficient

97
Q

What is Webpack?

A

a tool that lets you bundle your JavaScript applications

98
Q

How do you add a devDependency to a package?

A

npm install –save-dev

99
Q

What is an NPM script?

A

A property in your scripts that allows you to nickname your terminal commands

100
Q

How do you execute Webpack with npm run?

A

Npm run build

101
Q

How are ES Modules different from CommonJS modules?

A

ES modules are officially built in to the ECMAScript standard whereas CommonJS is a community built work around

102
Q

What kind of modules can Webpack support?

A

ECMAScript modules, CommonJS modules, and AMD modules

103
Q

What is React?

A

A frontend javascript framework library for building user interfaces faces

104
Q

What is a React element?

A

A plain javascript object

105
Q

How do you mount a React element to the DOM?

A

Call the render method on the root object and pass in the react element

106
Q

Difference between a library and a framework?

A

A framework has inversion of control

107
Q

What is Babel?

A

A compiler used to convert ECMAScript 2015+ into backwards compatible versions of JavaScript that older browsers use

108
Q

What is a Plug-in?

A

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

109
Q

What is a Webpack loader?

A

Loaders are transformations that are applied to the source code of a module

110
Q

How can you make Babel and Webpack work together?

A

Babel loader

111
Q

What is JSX?

A

A syntax extension for JavaScript that allows us to write HTML in React

112
Q

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

A

So when the code is transpiled into pure javascript, references to React will appear there

113
Q

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

A

Webpack, Babel, Babel loader, and JSX transform plugin