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
What is the process object in a Node.js program?
a global object that provides information about, and control over, the current Node.js process.
26
How do you access the process object in a Node.js program?
By using require(‘process’), or you can grab it out of thin air since it’s global
27
What is the data type of process.argv in Node.js?
An array of strings
28
What is a JavaScript module?
Blocks of encapsulated code that communicates with an external application on the basis of their related functionality
29
What values are passed into a Node.js module's local scope?
Exports, require, module, _filename, _dirname
30
Give two examples of truly global variables in a Node.js program.
Console and process
31
What is the purpose of module.exports in a Node.js module?
To make values and functionality available to other modules
32
How do you import functionality into a Node.js module from another Node.js module?
Using module.exports to be able to export to another module, then use require with the relative path in string format
33
What is the JavaScript Event Loop?
a runtime model that is responsible for executing the code, collecting and processing events, and executing queued tasks
34
What is different between "blocking" and "non-blocking" with respect to how code is executed?
Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn't block execution
35
What is a directory?
A collection of a group of files
36
What is a relative file path?
A file path that that is relative to the current directory you’re working in
37
What is an absolute file path?
A file path contains the root element and the complete directory list required to locate the file
38
What module does Node.js include for manipulating the file system?
Fs module
39
What method is available in the Node.js fs module for writing data to a file?
writeFile method
40
Are file operations using the fs module synchronous or asynchronous?
Both. You get to pick.
41
What is a client?
A piece of hardware or software the sends requests to servers
42
What is a server?
A piece of hardware or software that sends responses to clients
43
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
44
What is on the first line of an HTTP request message?
HTTP Method (GET, POST), target (URL), HTTP version
45
What is on the first line of an HTTP response message?
Protocol version, status code, and status text
46
What are HTTP headers?
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
Is a body required for a valid HTTP message?
No
48
What is NPM?
The website, the command line interface (CLI), and registry
49
What is a package?
A directory with a package.json and with one or more files that contain bits of reusable code
50
How can you create a package.json with npm?
Navigate to the root directory of your package and use the ‘npm init’ command with the –yes or -y flag
51
What is a dependency and how do you add one to a package?
Something your package needs in order to run. Create the package.json, then the ‘npm install (package name)’ in your root directory
52
What happens when you add a dependency to a package with npm?
It updates the dependency property and installs the node modules
53
How do you add express to your package dependencies?
‘npm install express’
54
What Express application method starts the server and binds it to a network PORT?
The listen method
55
How do you mount a middleware with an Express application?
Using app.use() with req and res as arguments
56
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
Request object and response object
57
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
58
What does the express.json() middleware do and when would you need it?
It parses the incoming JSON request bodies, and you need it if you plan on handling incoming JSON request bodies
59
What is the significance of an HTTP request's method?
The client expressing it’s intent, but the server can do whatever it wants
60
What is PostgreSQL and what are some alternative relational databases?
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
What are some advantages of learning a relational database?
They’re everywhere and if you learn one you’ll be able to use others because many relational databases use the same language.
62
What is one way to see if PostgreSQL is running?
Use ‘sudo service postgresql status’ in the command line
63
What is a database schema?
A collection of tables that defines how the data in a relational database should be organized
64
What is a table?
A list of rows each having the same set of attributes
65
What is a row?
A data record within a table
66
What is SQL and how is it different from languages like JavaScript?
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
How do you retrieve specific columns from a database table?
Select statement, column(s) name in quotes (separated by commas), from clause, table name in quotes, end with semicolon
68
How do you filter rows based on some specific criteria?
Where clause, column name in double quotes, =, column value in single quotes
69
What are the benefits of formatting your SQL?
Consistent format and readability
70
What are four comparison operators that can be used in a where clause?
=, >, <, !=
71
How do you limit the number of rows returned in a result set?
Limit clause, integer
72
How do you retrieve all columns from a database table?
Select keyword, *
73
How do you control the sort order of a result set?
Order by clause, criteria. Optionally add desc at the end
74
How do you add a row to a SQL table?
Insert clause
75
What is a tuple?
A list of values
76
How do you add multiple rows to a SQL table at once?
Insert clause, then put the tuple in parentheses, with values separated by commas
77
How do you get back the row being inserted into a table without a separate select statement?
Returning clause
78
How do you update rows in a database table?
Update statement
79
Why is it important to include a where clause in your update statements?
So you don’t update every row in the table
80
How do you delete rows from a database table?
Delete statement
81
How do you accidentally delete all rows from a table?
Not including the where clause
82
What is a foreign key?
An ID from a table in a database that is linked to another table in a database that it can reference.
83
How do you join two SQL tables?
Join clause with tables name in quotes then ‘using’ clause with foreign key in parenthesis and quotes
84
How do you temporarily rename columns or tables in a SQL statement?
From TABLE as ALIAS_NAME
85
What are some examples of aggregate functions?
count(), sum(), avg(), every(), min()
86
What is the purpose of a group by clause?
To organize data into similar groups
87
What are the three states a Promise can be in?
Pending, rejected, fulfilled
88
How do you handle the fulfillment of a Promise?
Then method, pass a callback function to deal with success case
89
How do you handle the rejection of a Promise?
Catch method, pass a callback function to deal with failure case
90
What is Array.prototype.filter useful for?
Returning a new array while excluding some elements
91
What is Array.prototype.map useful for?
Returning a new array with modifications to elements
92
What is Array.prototype.reduce useful for?
To reduce multiple values in an array to a single value
93
What is "syntactic sugar"?
Taking a computer language and making it “sweeter” or more clear and concise for humans to read and understand
94
What is the typeof an ES6 class?
Function
95
Describe ES6 class syntax.
``` class NAMEOFCLASS { constructor(parameters) { this.parameters = parameters; } } ```
96
What is "refactoring"?
Reworking code to make it cleaner and/or more efficient
97
What is Webpack?
a tool that lets you bundle your JavaScript applications
98
How do you add a devDependency to a package?
npm install --save-dev
99
What is an NPM script?
A property in your scripts that allows you to nickname your terminal commands
100
How do you execute Webpack with npm run?
Npm run build
101
How are ES Modules different from CommonJS modules?
ES modules are officially built in to the ECMAScript standard whereas CommonJS is a community built work around
102
What kind of modules can Webpack support?
ECMAScript modules, CommonJS modules, and AMD modules
103
What is React?
A frontend javascript framework library for building user interfaces faces
104
What is a React element?
A plain javascript object
105
How do you mount a React element to the DOM?
Call the render method on the root object and pass in the react element
106
Difference between a library and a framework?
A framework has inversion of control
107
What is Babel?
A compiler used to convert ECMAScript 2015+ into backwards compatible versions of JavaScript that older browsers use
108
What is a Plug-in?
A software that adds a specific feature to an existing computer program
109
What is a Webpack loader?
Loaders are transformations that are applied to the source code of a module
110
How can you make Babel and Webpack work together?
Babel loader
111
What is JSX?
A syntax extension for JavaScript that allows us to write HTML in React
112
Why must the React object be imported when authoring JSX in a module?
So when the code is transpiled into pure javascript, references to React will appear there
113
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Webpack, Babel, Babel loader, and JSX transform plugin