Full Immersion Flashcards

1
Q

What is Array.prototype.filter useful for?

A

it is useful for creating a new array while excluding some elements

Array Filter Exercise

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

What is Array.prototype.map useful for?

A

it is useful for creating a new array containing the transformed elements of another

Array Map Exercise

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

What is a GUI?

A

Graphical User Interface: allows users to interact with electronic devices through graphical icons and audio indicators instead of text-based user interfaces, typed command labels, or text navigation.

Command Line Basics Exercise

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

What is a CLI?

A

Command Line Interface: processes commands to a computer program in the form of lines of text.

Command Line Basics Exercise

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

What is one use case for the cat command?

A

The cat command can concatenate the contents of text files.

Command Line Basics Exercise

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

What is one use case for the ls command?

A

The ls command can display a file name and any requested, additional information.

Command Line Basics Exercise

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

What is one use case for the pwd command?

A

The pwd command can print the current working directory.

Command Line Basics Exercise

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

What is one use case for the echo command?

A

The echo command can write arguments to the terminal or whatever the standard output is.

Command Line Basics Exercise

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

What is one use case for the touch command?

A

The touch command can create a new file.

Command Line Basics Exercise

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

What is one use case for the mkdir command?

A

The mkdir command can create a new directory or new directories as required.

Command Line Basics Exercise

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

What is one use case for the mv command?

A

The mv command can move a file.

Command Line Basics Exercise

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

What is one use case for the rm command?

A

The rm command can remove a file.

Command Line Basics Exercise

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

What is one use case for the cp command?

A

The cp command can copy files to another directory.

Command Line Basics Exercise

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

What is Webpack?

A

Webpack is a tool that lets you bundle your JavaScript applications and assets

Webpack Intro Exercise

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

How do you add a devDependency to a package?

A

To add an entry to the devDependencies attribute of a package.json file, on the command line, run the following command: npm install –save-dev

Webpack Intro Exercise

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

What is an npm script?

A

An npm script is a property on the package.json file that allows us to reference locally installed npm packages by name.

Webpack Intro Exercise

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

How do you execute Webpack with npm run?

A

npm run build (or whatever the webpack alias is, inside the package.json file)

Webpack Intro Exercise

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

How do you create “class” components in React?

A

You create class components in React similar to how a class is declared in JavaScript. Use the class keyword, the class name, the extends keyword and then React.Component and then the code block, which must include a render method.

class [ClassName] extends React.Component{
  render(){
    // render method code
  }
}

React Class Components Exercise

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

How do you access props in a class component?

A

By using the props object, which is JSX attributes and children of the component as a single object.

props.prop-name

function Welcome(props) {
  return <h1> Hello, {props.name} </h1>
}
const element = 

React Class Components Exercise

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

What is the purpose of state in React?

A

The purpose of state in React is for the storage of data specific to a component that may change over time.

If the value isn’t used for rendering or data flow, it does not have to be put in the state.

Treat this.state as if it were immutable, because calling setState() after mutating this.state may replace the changes you made.

React Events and State Exercise

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

How do you pass an event handler to a React element?

A

Add a function to the class component and bind the method to the constructor

React Events and State Exercise

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

What are the three great virtues of a programmer?

A
  1. Laziness
  2. Impatience
  3. Hubris

Command Line Basics Exercise

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

What is Array.prototype.reduce useful for?

A

Array.prototype.reduce is useful for executing a reducer function on each element of an array, resulting in a single output value

Array Reduce Exercise

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

What is Node.js?

A

Node.js is a program that allows JavaScript to be run outside of a browser

Node Intro Exercise

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

What can Node.js be used for?

A

Node.js can be used to build back ends for web applications, command-line programs, or any kind of automation that developers wish to perform.

Node Intro Exercise

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

What is a REPL?

A

REPL stands for Read-Eval-Print-Loop, which is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user

Node Intro Exercise

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

When was Node.js created?

A

Node.js was created in 2009 by Ryan Dahl.

Node Intro Exercise

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

What back end languages have you heard of?

A

PHP, Python, Ruby on Rails, Java, C++

Node Intro Exercise

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

What is a computer process?

A

