Senior Side Flashcards

1
Q

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

A

is code contained within { }. If else, for, while, function code blocks, etc

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

What does block scope mean?

A

variable defined exclusively within a block and cannot be accessed from outside the 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 withconstorlet?

A

block scope

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

What is the difference betweenletandconst?

A

let: is similar to var in that the value can be reassigned.
const: can not be reassigned and cannot be redeclared within the same scope

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 aconstvariable that points to anArray?

A

because you aren’t reassigning a variable you are adding to it, essentially you are telling it to store more information.

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 the variable can be reassigned use let, if the variable is something that you may not want to change and will be reused to avoid accidentally reassigning that variable 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

back ${variable} ticks

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 the syntax for defining an arrow function?

A

() optional parameters => optional {} expression to return

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

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

A

it has a implicit return expression (can’t have any statements)

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

How is the value ofthisdetermined within an arrow function?

A

The value of this in an arrow function is determined when the arrow function is being defined.

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

What is a GUI?

A

Graphical User Interface
is a form ofuser interfacethat allowsuserstointeract with electronic devicesthrough graphicaliconsand audio indicator such as primary notation, instead oftext-based user interfaces, typed command labels or text navigation.

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

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

man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp
A

man (manual)
cat (concatenate files and print on the standard output)
Ls (list directory contents)
pwd (print name of current/working directory)
echo (display a line of text)
touch (create file, change file timestamps)
mkdir (make directories)
mv (move (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
14
Q

What are the three virtues of a great programmer?

A

laziness, impatience, hubris

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

What is Node.js?

A

Node.js is 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
16
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
17
Q

What is a REPL?

A

read–eval–print loop

also termed aninteractive toplevelorlanguage shell, is a simple interactivecomputer programmingenvironment that takes single user inputs, 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
18
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
19
Q

What back end languages have you heard of?

A
Python
Php
Ruby
Java
c++
c#
Rust 
Golang 
Perl
Visual basic
Elixir 
Haskell 
C
Clojure 
Kotlin 
Wasm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is theprocessobject in a Node.js program?

A

global variable that provides information about node

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

How do you access theprocessobject in a Node.js program?

A

console.log(process)

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

What is the data type ofprocess.argvin Node.js?

A

array of strings

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

What is a JavaScript module?

A

its a single JavaScript file

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

What values are passed into a Node.js module’s local scope?

A

__dirname : The directory name of the current module.
__filename : The file name of the current module.
exports : A reference to themodule.exportsthat is shorter to type.
module : A reference to the current module
require() : idmodule name or path
Returns:exported module content
Used to import modules,JSON, and local files.

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

Give two examples oftrulyglobal variables in a Node.js program.

A

global, process, console

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

What is the purpose ofmodule.exportsin a Node.js module?

A

to export the file to be used elsewhere make functionality or values available to other modules.

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

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

A

use the require function and use the relative path to another module as the argument

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

What is the JavaScript Event Loop?

A

the order in which the javascript file is processed.

- waits for the call back to be cleared before pushing it on to the stack

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

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

A

blocking blocks future code from being executed
blocking is on the stack and blocks anything else
synchronous code is block, asynchronous is non-blocking

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

What is a directory?

A

a file that contains files or additional directories

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

What is a relative file path?

A

s a link to a file within the same file system / directory

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

What is an absolute file path?

A

exact location of a file starting from the root

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

What method is available in the Node.jsfsmodule for writing data to a file?

A

writeFile()

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

Are file operations using thefsmodule synchronous or asynchronous?

A

YES

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

What is a client?

A

A user or server requesting a service

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

What is a server?

A

Something that provides a service. Receives requests and sends responses (almost always refers to a computer program/process)
Technical term for the hardware (HOST) (servers are the programs running on the hosts)

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

What is on the first line of an HTTPrequestmessage?

A

HTTP Method
URL (request target)
HTTP protocol version (almost always 1.1)

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

What is on the first line of an HTTPresponsemessage?

A

Theprotocol version, usuallyHTTP/1.1.
Astatus code, indicating success or failure of the request. Common status codes are200,404, or302
Astatus text. A brief, purely informational, textual description of the status code to help a human understand the HTTP message.

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

What are HTTP headers?

A

META data

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

Is a body required for a valid HTTP message?

A

No

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

What is NPM?

A

Node Package Manager
is a software registry
- a large public database of JavaScript software and the meta-information surrounding it.

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

What is a package?

A

directory contains package.json

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

How can you create apackage.jsonwithnpm?

A

npm init - -yes

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

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

A

a library that a project needs to function effectively

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

hat happens when you add a dependency to a package withnpm?

A
package gets downloaded into a nodes_module 
adds package to json
48
Q

How do you addexpressto your package dependencies?

A

npm install express

49
Q

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

A

.listen()

50
Q

How do you mount a middleware with an Express application?

A

.use()

51
Q

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

A

req and res

52
Q

What is the appropriateContent-Typeheader for HTTP messages that contain JSON in their bodies?

A

application.json;

53
Q

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

A

if incoming request has json body, it parses it

54
Q

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

A

communications only

Must respond with something

55
Q

What is PostgreSQL and what are some alternative relational databases?

A

Relational DatabaseManagement System (RDBMS)
Present the data to the user asrelations as tables

MySQL, SQL Server by Microsoft, and Oracle.

56
Q

What are some advantages of learning a relational database?

A

learn SQL
a lot of databases use SQL

everyone uses it

57
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

top

58
Q

What does ACID stand for?

A

Atomicity: An atomic transaction is an indivisible and irreducible series of database operations such that either [all occurs, or nothing occurs]

Consistency: Any data written to the database must be valid according to all defined rules,

Isolation: TLDR; whether the data base confirms data has been written, before it’s finished or after the data is on disk.

           A lower isolation level increases the ability of many users to access the same data at the same time, but increases the 
           number of concurrency effects (such as dirty reads or lost updates) users might encounter. Conversely, a higher 
           isolation level reduces the types of concurrency effects that users may encounter, but requires more system 
           resources and increases the chances that one transaction will block another. 

Durability: [guarantees that transactions that have committed will survive permanently.] For example, if a flight booking reports that a seat has successfully been booked, then the seat will remain booked even if the system crashes.[1]

59
Q

What is a database schema?

A

A collection oftables. Aschemadefines how the data in a relational database should be organized

60
Q

What is a table?

A

list of rows each having the same attribute (column)

61
Q

What is a row?

A

horizontal data that is related (grouped)

62
Q

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

A

is a language to communicate with databases. A declarativeprogramming language

JavaScript is imperative tell it what to do and how to do it

63
Q

How do you retrieve specific columns from a database table?

A

select “columnName”

from “tableName”

64
Q

How do you filter rows based on some specific criteria?

A

where “column” comparison operator item

65
Q

What are the benefits of formatting your SQL?

A

Organization

66
Q

What are four comparison operators that can be used in awhereclause?

A

= > < !=

67
Q

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

A

limit

68
Q

How do you retrieve all columns from a database table?

A

select *

69
Q

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

A

order by “columnName”

70
Q

How do you add a row to a SQL table?

A

insert into “tableName” (“columns”)

values (‘data’)

71
Q

What is a tuple?

A

a list of values in parenthesis

72
Q

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

A

multiple tuples

73
Q

How do you get back the row being inserted into a table without a separateselectstatement?

A

returning *

74
Q

How do you update rows in a database table?

A

update “tableName”
Set “column name” = ‘ ‘
Where “column name” = ‘value

75
Q

Why is it important to include awhereclause in yourupdatestatements?

A

so you don’t update the entire column

76
Q

How do you delete rows from a database table?

A

delete from “tableName”

where

77
Q

How do you accidentally delete all rows from a table?

A

didn’t add a where clause

78
Q

What is a foreign key?

A

is a common column from another table

the value in that column

79
Q

How do you join two SQL tables?

A

join “tableName” using (“commonColumn”)

80
Q

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

A

as keyword

81
Q

What are some examples of aggregate functions?

A

min max avg count sum

82
Q

What is the purpose of agroup byclause?

A

divide up rows to apply the group by clause to those specific rows
agg function will apply to all data set

83
Q

What are the three states a Promise can be in?

A

pending: initial state, neither fulfilled nor rejected.
fulfilled: meaning that the operation was completed successfully.
rejected: meaning that the operation failed.

84
Q

How do you handle the fulfillment of a Promise?

A

then()

85
Q

How do you handle the rejection of a Promise?

A

.catch()

86
Q

What isArray.prototype.filteruseful for?

A

to sort arrays based on a condition

87
Q

What isArray.prototype.mapuseful for?

A

To manipulate all indexes of an array based on a condition

88
Q

What isArray.prototype.reduceuseful for?

A

Combining the elements of an array into a single value.

89
Q

What is “syntactic sugar”?

A

syntaxwithin aprogramming languagethat is designed to make things easier to read or to express

90
Q

What is thetypeofan ES6 class?

A

function

91
Q

Describe ES6 class syntax.

A
class key word, name of class {
		constructor(parameters) {
		this.param = param
                }
Methods() {
}
92
Q

What is “refactoring”?

A

code refactoringis the process of restructuring existingcomputer code—changing thefactoring—without changing its external behavior

93
Q

What is Webpack?

A

At its core,webpackis astatic module bundlerfor modern JavaScript applications. When webpack processes your application, it internally builds adependency graphfrom one or moreentry pointsand then combines every module your project needs into one or morebundles, which are static assets to serve your content from.

94
Q

How do you add adevDependencyto a package?

A

npm install nameOfDependency —save-dev

95
Q

What is an NPM script?

A

command line commands

Build is used for bundling or compiling

96
Q

How do you execute Webpack withnpm run?

A

npm run nameOfKey (build)

97
Q

How are ES Modules different from CommonJS modules?

A

es mods: because they have Dif key words

commonJS we call a function and assign a value

98
Q

What kind of modules can Webpack support?

A
ECMAScript modules
CommonJS modules
AMD modules
Assets
WebAssembly modules
99
Q

What is React?

A

is a JavaScript library for create user interfaces

100
Q

What is a React element?

A

its an object NOT a Dom element

that describes what the Dom should look like

101
Q

How do you mount a React element to the DOM?

A
const $container = document.querySelector('#root');
const root = ReactDOM.createRoot($container);
root.render(element);
102
Q

What is Babel?

A

JavaScript compiler, converts new syntax into old syntax

103
Q

What is a Plug-in?

A

is asoftware componentthat adds a specific feature to an existingcomputer program.
“adds extra features”

104
Q

What is a Webpack loader?

A

something you can add to pre-process the code

transformations that are applied to the source code of a module

105
Q

How can you make Babel and Webpack work together?

A

babel loader

106
Q

What is JSX?

A

a syntax extension for JavaScript that describes what the UI should look like.

107
Q

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

A

React has to be in the scope because it has to call the createElement();

108
Q

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

A

loader: ‘babel-loader’,
options: {
plugins: [
‘@babel/plugin-transform-react-jsx’

109
Q

What is a React component?

A

Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.

110
Q

How do you define a function component in React?

A
function key word, name of component (starts with capital, any props {
	return the jsx element you want to create }
111
Q

How do you mount a component to the DOM?

A
const container = document.querySelector('#root');
const root = ReactDOM.createRoot(container);

root.render(element);

112
Q

What are props in React?

A

objects containing properties of the react element you are creating

113
Q

How do you pass props to a component?

A

as a paramenter

114
Q

How do you write JavaScript expressions in JSX?

A

{ }

115
Q

How do you create “class” component in React?

A
class ClassName extends React.Component {
	render() {
	return React element
116
Q

How do you access props in a class component?

A

this.props.propName