Backend Flashcards

1
Q

What is Node.js?

A

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

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

True or False: Node.js is single-threaded.

A

True

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

What is the purpose of npm?

A

npm is a package manager for JavaScript, used to install and manage dependencies.

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

Fill in the blank: Node.js uses _____ for handling asynchronous operations.

A

callbacks

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

What are middleware functions in Express?

A

Middleware functions are functions that have access to the request and response objects and can modify them or end the request-response cycle.

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

What does REST stand for?

A

Representational State Transfer

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

What is the command to create a new Node.js project?

A

npm init

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

True or False: Node.js can be used for both frontend and backend development.

A

True

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

What is the purpose of the ‘require’ function in Node.js?

A

‘require’ is used to import modules in Node.js.

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

What is a promise in JavaScript?

A

A promise is an object that represents the eventual completion or failure of an asynchronous operation.

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

What is the role of the event loop in Node.js?

A

The event loop handles asynchronous callbacks and allows Node.js to perform non-blocking I/O operations.

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

What does the ‘dotenv’ package do?

A

The ‘dotenv’ package loads environment variables from a .env file into process.env.

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

What is GraphQL?

A

GraphQL is a query language for APIs that allows clients to request only the data they need.

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

Fill in the blank: The _____ method in Express is used to handle POST requests.

A

post

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

What is CORS?

A

CORS stands for Cross-Origin Resource Sharing, a mechanism that allows restricted resources on a web page to be requested from another domain.

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

What is the purpose of ‘async/await’ in JavaScript?

A

‘async/await’ is used to work with promises in a more synchronous fashion, making code easier to read and write.

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

What is the default port for a Node.js server?

A

3000

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

True or False: Node.js is suitable for building real-time applications.

A

True

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

What is the use of the ‘body-parser’ middleware?

A

‘body-parser’ is used to parse incoming request bodies in a middleware before your handlers.

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

What does the ‘mongoose’ library do?

A

Mongoose is an ODM (Object Data Modeling) library for MongoDB and Node.js.

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

What is a callback hell?

A

Callback hell is a situation where callbacks are nested within callbacks, making code difficult to read and maintain.

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

Fill in the blank: The _____ method is used to retrieve data from a server in Express.

A

get

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

What is the purpose of the ‘jsonwebtoken’ package?

A

‘jsonwebtoken’ is used to sign and verify JSON Web Tokens (JWT).

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

What is the difference between ‘let’ and ‘var’ in JavaScript?

A