The instance of a computer program that is being executed (by one or many threads). It contains the program code and its activity.

Node Process Exercise

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

Roughly how many computer processes are running on your host operating system (Task Manage or Activity Monitor)?

A

Roughly 300 processes are running on my host operating system.

Node Process Exercise

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

Why should a full stack Web developer know that computer processes exist?

A

Web development involves making multiple processes work together to form one application.

Node Process Exercise

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

What is the process object in a Node.js program?

A
The process object is a global object that provides information about and control over, the current Node.js process.
The process object is an instance of EventEmitter, which is a class that is defined and exposed by the "events" module.

Node Process Argv Exercise

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

How do you access the process object in a Node.js program?

A

You can always access the project object in a Node.js application as it is in the global scope, even without using require().

Node Process Argv Exercise

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

What is the data type of process.argv in Node.js?

A

The datatype of “process.argv” in Node.js is a string array.

Node Process Argv Exercise

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

What is the JavaScript Event Loop?

A

The Event Loop allows asynchronous handling of tasks. The Event Loop is one of the four major concepts of JavaScript (Prototypal Inheritance, How ‘this’ works, closures, and The Event Loop).

The Event Loop Exercise

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

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

A

Blocking code is currently in the call stack, non-blocking code is code that goes back into the callback queue.

The Event Loop Exercise

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

What is a JavaScript module?

A

In JavaScript, a module is a single .js file.

Node Module System Exercise

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

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

A

The values: exports, require, module, __filename, and __dirname, are all passed into a Node.js module’s local scope.

Node Module System Exercise

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

Give two examples of truly global variables in a Node.js program.

A

exports and module [?]

Node Module System Exercise

40
Q

What is the purpose of module.exports in a Node.js module?

A

The purpose of module.exports in a Node.js module is to be assigned with the desired export object.

Node Require Exercise

41
Q

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

A

You can import functionality from one Node.js module to another Node.js module by using the require() method and passing in the relative path to a module, JSON file, or local file.

Node Require Exercise

42
Q

What is a directory?

A

A directory (also called a folder) is part of a file system that allows a user to group files into separate collections.

Node FS Readfile

43
Q

What is a relative file path?

A

A relative file path refers to the location of a file relative to the current working directory.

Node FS Readfile

44
Q

What is an absolute file path?

A

An absolute file path is a path that contains the root element and the complete directory list required to locate the file.

Node FS Readfile

45
Q

What module does Node.js include for manipulating the file system?

A

Node.js includes the ‘fs’ module for manipulating the file system.

Node FS Readfile

46
Q

What method is available in the Node.js ‘fs’ module for writing data to a file?

A

In Node.js, the fs.writeFile() method is available for writing data to a file.

Node FS Writefile Exercise

47
Q

Are file operations using the ‘fs’ module synchronous or asynchronous?

A

File operations using the ‘fs’ module are asynchronous, because of the callback function parameter of the writeFile() method.

Node FS Writefile Exercise

48
Q

What is JSON?

A

JSON (JavaScript Object Notation) is a standard text-based format for representing structured data based on JavaScript object syntax.

JavaScript and JSON Exercise

49
Q

What are serialization and deserialization and why are they useful?

A

Serialization is the process of translating a data structure or object state into a format that can be stored or transmitted and reconstructed.

Deserialization is the opposite, which is parsing or extracting a data structure from a series of bytes.

They are useful for transferring data, storing data, remote procedure calls, distributing objects, or detecting changes in time-varying data.

JavaScript and JSON Exercise

50
Q

How do you serialize data into a JSON string using JavaScript?

A

You can serialize data into a JSON string by using the JSON.stringify() method and passing in the JavaScript value or object you wish to convert to a JSON string.

JavaScript and JSON Exercise

51
Q

How do you deserialize a JSON string using JavaScript?

A

You can deserialize a JSON string by using the JSON.parse() method and passing in the JSON string you wish to parse into a JavaScript value or object.

JavaScript and JSON Exercise

52
Q

What is npm?

A

NPM is the worlds largest software registry. There are three parts, the website, the CLI, and the registry.

npm-intro exercise

53
Q

What is a package?

A

