Misc Flashcards

1
Q

What is a CLI?

A

-command-line interface (Bash, Cmder)

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

What is a GUI?

A

-graphical user interface (VS Code, MS Windows/Mac displays)

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

Give at least one use case for this command:

-man

A

-man man (prints the manual for manual)

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

Give at least one use case for this command:

-cat

A

-cat three-virtues.txt (prints the txt from the txt file)

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

Give at least one use case for this command:

-ls

A

-ls (prints the contents of current directory)

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

Give at least one use case for this command:

-pwd

A

-pwd (prints the address of your current working directory)

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

Give at least one use case for this command:

-echo

A

-echo ‘Hello, World!’ > hello.txt (inserts ‘Hello, World!’ into hello.txt file)

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

Give at least one use case for this command:

-touch

A

-touch new-file.txt (creates a new file and updates its timestamp)

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

Give at least one use case for this command:

-mkdir

A

-mkdir parent (creates a new directory)

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

Give at least one use case for this command:

-mv

A

-mv pokiemans pokemon (renames pokiemans directory to pokemon)

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

Give at least one use case for this command:

-rm

A

-rm extraneous.txt (removes extraenous.txt)

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

Give at least one use case for this command:

-cp

A

-cp original.txt copyOf.txt (makes a copyOf.txt file from original.txt)

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

What are some back end languages?

A

-JavaScript, Python, PHP, Java, Ruby, C, C#, C++, Rust, Perl, Swift, Go

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

What makes JavaScript unique?

A

-prototypal inheritance, “this”, event loops, closure

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

What is a computer process?

A

-an instance of a computer program that is being executed

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

What is NPM?

A
  • node package manager
  • a software registry where developers can share and borrow packages
  • has: website, registry, CLI
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a package?

A
  • aka a “module”, containing bits of reusable code

- exists as a directory with package + package.json + other files

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

How can you create a package.json with npm?

A
  1. navigate to the root directory of your package

2. “npm init -y” (default package.json) or “npm init” (manually answer prompts)

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

What is package.json?

A
  • lists the packages your project depends on
  • specifies versions of a package that your project can use
  • makes your build reproducible, and therefore easier to share with other developers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

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

A
  • a package that your package needs in order to work

- add new dependencies by installing them in the root directory of your package “npm install” and adding “–save”

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

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

A
  • allows the project to install the versions of the modules it depends on
  • by running “npm install”, you can install all of the dependencies that are listed in the project’s package.json
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What does “npm init” do?

A

“npm init” is a command to scaffold out your project

“npm init –yes” will instantly initialize a project with default values

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

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

A
  1. The protocol version, usually HTTP/1.1
  2. A status code, indicating success or failure of the request (200, 404, 302…)
  3. A status text. A brief, human-readable, informational text about the status code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

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

A
  1. HTTP method (POST, GET, PUT, HEAD, OPTIONS, etc)
  2. request target (URL)
  3. HTTP version
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is express js?

A

-a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications

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

How do you add express to your package dependencies?

A

npm install express in your root directory or manually edit package.json

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

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

A

listen()

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

What is the difference between the internet and the web?

A

internet: network of computers
web: the links between documents (messaging format called HTTP)

29
Q

How do you mount a middleware with an Express application?

A

app.use()

30
Q

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

A

req, res

31
Q

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

A

application/json

32
Q

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

A
  • express.json() is a built-in function in Express that parses incoming requests with JSON payloads
  • you would need this when you want to parse JSON request bodies
33
Q

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

A

-indicates what type of request is being made to the web server, and the corresponding action that will be performed on whatever resource you’re accessing

34
Q

What do the following HTTP verbs do?

  • POST
  • GET
  • PUT
  • DELETE
A

POST: creates
GET: reads
PUT: updates
DELETE: deletes

35
Q

What is “syntactic sugar”?

A

-syntax that makes things easier for humans to read or express

36
Q

What is “refactoring”?

A

-restructuring code while preserving its existing functionality

37
Q

What is Webpack?

A

a tool that lets you bundle your JavaScript applications (bundles all your modules into one)

38
Q

How do you add a devDependency to a package?

A

–save-dev when you npm install

39
Q

What is an NPM script?

A

