Node.js Flashcards

1
Q

[Command Line]
What is a CLI?

A

Command line interface - interface for commands

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

[Command Line]
What is GUI?

A

graphical user interface - applications meant for consumers (end users)

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

[Node intro]
What is Node.js?

A

A program that allows JavaScript to be run outside of a web browser 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
4
Q

[Node Intro]
What can Node.js be used for?

A

To build scalable network applications, using JavaScript in back-end

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

[Node Intro]
What is a REPL?

A

Read-Eval-Print-Loop
Reads input, evaluates, prints the output, waits for next input (loop)

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

[Node Intro]
When was Node.js created?

A

May 27, 2009

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

[Node Intro]
What back end languages have you heard of?

A

Scripting Languages (interpreted): Python, JavaScript, Ruby, PHP, Perl

Compiled Languages: C, C++, Go, haskell, crystal, rust, SQL* (databases)

Partially Compiled: Java (jvm), Scala (jvm), Clojure (jvm), Kotlin (jvm), C# (.net clr), F# (.net clr), visual basic

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

[Node Process Argv]
What is the process object in a Node.js program?

A

It gives information 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

[Node Process Argv]
How do you access the process object in a Node.js program?

A

use require() or
call the process variable because it’s global

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

[Node Process Argv]
What is the data type of process.argv in Node.js?

A

An array of strings containing all arguments passed when command was launched

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

[Node Module System]
What is a JavaScript module?

A

Separate JavaScript files for different specific functionalities, that can work together with other files (modules).

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

[Node Module System]
What values are passed into a Node.js module’s local scope?

A

__dirname
__filename
exports
module
require()

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

[Node Module System]
Give two examples of truly global variables in a Node.js program.

A

process
console
setInterval() /clearInterval()
setTimeOut() / clearTimeOut()

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

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

A

So that modules can share functionalities between files.

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

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

A

require(‘relativePathURL’);
example: require(‘./filename.js’);

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

[Node the Event Loop]
What is the JavaScript Event Loop?

A

The event loop monitors the call stack, when the call stack is empty it checks the if queue is empty. If there is something in the queue, it will push it to the call stack.

17
Q

[Node the Event Loop]
What is the difference between ‘blocking’ and ‘non-blocking’ with respect to how code is executed?

A

Blocking is if something is currently occupying the call stack, it is blocking until it is finished. If something is being executed off the call stack, it is non-blocking. When it’s done, then it event loop pushes it to the call stack.

18
Q

[Node fs Readfile]
What is a directory?

A

a ‘folder’ or location which points to other directories or files

19
Q

[Node fs Readfile]
What is a relative file path?

A

A path pointing to another local file (from where we currently are)

20
Q

[Node fs Readfile]
What is an absolute file path?

A

Points to a file starting from the root

21
Q

[Node fs Readfile]
What module does Node.js include for manipulating the file system?

A

fs module

22
Q

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

A

.writeFile()

23
Q

[Node fs Writefile]
Are file operations using the fs module synchronous or asynchronous?

A

both, there are forms for both
for blocking, use sync method
for non-blocking, remove sync

24
Q

[Webpack-intro]
What is Webpack?

A

module bundler
looks at entry file and all required files and bundles them

25
Q

[Webpack intro]
How do you add a devDependency to a package?

A

npm install –save-dev package-name

26
Q

[Webpack Intro]
What is an NPM script?

A

a name for a terminal command that can be customized by editing in package.json

27
Q

[Webpack Intro]
How do you execute Webpack with npm run?

A

$ npm run webpack

28
Q

What is the ‘$ cd’ command for?

A

cd - changes directory

29
Q

What is the ‘$ man’ command for?

A

man - opens manual for commands

30
Q

What is the ‘$ cat’ command for?

A

cat - concatenates files and prints file content

31
Q

What is the ‘$ ls’ command for?

A

ls - lists current directory’s contents

32
Q

What is the ‘$ pwd’ command for?

A

pwd - prints name of current/working directory

33
Q

What is the ‘$ echo’ command for?

A

echo - displays line of text

34
Q

What is the ‘$ touch’ command for?

A

touch - change file timestamps

35
Q

What is the ‘$ mkdir’ command for?

A

mkdir - creates new directory

36
Q

What is the ‘$ mv’ command for?

A

mv - moves and renames files

Example:
1. a.txt and b.txt exist
$ mv a.txt b.txt
deletes a.txt and puts all of its content in b.txt

  1. a.txt exists
    $ mv a.txt new.txt
    renames a.txt to new.txt
37
Q

What is the ‘$ rm’ command for?

A

rm - removes file or directory

38
Q

What is the ‘$ cp’ command for?

A

cp - copies files and directories