An organized set of related classes and interfaces. They are similar to folders on your computer that store different files.

npm-intro exercise

54
Q

How can you create a package.json with npm?

A

You can create a package.json file by using the command:

npm init –y

npm-intro exercise

55
Q

What is a dependency?

A

A dependency is a package required by an application in production.

You can add a dependency by using the command: npm install [package name]

npm-intro exercise

56
Q

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

A

When you add a dependency to a package with npm, it is added to a directory called: node_modules

npm-intro exercise

57
Q

How do you add Express to your package dependencies?

A

npm install express

express-intro exercise

58
Q

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

A

The listen method starts the server and binds it to a network port. If the port is omitted or is 0, the operating system will assign an arbitrary unused port.

The app.listen method returns an http.Server object.

express-intro exercise

59
Q

How do you mount a middleware with an Express application?

A

You mount a middleware with an Expresss application by using the app.use() and app.METHOD() functions, where METHOD is the HTTP method of the request that the middleware function handles (GET, PUT, POST) in lowercase.

express-hello-world exercise

60
Q

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

A

The req (short for request) object and the res (short for response) object are used to manage the request/response lifecycle of the server.

express-hello-world exercise

61
Q

What is the Content-Type header of HTTP requests and responses used for?

A

The Content-Type entity header is used to indicate the media type of the resource.

Express-Sendfile Exercise

62
Q

What does express.static() return?

A

express.static() returns files from within a given root directory.

Express-Static Exercise

63
Q

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

A

The local __dirname variable in a Node.js module is the directory name of the current module. This is the same as the path.dirname() of the __filename (path.dirname(__filename)). __filename is the file name of the current module.

Express-Static Exercise

64
Q

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

A

The path.join() method joins all given path segments together using the platform-specific separator as a delimiter (probably ‘/’ ), then normalizes the resulting path.

Zero-length path segments are ignored. If the joined path string is a zero-length string then ‘.’ will be returned, representing the current working directory.

A TypeError is thrown if any of the path segments is not a string.

Express-Static Exercise

65
Q

What is the appropriate Content-Type header for requests and responses that contain JSON in their bodies?

A

The appropriate Content-Type header for requests and responses that contain JSON in their bodies is: ‘application/json’.

Express-GET-JSON Exercise

66
Q

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

A

The express.json() middleware creates an instance of JSON parsing middleware. You would need this middleware when parsing JSON request bodies.

Express-POST-JSON Exercise

67
Q

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

A

The HTTP request’s method determines the route handler. The API only has explicit entries for get(), post(), put(), and delete(). There are other idempotent methods that can perform identical requests without any side effects.

express-delete exercise

68
Q

What is an ES6 module and how is it different from a CommonJS module?

A

It is a module standard native to ES6. The ES6 module standard has two parts: declarative syntax for importing and exporting, and a programmatic loader API to configure how modules are loaded and to conditionally load modules.

CommonJS and Asynchronous Module Definition (AMD) were two competing module formats before ES modules were made standard in ES6.

ES modules differ from CommonJS in that they have more compact syntax than CommonJS, its structure can be statically analyzed for optimization, and it has better support for cyclical dependencies than CommonJS.

es-modules exercise

69
Q

What kind of modules can Webpack support?

A

Webpack provides native support for ECMAScript (ES) modules, CommonJS modules, Asynchronous Module Definition (AMD) modules, and WebAssembly modules.

Webpack also supports modules written in a variety of languages and preprocessors via loaders. Loaders describe to webpack how to process non-native modules and include these dependencies into your bundles.

es-modules exercise

70
Q

What is React?

A

React is a JavaScript library for building user interfaces.

react-elements exercise

71
Q

What is a React element?

A

A React element describes what you see on the screen. It is the smallest building block of React apps.

react-elements exercise

72
Q

How do you mount a React element to the DOM?

A

You mount a React element to the DOM by calling the render method of the ReactDOM object and passing as arguments: the React element, the container to render in React element in, and an optional callback function that will be executed after the component is rendered or updated.

react-elements exercise

73
Q

What is Babel?

A

Babel is a JavaScript compiler that is mainly used to convert ES6+ code into a backwards compatible version of JavaScript in current and older browsers or environments.

