Node Flashcards

1
Q

What is Node.js?

A

A program that allows you to run JavaScript 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

To build scalable network applications

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

When was Node.js created?

A

2009

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

What back end languages have you heard of?

A

PHP, C+, C++, C#, Java, Ruby, Python, Perl

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

What is a computer process?

A

The instance of a computer program that is being executed by one or many threads. Contains program code and it’s activity

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

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

A

About 2,000 or more

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

To make sure their program works!

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

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

It’s always available because it is a GLOBAL

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

It returns an array containing the command line arguments passed when the Node.js process was launched

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

What is a JavaScript module?

A

A single JavaScript file

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

exports, require, module, __filename, __dirname

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

setTimeOut, setInterval, console, global

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

Specify what variables/functions you want to make available for other modules

export is an object, so you can export properties

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

by calling the require() function

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

What is the JavaScript Event Loop?

A

The Event Loop has one simple job — to monitor the Call Stack and the Callback Queue. If the Call Stack is empty, it will take the first event from the queue and will push it to the Call Stack, which effectively runs it. Such an iteration is called a tick in the Event Loop. Each event is just a function callback.

17
Q

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

A

Blocking methods execute synchronously and non-blocking methods execute asynchronously.

Blocking is when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes. This happens because the event loop is unable to continue running JavaScript while a blocking operation is occurring.

18
Q

What is a directory?

A

A directory is a logical grouping of files. Directories are called folders

In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers, directories are known as folders

19
Q

What is a relative file path?

A

A relative file path points to a file relative to the current page

20
Q

What is an absolute file path?

A

An absolute file path is the full URL to a file

21
Q

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

A

the fs module

22
Q

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

A

the writeFile() method

23
Q

Are file operations using the fs module synchronous or asynchronous?

A

Asynchronous