node.js Flashcards

1
Q
  1. What is Node.js?
A

Node.js is an asynchronous event-driven JavaScript runtime (this just means Asynchronous programming), Node.js is designed to build scalable network applications.
It 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
  1. 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
  1. What is a REPL?
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. The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. When was Node.js created?
A

2009

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. What back end languages have you heard of?
A

Ruby, Python, PHP, SQL (technically a database language), Java, C#, C++, fortan(sort of), C, kotlin, golang, JavaScript, swift(technically… used for ios), perl…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. 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().
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
7
Q
  1. 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
8
Q
  1. What is a JavaScript module?
A

a. It is a SINGLE JS FILE - Tim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. What values are passed into a Node.js module’s local scope?
A

a. The five parameters — exports, require, module, __filename, __dirname are available inside each module in Node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. Give two examples of truly global variables in a Node.js program.
A

b. global / console / command to run terminal / process / class: Buffer-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. What is the purpose of module.exports in a Node.js module?
A

a. If you want to make anything available to your node.js program, you attach it to the export property. - Tim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. How do you import functionality into a Node.js module from another Node.js module?
A

a. To include functions defined in another file in Node.js, import the module by using the require keyword at the top of the file.
b. The result of require is then stored in a variable which is used to invoke the functions using the dot notation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  1. What is a directory?
A

a. File systems typically have directories (also called folders) which allow users to group files into separate collections.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. What is a relative file path?
A

b. Relative File Path: It describes the path of the file relative to the location of the current web page file.
i. Example 1: It shows the path of the file present in the same folder of the current web page file.
ii. A path to a file from where you CURRENTLY are (current directory to the file).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. What is an absolute file path?
A

a. Absolute File Paths: It describes the full address(URL) to access an internet file.
i. An absolute path starts with just a ‘/’ slash.
ii. root always starts with slash

b. Absolute URLs will take you to a different domain name on the web.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  1. What module does Node.js include for manipulating the file system?
A

a. The built-in fs module.
b. This name is short for “file system,” and the module contains all the functions you need to read, write, and delete files on the local machine.

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

fs.writeFile()

18
Q
  1. Are file operations using the fs module synchronous or asynchronous?
A

Both.