babel-intro exercise

74
Q

What is a Plug-In?

A

A Plug-In is a software component that adds a specific feature to an existing computer program, enabling customization.

babel-intro exercise

75
Q

What is a Webpack loader?

A

A webpack loader is a plug-in that describes to webpack how to process non-native modules and include these dependencies into your bundles.

babel-intro exercise

76
Q

How can you make Babel and Webpack work together?

A

You can make Babel and Webpack work together by installing the Babel Loader dependency to your bundle.

babel-intro exercise

77
Q

What is JSX?

A

JSX is a syntax extension to JavaScript (syntactical sugar) that is useful to describe what the UI should look like.

react-jsx exercise

78
Q

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

A

The React object must be imported when authoring JSX in a module because JSX compiles into calls to React.createElement.

react-jsx exercise

79
Q

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

A

You can make Webpack and Babel work together to convert JSX into valid JavaScript by using the Babel plugin @babel/plugin-transform-react-jsx.

react-jsx exercise

80
Q

What is a React component?

A

A React component is like a JavaScript function. They accept arbitrary inputs (“props”) and return React elements describing what should appear on the screen.

React components let you split the UI into independent, reusable pieces, and think about each piece in isolation.

react-function-components exercise

81
Q

How do you define a function component in React?

A

The simplest way to define a component is to write a JavaScript function.

react-function-components exercise

82
Q

How do you mount a component to the DOM?

A

You mount a component to the DOM by calling the ReactDOM.render() method (render method of the ReactDOM object) and passing as arguments the component and a container object.

react-function-components exercise

83
Q

What are props in React?

A

Props are values stored in an object that is assigned to the props property of a React object.

react-props-and-expressions exercise

84
Q

How do you pass props to a component?

A

You pass props to a component in the opening JSX tag, after the component nanme, by giving it a name and assigning a value to it and surrounding the value in curly braces.

react-props-and-expressions exercise

85
Q

How do you write JavaScript expressions in JSX?

A

You can write JavaScript expressions in JSX by surrounding it with curly braces.

react-props-and-expressions exercise

86
Q

What Array method is commonly used to create a list of React elements?

A

The Array.map() method is commonly used to create a list of React elements.

react-rendering-lists exercise

87
Q

What is the best value to use as a “key” prop when rendering lists?

A

The best value to use as a key prop when rendering lists is an ID from your data as a key.

react-rendering-lists exercise

88
Q

What are controlled components and how do you work with them?

A

Controlled components are components that render a form and also control what happens in that form on subsequent user input.

We can work with controlled components by accessing the state of the component to pass values to other UI elements or to reset it from other event handlers.

react-form-controls exercise

89
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

promises exercise

90
Q

How do you handle the fulfillment of a Promise?

A

You can handle the fulfillment of a Promise by using the Promise.prototype.then() method, which takes up two arguments: a callback function for the success and failure case of the Promise.

promises exercise

91
Q

How do you handle the rejection of a Promise?

A

You can handle the rejection of a Promise with the callback function for the failure case of the Promise (the second argument when calling the Promise.prototype.then() method), or by using the Promise.prototype.catch() method, which internally calls the same method for failed cases for Promises from the Promise.prototype.then() method.

promises exercise

92
Q

What does fetch() return?

A

The fetch() method returns a Promise that resolves to a Response object.

fetch exercise

93
Q

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

A

The default request method used by fetch() is a GET request.

fetch exercise

94
Q

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

A

You specify the request method when calling fetch by passing the init object as an optional argument, and setting the method property of the init object to the specified request method.

fetch exercise

95
Q

When does React call a component’s componentDidMount method?

A

React calls a component’s componentDidMount method after the render() method of the component is called.

fetch-in-react exercise

96
Q

Name three React.Component lifecycle methods.

A
Some React.Component lifecycle methods are:
constructor(),
render(),
componentDidMount(),
componentDidUpdate(),
componentWillUnmount()...

fetch-in-react exercise

97
Q

How do you pass data to a child component?

A

You can pass data to a child component by using JSX to assign props to the child component in the render method of the parent component

fetch-in-react exercise