Node.js Flashcards

1
Q

What is Node.js?

A

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside 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

Node.js is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It’s used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind.

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

What is a REPL?

A

provides a Read-Eval-Print-Loop (REPL) implementation that is available both as a standalone program or includible in other applications.

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

When was Node.js created?

A

May 27, 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

python, c, c++, java, ruby, php

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

What is a computer process?

A

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.

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

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

A

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

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

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

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

A
As a global, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require():
const process = require('process');
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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
11
Q

What is a JavaScript module?

A

In the Node.js module system, each file is treated as a separate module.

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

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

A

__dirname, __filname, exports, module, require()

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

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

A

console, process

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

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

A

Module exports are the instruction that tells Node.js which bits of code (functions, objects, strings, etc.) to “export” from a given file so other files are allowed to access the exported code.

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

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

A

require

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

What is the JavaScript Event Loop?

A

event loop pushes anything that is queued to the callstack if it is empty

17
Q

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

A

blocking is code that is slow

18
Q

What is a directory?

A

a folder that contains other directories and files

19
Q

What is a relative file path?

A

The path with reference to current directory is called relative

20
Q

What is an absolute file path?

A

An absolute import path is a path that starts from a root, and you need to define a root first

21
Q

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

A

fs module

22
Q

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

A

fs.writeFile( )

23
Q

Are file operations using the fs module synchronous or asynchronous?

A

both