Node Flashcards

1
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
2
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
3
Q

What is a REPL?

A

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise.

Chrome Dev Tools Console is one

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

When was Node.js created?

A

May 2009

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

What back end languages have you heard of?

A

Node, Python, PHP, Ruby

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

What is a computer process?

A

In computing, a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.

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

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

A

125

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

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

A

Because Full stack Web development is based on making multiple processes work together to form one application, so having at least a cursory awareness of computer processes is necessary.

This will be extremely important when learning about applications made of multiple components, such as clients, servers, and databases.

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

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

A

The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require().

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

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

A

Just type process, it is always available Treat it like any other object.

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

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

A

Array

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

What is a JavaScript module?

A

Module in Node. js is a simple or complex functionality organized in single or multiple JavaScript files which can be reused throughout the Node. js application.

A Module specifically refers to a file

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

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

A

exports, require, module, __filename, __dirname

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

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

A

Console, process, global

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

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

A

It exports a module so other modules can use it

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

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

A

Using the require function

17
Q

What is the JavaScript Event Loop?

A

looks at stack and task queue, if stack is empty, it takes first task from queue and runs it

18
Q

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

A

Blocking assignment executes “in series” because a blocking assignment blocks execution of the next statement until it completes. … Non-blocking assignment executes in parallel because it describes assignments that all occur at the same time.

19
Q

What is a directory?

A

A location for storing files

20
Q

What is a relative file path?

A

location relative to where file is

21
Q

What is an absolute file path?

A

Full location of file

It starts with a forward slash /

meaning root of file system

22
Q

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

A

fs module

23
Q

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

A

fs.writeFile

24
Q

Are file operations using the fs module synchronous or asynchronous?

A

Both, since there are different sync versions, but fs.writeFile is asynchronous

Asynchronous take callback arguments