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
Give two examples of truly global variables in a Node.js program.
global, process, console
26
What is the purpose of module.exports in a Node.js module?
to export the file to be used elsewhere make functionality or values available to other modules.
27
How do you import functionality into a Node.js module from another Node.js module?
use the require function and use the relative path to another module as the argument
28
What is the JavaScript Event Loop?
the order in which the javascript file is processed. | - waits for the call back to be cleared before pushing it on to the stack
29
What is different between "blocking" and "non-blocking" with respect to how code is executed?
blocking blocks future code from being executed blocking is on the stack and blocks anything else synchronous code is block, asynchronous is non-blocking
30
What is a directory?
a file that contains files or additional directories
31
What is a relative file path?
s a link to a file within the same file system / directory
32
What is an absolute file path?
exact location of a file starting from the root
33
What module does Node.js include for manipulating the file system?
fs module
34
What method is available in the Node.js fs module for writing data to a file?
writeFile()
35
Are file operations using the fs module synchronous or asynchronous?
YES
36
What is a client?
A user or server requesting a service
37
What is a server?
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)
38
Which HTTP method does a browser issue to a web server when you visit a URL?
get()
39
What is on the first line of an HTTP request message?
HTTP Method URL (request target) HTTP protocol version (almost always 1.1)
40
What is on the first line of an HTTP response message?
The protocol version, usually HTTP/1.1. A status code, indicating success or failure of the request. Common status codes are 200, 404, or 302 A status text. A brief, purely informational, textual description of the status code to help a human understand the HTTP message.
41
What are HTTP headers?
META data
42
Is a body required for a valid HTTP message?
No
43
What is NPM?
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
44
What is a package?
directory contains package.json
45
How can you create a package.json with npm?
npm init - -yes
46
What is a dependency and how to you add one to a package?
a library that a project needs to function effectively
47
hat happens when you add a dependency to a package with npm?
``` package gets downloaded into a nodes_module adds package to json ```
48
How do you add express to your package dependencies?
npm install express
49
What Express application method starts the server and binds it to a network PORT?
.listen()
50
How do you mount a middleware with an Express application?
.use()
51
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req and res
52
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application.json;
53
What does the express.json() middleware do and when would you need it?
if incoming request has json body, it parses it
54
What is the significance of an HTTP request's method?
communications only | Must respond with something
55
What is PostgreSQL and what are some alternative relational databases?
Relational Database Management System (RDBMS) Present the data to the user as relations as tables MySQL, SQL Server by Microsoft, and Oracle.
56
What are some advantages of learning a relational database?
learn SQL a lot of databases use SQL
 everyone uses it
57
What is one way to see if PostgreSQL is running?
sudo service postgresql status | top
58
What does ACID stand for?
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
What is a database schema?
A collection of tables. A schema defines how the data in a relational database should be organized
60
What is a table?
list of rows each having the same attribute (column)
61
What is a row?
horizontal data that is related (grouped)
62
What is SQL and how is it different from languages like JavaScript?
is a language to communicate with databases. A declarative programming language JavaScript is imperative tell it what to do and how to do it
63
How do you retrieve specific columns from a database table?
select "columnName" | from "tableName"
64
How do you filter rows based on some specific criteria?
where “column” comparison operator item
65
What are the benefits of formatting your SQL?
Organization
66
What are four comparison operators that can be used in a where clause?
= > < !=
67
How do you limit the number of rows returned in a result set?
limit
68
How do you retrieve all columns from a database table?
select *
69
How do you control the sort order of a result set?
order by “columnName”
70
How do you add a row to a SQL table?
insert into “tableName” (“columns”) | values (‘data’)
71
What is a tuple?
a list of values in parenthesis
72
How do you add multiple rows to a SQL table at once?
multiple tuples
73
How do you get back the row being inserted into a table without a separate select statement?
returning *
74
How do you update rows in a database table?
update “tableName” Set “column name” = ‘ ‘ Where “column name” = ‘value
75
Why is it important to include a where clause in your update statements?
so you don’t update the entire column
76
How do you delete rows from a database table?
delete from “tableName” | where
77
How do you accidentally delete all rows from a table?
didn’t add a where clause
78
What is a foreign key?
is a common column from another table | the value in that column
79
How do you join two SQL tables?
join “tableName” using (“commonColumn”)
80
How do you temporarily rename columns or tables in a SQL statement?
as keyword
81
What are some examples of aggregate functions?
min max avg count sum
82
What is the purpose of a group by clause?
divide up rows to apply the group by clause to those specific rows agg function will apply to all data set
83
What are the three states a Promise can be in?
pending: initial state, neither fulfilled nor rejected. fulfilled: meaning that the operation was completed successfully. rejected: meaning that the operation failed.
84
How do you handle the fulfillment of a Promise?
then()
85
How do you handle the rejection of a Promise?
.catch()
86
What is Array.prototype.filter useful for?
to sort arrays based on a condition
87
What is Array.prototype.map useful for?
To manipulate all indexes of an array based on a condition
88
What is Array.prototype.reduce useful for?
Combining the elements of an array into a single value.
89
What is "syntactic sugar”?
syntax within a programming language that is designed to make things easier to read or to express
90
What is the typeof an ES6 class?
function
91
Describe ES6 class syntax.
``` class key word, name of class { constructor(parameters) { this.param = param } Methods() { } ```
92
What is “refactoring"?
code refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior
93
What is Webpack?
At its core, webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph from one or more entry points and then combines every module your project needs into one or more bundles, which are static assets to serve your content from.
94
How do you add a devDependency to a package?
npm install nameOfDependency —save-dev
95
What is an NPM script?
command line commands | Build is used for bundling or compiling
96
How do you execute Webpack with npm run?
npm run nameOfKey (build)
97
How are ES Modules different from CommonJS modules?
es mods: because they have Dif key words | commonJS we call a function and assign a value
98
What kind of modules can Webpack support?
``` ECMAScript modules CommonJS modules AMD modules Assets WebAssembly modules ```
99
What is React?
is a JavaScript library for create user interfaces
100
What is a React element?
its an object NOT a Dom element | that describes what the Dom should look like
101
How do you mount a React element to the DOM?
``` const $container = document.querySelector('#root'); const root = ReactDOM.createRoot($container); root.render(element); ```
102
What is Babel?
JavaScript compiler, converts new syntax into old syntax
103
What is a Plug-in?
is a software component that adds a specific feature to an existing computer program. “adds extra features”
104
What is a Webpack loader?
something you can add to pre-process the code | transformations that are applied to the source code of a module
105
How can you make Babel and Webpack work together?
babel loader
106
What is JSX?
a syntax extension for JavaScript that describes what the UI should look like.
107
Why must the React object be imported when authoring JSX in a module?
React has to be in the scope because it has to call the createElement();
108
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
loader: 'babel-loader', options: { plugins: [ '@babel/plugin-transform-react-jsx'
109
What is a React component?
Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.
110
How do you define a function component in React?
``` function key word, name of component (starts with capital, any props { return the jsx element you want to create } ```
111
How do you mount a component to the DOM?
``` const container = document.querySelector('#root'); const root = ReactDOM.createRoot(container); ``` root.render(element);
112
What are props in React?
objects containing properties of the react element you are creating
113
How do you pass props to a component?
as a paramenter
114
How do you write JavaScript expressions in JSX?
{ }
115
How do you create "class" component in React?
``` class ClassName extends React.Component { render() { return React element ```
116
How do you access props in a class component?
this.props.propName