An npm script that bundles common shell commands for your project

40
Q

How do you execute Webpack with npm run?

A

-by adding a script that runs Webpack into “scripts” in package.json

41
Q

How are ES Modules different from CommonJS modules?

A
  • syntax is different:
    • ES6: import/export
    • CommonJS: require/module.exports
  • CommonJS modules load dependencies on demand while executing the code
  • ES6 modules are pre-parsed in order to resolve further imports before code is executed
42
Q

What kind of modules can Webpack support?

A

ES6, CommonJS, AMD modules

43
Q

What is Babel?

A

Babel is a JavaScript compiler mainly used to convert ES6 code into a backwards compatible version of JavaScript

44
Q

What is a Plug-in?

A

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

45
Q

What is a Webpack loader?

A

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

46
Q

How can you make Babel and Webpack work together?

A

install ‘babel-loader’ and include loader: ‘babel-loader’ in package.json

@@@ my answer… @@@
1) in package.json, add a script that will build the app using Webpack+Babel:
“scripts”: {
“build”: “webpack”}

2) npm run build
3) modify in index.html to load the compiled version:

47
Q

What does express.static() return?

A
  • express.static() is a built-in middleware function that serves static files
  • returns an object that has the requested static files
48
Q

What is the local __dirname variable in a Node.js module?

A

-tells you the absolute path of the directory containing the currently executing file

49
Q

What does the join() method of Node’s path module do?

A

path.join() joins all given path segments together into one path

50
Q

What does fetch() return?

A

Calling fetch() returns a promise. We can then wait for the promise to resolve by passing a handler with the then() method of the promise. That handler receives the return value of the fetch promise, a Response object

51
Q

What is the default request method used by fetch()?

A

GET

52
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

put the request method after the resource url, as part of the optional fetch() parameters

syntax:
fetch(url, [options])

example:
fetch(url, {method: ‘POST’})
.then(response => response.json())
.then(data => console.log(data));

53
Q

When does React call a component’s componentDidMount method?

A

after first successful render to the DOM. constructor and render must run successfully

54
Q

Name three React.Component lifecycle methods.

A
constructor(),
render(),
componentDidMount(),
componentDidUpdate(),
componentWillUnmount()
55
Q

How do you pass data to a child component?

A

through the props

56
Q

What must the return value of myFunction be if the following expression is possible?
myFunction()();

A

must return the inner (nested) function of the first function. calling a function n immediately calling its return value

57
Q
What does this code do?
const wrap = value => () => value;
A

assigns a function “value” to const wrap. this function has an anonymous function that returns something as well

58
Q

In JavaScript, when is a function’s scope determined; when it is called or when it is defined?

A

when it’s defined.. double check

59
Q

What allows JavaScript functions to “remember” values from their surroundings?

A

closure (you can check this by console.dir and opening up the 3 scopes. it will be in the closure scope)

60
Q

What are “props” in React?

A
props is a keyword in React that stands for "properties" and is used for passing data from one component to another
this.props contains the props defined by the caller of the component
props are read-only. this is how the concept of "states" developed: to allow the changing of the React state without changing the props.
we use class components when we are expecting features like managing state, adding life cycles, n event handlers.
61
Q

What does the acronym LIFO mean?

A

the last thing pushed onto the stack is the first thing that can be popped out

62
Q

What methods are available on a Stack data structure?

A
  • push()
  • pop()
  • peek()
63
Q

What must you do to access the value at an arbitrary point in a stack (not just the “top”)?

A

you have to keep using pop() to peel away enough layers to reach the particular point in the stack

64
Q

What does the acronym FIFO mean?

A

the first thing enqueued onto the queue is the first thing that can be dequeued out

65
Q

What methods are available on a Queue data structure?

A

enqueue(value) - adds a value to the “back” of the queue

dequeue() - removes the “front” value from the queue and returns it

66
Q

What must you do to access the value at an arbitrary point in a queue (not just the “front”)?

A

keep using dequeue() to “peel away” to that particular point in a queue

67
Q

How are linked lists different from an array?

A

linked lists “point” to the next node

68
Q

How would you access an arbitrary node in a linked list (not just the “head”)?

A

keep looking at the .next node (.next.next.next)