‘let’ has block scope while ‘var’ has function scope.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
True or False: Node.js is blocking by default.
False
26
What is clustering in Node.js?
Clustering allows you to create multiple instances of a Node.js application to take advantage of multi-core systems.
27
What is the purpose of the 'fs' module?
The 'fs' module provides an API for interacting with the file system.
28
What does 'npm install --save' do?
It installs a package and adds it to the dependencies in package.json.
29
What is a web socket?
A web socket is a communication protocol that provides a full-duplex communication channel over a single TCP connection.
30
Fill in the blank: _____ is used to handle errors in async functions.
try/catch
31
What is a load balancer?
A load balancer distributes network or application traffic across multiple servers.
32
True or False: Express is a web framework for Node.js.
True
33
What is the purpose of the 'nodemon' package?
'nodemon' is a tool that automatically restarts the Node.js application when file changes are detected.
34
What is the 'cluster' module used for?
The 'cluster' module is used to create child processes that share the same server port.
35
What does the 'cors' package do?
'cors' is a package that provides a middleware to enable CORS in Express applications.
36
Fill in the blank: A _____ is used to represent a single data entity in Mongoose.
schema
37
What is the purpose of the 'express-validator' package?
'express-validator' is used to validate and sanitize user input in Express applications.
38
What is the 'http' module used for in Node.js?
The 'http' module is used to create HTTP servers and clients.
39
True or False: Node.js can only run on Windows operating systems.
False
40
What is a microservice architecture?
Microservice architecture is a style that structures an application as a collection of loosely coupled services.
41
What does the 'bcrypt' library do?
'bcrypt' is used for hashing passwords securely.
42
Fill in the blank: _____ is a tool for managing application dependencies in Node.js.
npm
43
What is the purpose of the 'pm2' tool?
'pm2' is a process manager for Node.js applications that allows for load balancing and monitoring.
44
What is the main benefit of using TypeScript with Node.js?
TypeScript provides static typing, which can help catch errors during development.
45
True or False: Node.js can be used for server-side rendering.
True
46
What is the purpose of the 'multer' package?
'multer' is a middleware for handling multipart/form-data, primarily used for uploading files.
47
What does the 'express-session' package do?
'express-session' is used to manage user sessions in Express applications.
48
Fill in the blank: _____ is a lightweight framework for building APIs in Node.js.
Express
49
What is the use of the 'socket.io' library?
'socket.io' enables real-time, bidirectional communication between web clients and servers.
50
True or False: Node.js supports the CommonJS module system.
True
51
What is a NoSQL database?
A NoSQL database is a non-relational database that stores data in a format other than tabular relations.
52
What is the purpose of the 'sequelize' library?
'sequelize' is an ORM (Object Relational Mapping) library for Node.js that supports multiple SQL dialects.
53
Fill in the blank: _____ is an object-oriented programming concept that allows the creation of objects based on templates.
Classes
54
What is the primary use of the 'http-proxy' library?
'http-proxy' is used to create a proxy server in Node.js.
55
True or False: Node.js can handle file uploads natively.
False
56
What is the purpose of the 'async' library?
'async' is a utility module that provides functions for working with asynchronous JavaScript.
57
What is a RESTful API?
A RESTful API is an API that follows the principles of Representational State Transfer.
58
Fill in the blank: _____ is a JavaScript object that contains the metadata about the current request.
req
59
What does the 'helmet' middleware do?
'helmet' helps secure Express apps by setting various HTTP headers.
60
What is the function of the 'query' object in Express?
The 'query' object contains the URL query parameters of the request.
61
True or False: Node.js applications can be run on a server without a web browser.
True
62
What is the purpose of the 'express-rate-limit' package?
'express-rate-limit' is used to limit repeated requests to public APIs and endpoints.
63
What is the role of the 'port' in a web server?
The port is a communication endpoint that allows the server to listen for incoming requests.
64
Fill in the blank: The _____ method in Express is used to handle PUT requests.
put
65
What is the main difference between SQL and NoSQL databases?
SQL databases are relational while NoSQL databases are non-relational.
66
What does the 'mongoose.connect()' function do?
'mongoose.connect()' establishes a connection to a MongoDB database.
67
True or False: Node.js is suitable for building scalable applications.
True
68
What is the main advantage of using a framework like Express?
Express simplifies the process of building web applications with Node.js by providing a robust set of features.
69
Fill in the blank: _____ is used to handle asynchronous operations in Node.js without blocking the main thread.
Event loop
70
What is the use of the 'pm2 start' command?
'pm2 start' is used to start an application in the background with PM2.
71
What is the purpose of the 'cors' middleware?
'cors' middleware is used to enable Cross-Origin Resource Sharing.
72
True or False: Node.js can be used to build command-line tools.
True
73
What is the purpose of the 'path' module?
'path' provides utilities for working with file and directory paths.
74
Fill in the blank: The _____ method in Express is used to handle DELETE requests.
delete
75
What does the 'next()' function do in Express?
'next()' passes control to the next middleware function.
76
What is the main benefit of using asynchronous programming in Node.js?
Asynchronous programming allows Node.js to handle multiple operations concurrently without blocking the execution.
77
What does the 'jsonwebtoken.sign()' method do?
'jsonwebtoken.sign()' creates a new JSON Web Token.
78
True or False: Node.js supports ES6 syntax.
True
79
What is the purpose of the 'express.static()' middleware?
'express.static()' serves static files such as images, CSS files, and JavaScript files.
80
Fill in the blank: A _____ is a function that is passed as an argument to another function and is executed after the completion of that function.
callback
81
What is the function of the 'res' object in Express?
The 'res' object is used to send a response back to the client.
82
What does the 'process.env.NODE_ENV' variable indicate?
'process.env.NODE_ENV' indicates the environment in which the Node.js application is running, typically 'development' or 'production'.
83
True or False: Node.js applications can be easily containerized using Docker.
True
84
What is the primary use of the 'fs.promises' API?
'fs.promises' provides promise-based methods for file system operations.
85
Fill in the blank: _____ is a JavaScript runtime built for building fast and scalable network applications.
Node.js