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
Q

True or False: Node.js is blocking by default.

A

False

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

What is clustering in Node.js?

A

Clustering allows you to create multiple instances of a Node.js application to take advantage of multi-core systems.

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

What is the purpose of the ‘fs’ module?

A

The ‘fs’ module provides an API for interacting with the file system.

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

What does ‘npm install –save’ do?

A

It installs a package and adds it to the dependencies in package.json.

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

What is a web socket?

A

A web socket is a communication protocol that provides a full-duplex communication channel over a single TCP connection.

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

Fill in the blank: _____ is used to handle errors in async functions.

A

try/catch

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

What is a load balancer?

A

A load balancer distributes network or application traffic across multiple servers.

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

True or False: Express is a web framework for Node.js.

A

True

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

What is the purpose of the ‘nodemon’ package?

A

‘nodemon’ is a tool that automatically restarts the Node.js application when file changes are detected.

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

What is the ‘cluster’ module used for?

A

The ‘cluster’ module is used to create child processes that share the same server port.

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

What does the ‘cors’ package do?

A

‘cors’ is a package that provides a middleware to enable CORS in Express applications.

36
Q

Fill in the blank: A _____ is used to represent a single data entity in Mongoose.

A

schema

37
Q

What is the purpose of the ‘express-validator’ package?

A

‘express-validator’ is used to validate and sanitize user input in Express applications.

38
Q

What is the ‘http’ module used for in Node.js?

A

The ‘http’ module is used to create HTTP servers and clients.

39
Q

True or False: Node.js can only run on Windows operating systems.

A

False

40
Q

What is a microservice architecture?

A

Microservice architecture is a style that structures an application as a collection of loosely coupled services.

41
Q

What does the ‘bcrypt’ library do?

A

‘bcrypt’ is used for hashing passwords securely.

42
Q

Fill in the blank: _____ is a tool for managing application dependencies in Node.js.

A

npm

43
Q

What is the purpose of the ‘pm2’ tool?

A

‘pm2’ is a process manager for Node.js applications that allows for load balancing and monitoring.

44
Q

What is the main benefit of using TypeScript with Node.js?

A

TypeScript provides static typing, which can help catch errors during development.

45
Q

True or False: Node.js can be used for server-side rendering.

A

True

46
Q

What is the purpose of the ‘multer’ package?

A

‘multer’ is a middleware for handling multipart/form-data, primarily used for uploading files.

47
Q

What does the ‘express-session’ package do?

A

‘express-session’ is used to manage user sessions in Express applications.

48
Q

Fill in the blank: _____ is a lightweight framework for building APIs in Node.js.

A

Express

49
Q

What is the use of the ‘socket.io’ library?

A

‘socket.io’ enables real-time, bidirectional communication between web clients and servers.

50
Q

True or False: Node.js supports the CommonJS module system.

A

True

51
Q

What is a NoSQL database?

A

A NoSQL database is a non-relational database that stores data in a format other than tabular relations.

52
Q

What is the purpose of the ‘sequelize’ library?

A

‘sequelize’ is an ORM (Object Relational Mapping) library for Node.js that supports multiple SQL dialects.

53
Q

Fill in the blank: _____ is an object-oriented programming concept that allows the creation of objects based on templates.

A

Classes

54
Q

What is the primary use of the ‘http-proxy’ library?

A

‘http-proxy’ is used to create a proxy server in Node.js.

55
Q

True or False: Node.js can handle file uploads natively.

A

False

56
Q

What is the purpose of the ‘async’ library?

A

‘async’ is a utility module that provides functions for working with asynchronous JavaScript.

57
Q

What is a RESTful API?

A

A RESTful API is an API that follows the principles of Representational State Transfer.

58
Q

Fill in the blank: _____ is a JavaScript object that contains the metadata about the current request.

A

req

59
Q

What does the ‘helmet’ middleware do?

A

‘helmet’ helps secure Express apps by setting various HTTP headers.

60
Q

What is the function of the ‘query’ object in Express?

A

The ‘query’ object contains the URL query parameters of the request.

61
Q

True or False: Node.js applications can be run on a server without a web browser.

A

True

62
Q

What is the purpose of the ‘express-rate-limit’ package?

A

‘express-rate-limit’ is used to limit repeated requests to public APIs and endpoints.

63
Q

What is the role of the ‘port’ in a web server?

A

The port is a communication endpoint that allows the server to listen for incoming requests.

64
Q

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

A

put

65
Q

What is the main difference between SQL and NoSQL databases?

A

SQL databases are relational while NoSQL databases are non-relational.

66
Q

What does the ‘mongoose.connect()’ function do?

A

‘mongoose.connect()’ establishes a connection to a MongoDB database.

67
Q

True or False: Node.js is suitable for building scalable applications.

A

True

68
Q

What is the main advantage of using a framework like Express?

A

Express simplifies the process of building web applications with Node.js by providing a robust set of features.

69
Q

Fill in the blank: _____ is used to handle asynchronous operations in Node.js without blocking the main thread.

A

Event loop

70
Q

What is the use of the ‘pm2 start’ command?

A

‘pm2 start’ is used to start an application in the background with PM2.

71
Q

What is the purpose of the ‘cors’ middleware?

A

‘cors’ middleware is used to enable Cross-Origin Resource Sharing.

72
Q

True or False: Node.js can be used to build command-line tools.

A

True

73
Q

What is the purpose of the ‘path’ module?

A

‘path’ provides utilities for working with file and directory paths.

74
Q

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

A

delete

75
Q

What does the ‘next()’ function do in Express?

A

‘next()’ passes control to the next middleware function.

76
Q

What is the main benefit of using asynchronous programming in Node.js?

A

Asynchronous programming allows Node.js to handle multiple operations concurrently without blocking the execution.

77
Q

What does the ‘jsonwebtoken.sign()’ method do?

A

‘jsonwebtoken.sign()’ creates a new JSON Web Token.

78
Q

True or False: Node.js supports ES6 syntax.

A

True

79
Q

What is the purpose of the ‘express.static()’ middleware?

A

‘express.static()’ serves static files such as images, CSS files, and JavaScript files.

80
Q

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.

A

callback

81
Q

What is the function of the ‘res’ object in Express?

A

The ‘res’ object is used to send a response back to the client.

82
Q

What does the ‘process.env.NODE_ENV’ variable indicate?

A

‘process.env.NODE_ENV’ indicates the environment in which the Node.js application is running, typically ‘development’ or ‘production’.

83
Q

True or False: Node.js applications can be easily containerized using Docker.

A

True

84
Q

What is the primary use of the ‘fs.promises’ API?

A

‘fs.promises’ provides promise-based methods for file system operations.

85
Q

Fill in the blank: _____ is a JavaScript runtime built for building fast and scalable network applications.

A

Node.js