Command-Line Flashcards

1
Q

What is a CLI?

A

command-line interface processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.

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

What is a GUI?

A

A graphical user interface (GUI) is a type of user interface through which users interact with electronic devices via visual indicator representations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
Give at least one use case for each of the commands listed in this exercise.
man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp
A
  1. man: This command displays the manual page for a particular command. If you are unsure how to use a command or want to find out all its options, you might want to try using man to view the manual page.
  2. cat: This command outputs the contents of a text file. You can use it to read brief files or to concatenate files together.
  3. ls: This command will list the files stored in a directory.
  4. pwd: This command reports the current directory path.
  5. echo: Echo is a Unix/Linux command tool used for displaying lines of text or string which are passed as
    arguments on the command line.
  6. touch: used to create a file without any content. The file created using touch command is empty. This command can be used when the user doesn’t have data to store at the time of file creation.
  7. mkdir: This command will make a new subdirectory.
  8. mv: This command will move a file. You can use mv not only to change the directory location of a file, but also to rename files. Unlike the cp command, mv will not preserve the original file.
  9. rm: This command will remove (destroy) a file.
    10: cp: This command copies a file, preserving the original and creating an identical copy.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
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
6
Q

What is a REPL?

A

Node.js Read-Eval-Print-Loop (REPL) is an easy-to-use command-line tool, used for processing Node.js expressions. It captures the user’s JavaScript code inputs, interprets, and evaluates the result of this code. It displays the result to the screen, and repeats the process till the user quits the shell.

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

What back end languages have you heard of?

A

PHP, Ruby, C#

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

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

A

10 on Task Manager

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

What is a computer process?

A

instance of a computer program that is being executed by one or many threads.

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

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

A

332 processes on task manager

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

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

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

What is a JavaScript module?

A

Each individual file. 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
17
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
18
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
19
Q

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

A

use require()

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

What is the JavaScript Event Loop?

A

event loop is responsible for executing the code, collecting and processing events, and executing queued sub-tasks.

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

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

A

Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn’t block execution. Or as Node.js docs puts it, blocking is when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes.

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

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

What is a directory?

A

directories = folders, which allows the user to group files into separate collections.

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

What is a relative file path?

A

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

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

What is an absolute file path?

A

An absolute file path is the full URL to a file

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

What is an absolute file path?

A

File path that starts at the root directory. (An absolute file path is the full URL to a file.)

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

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

A

fs.writefile

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

Are file operations using the fs module synchronous or asynchronous?

A

Every method in the fs module has synchronous as well as asynchronous forms, but using asynchronous method is preferred

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

What is a client?

A

user interface (whatever the user interacts with)

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

What is a client?

A

A client is a computer hardware device or software that accesses a service made available by a server.

30
Q

What is a server?

A

A server is a physical computer dedicated to run services to serve the needs of other computers. Depending on the service that is running, it could be a file server, database server, home media server, print server, or web server.

31
Q

What is on the first line of an HTTP request message?

A

HTTP/1.1 200 status code

32
Q

What is on the first line of an HTTP request message?

A

An HTTP method, a verb (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed. For example, GET indicates that a resource should be fetched or POST means that data is pushed to the server (creating or modifying a resource, or generating a temporary document to send back).

33
Q

What is on the first line of an HTTP response message?

A

The protocol version, usually HTTP/1.1.

34
Q

What are HTTP headers?

A

HTTP headers let the client and the server pass additional information with an HTTP request or response.

35
Q

Is a body required for a valid HTTP message?

A

no.

36
Q

What is NPM?

A

npm is the world’s largest software registry. Open source developers from every continent use npm to share and borrow packages, and many organizations use npm to manage private development as well.

37
Q

What is a package?

A

A package is a file or directory that is described by a package.json file. (contains reusable code) A package must contain a package.json file in order to be published to the npm registry.

38
Q

How can you create a package.json with npm?

A

npm init command

39
Q

What is a dependency and how to you add one to a package?

A

The dependencies value is used to specify any other modules that a given module (represented by the package.json) requires to work.

40
Q

What happens when you add a dependency to a package with npm?

A

the dependency will be listed in the package.json file.

41
Q

How do you add express to your package dependencies?

A

npm install express

42
Q

What Express application method starts the server and binds it to a network PORT?

A

listen method.

43
Q

How do you mount a middleware with an Express application?

A

by using the use method.

44
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

request and respond object

next object is optional.

45
Q

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

Content-Type: application/json; charset=utf-8;

This means when you’re sending JSON to the server or receiving JSON from the server, you should always declare the Content-Type of the header as application/json as this is the standard that the client and server understand.

46
Q

what is the significance of HTTP request’s method

A

HTTP defines a set of request methods to indicate the desired action to be performed for a given resource.

47
Q

What does the express.json() middleware do and when would you need it?

A

express. json() is a method inbuilt in express to recognize the incoming Request Object as a JSON Object. this middleware will parse the body.

48
Q

What is PostgreSQL and what are some alternative relational databases?

A

PostgresSQL is an open source Relational Database Management System. Some alternative relational databases are MySQL, Amazon Aurora, and SQLite

49
Q

What are some advantages of learning a relational database?

A

widely used, and support good guarantees about data integrity.

50
Q

What is one way to see if PostgreSQL is running?

A

either top command or sudo service postgresql status

51
Q

What is a database schema?

A

collection of tables is called a schema

52
Q

What is a table?

A

Relational databases store data in relations, commonly referred to as tables. A table is a list of rows each having the same set of attributes.

53
Q

What is a row?

A

record of data

54
Q

What is SQL and how is it different from languages like JavaScript?

A

Javascript is imperative programming language and SQL is declarative programming language. (Programmers describe the results they want and the programming environment comes up with its own plan for getting those results.)

55
Q

How do you retrieve specific columns from a database table?

A

by using the select, then use from clause.

56
Q

How do you filter rows based on some specific criteria?

A

by using the where clause. ( where “category” = ‘cleaning’;)

57
Q

What are the benefits of formatting your SQL?

A

enhances readability makes it easier for styling.

58
Q

How do you control the sort order of a result set?

A

include an order by clause in the select statement to control the order of the result set.

59
Q

How do you add a row to a SQL table?

A

by using insert statement

60
Q

What is a tuple?

A

In SQL, a list of values is referred to as a tuple

61
Q

How do you add multiple rows to a SQL table at once?

A

Data rows can be batch inserted into a database table by specifying more than one tuple of values, separated by commas.

62
Q

How do you get back the row being inserted into a table without a separate select statement?

A

returning clause.

63
Q

How do you update rows in a database table?

A

by using update statement along with set clause

64
Q

Why is it important to include a where clause in your update statements?

A

so that only we are only targeting specific rows to be updated.

65
Q

How do you get back the row being inserted into a table without a separate select statement?

A

returning statement.

66
Q

How do you accidentally delete all rows from a table?

A

If the delete statement is used without where clause.

67
Q

What are some examples of aggregate functions?

A

avg(), count(), sum()

68
Q

What is the purpose of a group by clause?

A

if you want to separate rows into grouped and perform aggregate functions

69
Q

What is Webpack?

A

webpack is an open-source JavaScript module bundler. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included.

70
Q

How do you add a devDependency to a package?

A

by using npm install –save-dev nameofile

71
Q

What is an NPM script?

A

An npm script is a convenient way to bundle common shell commands for your project. Scripts are stored in a project’s package.json file, which means they’re shared amongst everyone using the codebase. They help automate repetitive tasks, and mean having to learn fewer tools. Node npm scripts also ensure that everyone is using the same command with the same flags.

72
Q

How do you execute Webpack with npm run?

A

npm run build