0% found this document useful (0 votes)
10 views18 pages

Essential Node.js Interview Questions

This document is a comprehensive guide to Node.js interview questions, covering topics from basic concepts like the event loop and single-threaded nature to advanced topics such as promises, middleware, and error handling. It explains the functionality of Node.js, its ecosystem, and key features like NPM, modules, and streams. Additionally, it highlights differences between synchronous and asynchronous operations, as well as comparisons with other technologies like Angular and PHP.

Uploaded by

ahmedkam412
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views18 pages

Essential Node.js Interview Questions

This document is a comprehensive guide to Node.js interview questions, covering topics from basic concepts like the event loop and single-threaded nature to advanced topics such as promises, middleware, and error handling. It explains the functionality of Node.js, its ecosystem, and key features like NPM, modules, and streams. Additionally, it highlights differences between synchronous and asynchronous operations, as well as comparisons with other technologies like Angular and PHP.

Uploaded by

ahmedkam412
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Node.

js Interview Questions
Complete Guide for Beginners to Advanced

1. What is the Event Loop in [Link]?

The event loop is the core mechanism that enables [Link] to handle multiple tasks efficiently on a single thread. When you
perform an operation like reading a file, [Link] doesn’t wait for the task to complete. Instead, it delegates the task to the
operating system and moves on to handle other tasks in the queue. Once the task finishes, the event loop picks up the result and
executes the associated callback function. This asynchronous, non-blocking approach is what makes [Link] highly scalable and
efficient, especially for I/O-intensive tasks like serving multiple users or processing API requests.

The event loop in NodeJS is a mechanism that allows handling multiple asynchronous tasks concurrently within a single thread. It
continuously listens for events and executes associated callback functions.

[Link]("Start");
setTimeout(() => {
[Link]("Timeout callback");
}, 0);
[Link]("End");

Output: Start, End, Timeout callback

2. Why is [Link] Single-Threaded?

[Link] is single-threaded because it's based on the asynchronous, non-blocking nature of JavaScript. This design simplifies
development and maintenance while allowing NodeJS to handle many concurrent requests efficiently. Node provides a single
thread to programmers so that code can be written easily and without bottlenecks. Node internally uses multiple POSIX threads
for various I/O operations such as File, DNS, Network calls etc.
When Node gets an I/O request, it creates or uses a thread to perform that I/O operation and once the operation is done, it
pushes the result to the event queue. On each such event, the event loop runs and checks the queue and if the execution stack of
Node is empty then it adds the queue result to the execution stack. This is how Node manages concurrency.

3. What is [Link], and why is it used?

[Link] is a runtime environment that allows you to run JavaScript outside the browser. Traditionally, JavaScript was limited to
frontend tasks, but [Link] expanded its use to backend development, enabling developers to build the entire stack of an
application using one language - JavaScript. Another key feature of [Link] is its non-blocking, event-driven architecture. This
design allows it to handle multiple tasks simultaneously, such as processing user requests or fetching data from a database,
without waiting for one task to finish. Because of its ease of use, [Link] is widely used for everything from e-commerce
applications, RESTful APIs, and IoT projects.

[Link] is a JavaScript runtime environment used for developing server-side applications. It is based on JavaScript and uses the
V8 engine developed by Google.

4. How does [Link] work?

[Link] works on a single-threaded, event-driven architecture using the V8 JavaScript engine. V8 Engine: Compiles JavaScript
into fast machine code. Event Loop: Handles asynchronous tasks (I/O, timers, requests) without blocking the main thread. Libuv
library: Provides a thread pool and handles background tasks like file system operations and networking. Non-blocking I/O: Allows
[Link] to process thousands of concurrent requests efficiently without creating multiple threads.

5. What is NPM?

NPM stands for Node Package Manager. It is the package manager for the NodeJS environment. It is used to install, share, and
manage dependencies (libraries, tools, or packages) in JavaScript applications. NPM uses a [Link] file to track project
dependencies, versions, scripts, and metadata. Accessed via a command-line interface (CLI). Common commands: npm install,
npm update, npm uninstall.

6. If [Link] is single-threaded, then how does it handle


concurrency?

NodeJS handles concurrency efficiently through its event-driven, non-blocking I/O model. The event loop runs on a single thread
but does not block when waiting for I/O operations. I/O tasks are delegated to the system's kernel. Once complete, callbacks are
queued and processed by the event loop. This enables handling multiple concurrent tasks without sequential waiting.

7. Why is [Link] preferred over other backend technologies like


Java and PHP?

Fast Performance: Excels in I/O-heavy tasks. NPM Ecosystem: Over 50,000 packages to speed up development. Real-Time
Applications: Ideal for data-intensive apps without waiting for APIs. Unified Codebase: Same code for server and client improves
synchronization. Easy for JavaScript Developers: Leverages existing JavaScript skills.

8. What is the difference between Synchronous and


Asynchronous functions?

Synchronous Functions Asynchronous Functions


Blocks execution until task completes. Does not block; allows other tasks to proceed.

Executes tasks sequentially. Initiates tasks and continues while waiting.

Returns result immediately. Returns promise, callback, or uses event handling.

Errors caught with try-catch. Error handling via callbacks, promises, async/await.

Suitable for simple, sequential tasks. Ideal for I/O-bound and parallel operations.

9. What are modules in [Link]?

A module in NodeJS is a block of code that provides functionality and can communicate with external applications. Modules can
be a single file or a collection of files/folders. They promote reusability and reduce code complexity. Examples: http, fs, os, path.
Modules in [Link] are reusable blocks of code that help organize functionality into smaller, manageable pieces. There are three
types: Core Modules (built into [Link], e.g., fs, http, path); Local Modules (custom modules you create within your project); Third-
Party Modules (installed via npm, e.g., Express).

// [Link]
function add(a, b) {
return a + b;
}
[Link] = add;

// [Link]
const add = require('./math');
[Link](add(2, 3)); // Output: 5

10. What is the purpose of the 'require' keyword in [Link]?

The require keyword is used to include and import modules (external or built-in) into a NodeJS application.

const http = require('http'); // Imports the HTTP module to create a server.

11. What is the V8 engine in [Link]?

The V8 engine is an open-source JavaScript engine developed by Google, written in C++. Used in both [Link] and Google
Chrome. In [Link], it: Compiles JavaScript to native machine code for fast execution. Manages memory and garbage collection.
Provides the core runtime for executing JavaScript outside the browser, extended by [Link] APIs (e.g., file system, networking).

12. How to handle environment variables in [Link]?

Use [Link] to access environment variables. Store configurations in a .env file and load them using the dotenv package.

// Install dotenv
npm install dotenv

// Load .env file


require('dotenv').config();

// Access variables
const port = [Link] || 3000;
13. What is control flow in [Link]?

Control flow in [Link] refers to the order in which asynchronous operations (e.g., file reads, API calls, DB queries) are executed
and how their results are handled. Due to [Link] being non-blocking and event-driven, tasks may not finish in start order. Control
flow ensures proper management. It is a generic piece of code which runs in between several asynchronous function calls is
known as control flow function.

14. What is the order in which control flow statements get


executed?

The execution order includes: 1. Execution and queue handling 2. Collection of data and storing it 3. Handling concurrency 4.
Executing the next lines of code

15. What are the main disadvantages of [Link]?

Single-threaded nature: May not fully utilize multi-core CPUs. NoSQL preference: Less common use of relational databases like
MySQL. Rapid API changes: Frequent updates can cause instability and compatibility issues. CPU-intensive computations can block
responses. Multiple thread options are slower in performance. Relational databases may behave unpredictably when used with
[Link]. Not ideal for large-scale or heavy applications; better suited for lightweight applications.

16. What is REPL in [Link]?

REPL stands for Read, Evaluate, Print, Loop. It is an interactive shell environment for writing and debugging [Link] code in real time.
Read: Reads user input (JavaScript expressions). Eval: Evaluates/executes the input. Print: Prints the result to the console. Loop:
Loops back for more input.

17. How to import a module in [Link]?

Modules are imported using the require function (CommonJS) or import syntax (ES Modules).

// CommonJS (default):
const fs = require('fs'); // Built-in module
const add = require('./math'); // Custom module

// ES Modules (modern):
import fs from 'fs';
import { add } from './[Link]';

18. What is the difference between [Link] and Angular?

[Link] is a server-side runtime environment, while Angular is a front-end framework. [Link] uses JavaScript (or TypeScript),
runs on server to handle requests. Angular primarily uses TypeScript, runs in browser to build UIs. [Link] is efficient for I/O
operations, Angular is optimized for large SPAs.

19. What is [Link] in [Link]?


[Link] is a metadata file containing project information: dependencies, scripts, version, author, license, etc. It is present in
the root directory of a [Link] application/module. It defines the package's properties, including dependencies, metadata, and
configuration options.

{
"name": "app",
"version": "1.0.0",
"main": "[Link]",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"express": "^4.21.2"
}
}

20. How to create a simple HTTP server in [Link]?

Use the built-in http module.

const http = require('http');


const server = [Link]((req, res) => {
[Link](200, { 'Content-Type': 'text/plain' });
[Link]('Hello, World!');
});
[Link](3000, () => {
[Link]('Server is running at [Link]
});

Run with: node [Link]

21. What are the most commonly used libraries in [Link]?

ExpressJS: Minimal web framework for building APIs and web apps. Simplifies routing, middleware, and request/response handling.
Mongoose: ODM library for MongoDB and NodeJS. Manages data relationships, schema validation, and business logic.

22. What are promises in [Link]?

A promise is a JavaScript object used to handle asynchronous operations. It avoids callback hell by providing a cleaner way to
manage async data. Promises represent a value that may be available now, or in the future, or never.

23. How do you install, update, and delete a dependency?

Install: npm install <package-name> Update: npm update <package-name> Delete: npm uninstall <package-name>

24. Which command is used to import external libraries?

Use the require() function to import external libraries.

const express = require('express');


25. What is event-driven programming in [Link]?

Event-driven programming synchronizes multiple events to simplify program flow. Components: Callback function (event
handler): Called when an event is triggered. Event loop: Listens for events and invokes handlers.

26. What is a buffer in [Link]?

The Buffer class handles raw binary data. It represents a fixed-size chunk of memory for bytes. Unlike arrays, buffers are not
resizable and only deal with binary data. Use [Link]() to print Buffer instances.

27. What are streams in [Link]?

Streams handle data in chunks, avoiding loading entire datasets into memory. Useful for large data processing. Types: Readable
Streams: Read data (e.g., [Link](), [Link]). Writable Streams: Write data (e.g.,
[Link](), [Link]). Duplex Streams: Both readable and writable (e.g., TCP socket). Transform
Streams: Duplex streams that modify data (e.g., zlib for compression).

const fs = require('fs');
const readableStream = [Link]('[Link]', 'utf8');
[Link]('data', (chunk) => {
[Link]('Chunk received:', chunk);
});
[Link]('end', () => {
[Link]('File reading completed');
});

28. Explain the crypto module in [Link].

The crypto module provides functions for encrypting, decrypting, and hashing data. It secures data by converting plaintext to
encrypted format and back. Used for authentication and data protection.

29. What is callback hell?

Callback hell occurs due to nested callbacks, creating unreadable, pyramid-like code. Solved using promises, async/await, or
generators. The asynchronous function requires callbacks as a return parameter. When multiple asynchronous functions are
chained together then callback hell situation comes up.

30. Explain the use of the timers module in [Link].

The Timers module provides functions to execute code after a delay. It's global—no require needed. setTimeout(callback, delay):
Executes callback after delay. setImmediate(callback): Executes after current event loop cycle. setInterval(callback, delay):
Repeats callback at interval.

setTimeout(() => [Link]('After 1s'), 1000);


31. Difference between setImmediate() and [Link]()
methods

Feature setImmediate() [Link]()

Execution timing After current event loop cycle, before I/O Before any I/O or timers

Stack safety Less likely to cause stack overflow Can cause overflow if overused

Use case After I/O phase, before next loop Schedule before I/O in current phase

Example setImmediate(() => [Link]('Immediate')); [Link](() => [Link]('Next Tick'));

32. What are the different types of HTTP requests?

GET: Retrieve data. POST: Create a resource. PUT: Update an entire resource. PATCH: Partially update a resource. DELETE: Remove
a resource.

33. What is the difference between spawn() and fork() method?

Feature spawn() fork()

Purpose Launch new process with command Spawn [Link] processes

IPC Support No built-in IPC Built-in IPC support

Use Case Run shell commands/scripts Run [Link] scripts with messaging

Example spawn('ls', ['-lh', '/usr']) fork('[Link]')

34. Explain the use of the passport module in [Link]

The passport module adds authentication to web apps. It supports strategies like OAuth, Google, GitHub for user sign-in
operations.

35. What is a fork in [Link]?

fork creates child processes in NodeJS to handle increased workload. It spawns new instances of the engine, enabling multiple
processes to run code.

36. What are the three methods to avoid callback hell?

1. Using async/await 2. Using promises 3. Using generators

37. What is body-parser in [Link]?


body-parser is middleware that parses the body of incoming requests in a middleware before your handlers, available under
[Link] property.

38. What are the differences between require() and import?

Both require() and import are used to include code from other files or libraries, but they belong to different module systems.
require() is part of CommonJS, the default module system in [Link]; it is synchronous and works in all [Link] versions without
additional configuration. import is part of ES6 modules, offering a modern and concise syntax; it is asynchronous and requires
enabling ES modules by adding "type": "module" to your [Link].

// require
const fs = require('fs');

// import
import fs from 'fs';

39. What is the fs module, and how do synchronous and


asynchronous file operations work in [Link]?

The fs module provides tools to interact with the file system, such as reading, writing, or deleting files and directories.

// Asynchronous
const fs = require('fs');
[Link]('[Link]', 'utf8', (err, data) => {
if (err) {
[Link](err);
}
[Link](data);
});

// Synchronous
const data = [Link]('[Link]', 'utf8');
[Link](data);

Synchronous methods block the application, asynchronous do not.

40. What is middleware in [Link], and how is it used in Express?

Middleware in [Link] is a function that has access to the request and response objects, as well as the next function. It’s
commonly used in Express to handle tasks like logging, authentication, error handling, and parsing incoming requests.

const express = require('express');


const app = express();
[Link]((req, res, next) => {
[Link](`${[Link]} request to ${[Link]}`);
next();
});
[Link]('/', (req, res) => {
[Link]('Hello, World!');
});
[Link](3000);

41. How do you handle errors in [Link]?

Error handling is essential in [Link], especially since many operations are asynchronous. Using Callbacks, Promises, or try...catch
with Async/Await.
// Callback
[Link]('[Link]', 'utf8', (err, data) => {
if (err) {
[Link]('Error reading file:', [Link]);
}
[Link](data);
});

// Promise
[Link]('[Link]', 'utf8')
.then((data) => [Link](data))
.catch((err) => [Link]('Error:', [Link]));

// Async/Await
async function readFile() {
try {
const data = await [Link]('[Link]', 'utf8');
[Link](data);
} catch (err) {
[Link]('Error:', [Link]);
}
}
readFile();

42. How do you implement routing in a [Link] application?

Routing defines how an application responds to HTTP requests for specific endpoints (URLs) and HTTP methods (GET, POST, etc.).
In [Link], you can handle routing with the built-in http module, but using a framework like Express simplifies the process.

const express = require('express');


const app = express();
[Link]('/', (req, res) => {
[Link]('Welcome to the homepage!');
});
[Link]('/about', (req, res) => {
[Link]('This is the about page.');
});
[Link]('/submit', (req, res) => {
[Link]('Form submitted!');
});
[Link](3000);

43. What is clustering in [Link], and how does it improve


performance?

Clustering in [Link] allows you to create multiple instances of your application to take advantage of multi-core processors. By
default, [Link] runs on a single thread, but clustering enables the workload to be distributed across multiple CPU cores.

const cluster = require('cluster');


const http = require('http');
const os = require('os');
if ([Link]) {
const numCPUs = [Link]().length;
for (let i = 0; i < numCPUs; i++) {
[Link]();
}
} else {
[Link]((req, res) => {
[Link](200);
[Link]('Hello, World!');
}).listen(3000);
}
44. What are worker threads in [Link], and when should you use
them?

Worker threads allow you to run JavaScript code in parallel threads, which is useful for CPU-intensive tasks. Unlike child processes,
worker threads share memory with the main thread, making them more efficient for tasks requiring shared state.

const { Worker, isMainThread, parentPort } = require('worker_threads');


if (isMainThread) {
const worker = new Worker(__filename);
[Link]('message', (msg) => [Link](`Message from worker: ${msg}`));
} else {
[Link]('Hello from the worker thread!');
}

45. What is event loop starvation, and how can it be prevented?

Event loop starvation occurs when long-running tasks block the event loop, preventing it from handling other tasks. This can
make your application unresponsive. To prevent it, offload CPU-intensive tasks to worker threads or child processes, use
asynchronous operations, and optimize code to avoid long synchronous blocks.

// Example of blocking task (avoid this)


while (true) {
// This would starve the event loop
}

46. What is libuv?

libuv is a C library that is used to abstract non-blocking I/O operations to a consistent interface across all supported platforms. It
provides mechanisms to handle file system, DNS, network, child processes, pipes, signal handling, polling and streaming. It also
includes a thread pool for offloading work for some things that can't be done asynchronously at the operating system level.

47. What is an error-first callback?

Error-first callbacks are used to pass errors and data. The first argument is always an error object that the programmer has to
check if something went wrong. Additional arguments are used to pass data.

[Link](filePath, function(err, data) {


if (err) {
// handle the error
}
// use the data object
});

48. What's the difference between operational and programmer


errors?

Operational errors are not bugs, but problems with the system, like request timeout or hardware failure. Programmer errors are
actual bugs.
49. What is the difference between [Link], AJAX, and jQuery?

[Link] – It is a server-side platform for developing client-server applications. AJAX (aka Asynchronous Javascript and XML) – It is
a client-side scripting technique, primarily designed for rendering the contents of a page without refreshing it. jQuery – It is a
famous JavaScript module which complements AJAX, DOM traversal, looping and so on.

50. How to make a POST request in [Link]?

var request = require('request');


[Link]('[Link] {
form: {
key: 'value'
}
}, function(error, response, body) {
if (!error && [Link] == 200) {
[Link](body);
}
});

51. What are Event Listeners?

Event Listeners are similar to callback functions but are associated with some event. For example, when a server listens to an
HTTP request on a given port, an event will be generated and to specify that the HTTP server has received and will invoke the
corresponding event listener. [Link] has built-in events and built-in event listeners. [Link] also provides functionality to create
Custom events and Custom Event listeners.

52. Could we run an external process with [Link]?

Yes. Child process module enables us to access operating system functionaries or other apps. spawn - child_process.spawn
launches a new process with a given command. exec - child_process.exec method runs a command in a shell/console and
buffers the output. fork - The child_process.fork method is a special case of the spawn() to create child processes.

53. How you can monitor a file for modifications in [Link]?

We can take advantage of File System watch() function which watches the changes of the file.

54. What are the core modules of [Link]?

EventEmitter, Stream, FS, Net, Global Objects.

55. What is the difference between returning a callback and just


calling a callback?

return callback();
// some more lines of code; - won't be executed
callback();
// some more lines of code; - will be executed

56. What is a blocking code?

If application has to wait for some I/O operation in order to complete its execution any further then the code responsible for
waiting is known as blocking code.

57. How Node prevents blocking code?

By providing callback function. Callback function gets called whenever corresponding event triggered.

58. What is Event Emitter?

All objects that emit events are members of EventEmitter class. These objects expose an [Link]() function that allows
one or more functions to be attached to named events emitted by the object. When the EventEmitter object emits an event, all
of the functions attached to that specific event are called synchronously.

59. What is global installation of dependencies?

Globally installed packages/dependencies are stored in /npm directory. Such dependencies can be used in CLI (Command Line
Interface) function of any [Link] but cannot be imported using require() in Node application directly. To install a Node project
globally use -g flag.

60. What does "non-blocking" mean in [Link]?

Non-blocking means the program can continue executing other code while waiting for I/O operations to complete.

61. What are the security implementations in [Link]?

Error handling, Authentication and authorization, Data sanitization, Encryption, Logging and monitoring.

62. What is the purpose of the fs module in [Link]?

The fs module is used to create, manipulate files, and interact with the file system.

63. What does the os module provide in [Link]?

The os module provides tools for interacting with the operating system, including information about memory, processor, file
system, and network interfaces.
64. What are duplex streams in [Link]?

Duplex streams are both readable and writable, allowing data to be read from a source and written to a destination.

65. What is a transform stream?

A transform stream modifies or transforms data while it is being read or written (e.g., for data compression or encryption).

66. How many [Link] object methods are available?

There are 18 [Link] object methods available for creating, manipulating, and deleting objects.

67. What does HTTP status code 504 mean?

HTTP 504 indicates the server is unable to process the request, often due to overload or network issues.

68. What is routing in [Link]?

Routing associates HTTP requests with URL paths or routes. When a request matches a route, a corresponding handling function is
executed.

69. How do you open a file in [Link]?

Use the [Link]() method with two arguments: the file path and flags.

70. What is the difference between JavaScript and [Link]?

JavaScript is a programming language used for comprehensive application development. [Link] is a JavaScript runtime and
environment that performs non-blocking operations on the operating system.

71. What is Node-RED?

Node-RED is a visual programming tool for [Link] used to wire hardware devices and online services in IoT applications.

72. Is [Link] compatible with CPU-intensive applications?


No, [Link] is not compatible with CPU-intensive applications due to its single-threaded, event-driven model.

73. What file extension is used for [Link] files?

[Link] files use the .js extension.

74. Why does Google use V8 for [Link]?

Google uses V8 because it is faster and more efficient. It compiles JavaScript code directly into machine code.

75. What are the two types of API functions in [Link]?

Asynchronous non-blocking, Synchronous blocking API functions.

76. What categories of data types does [Link] support?

Primitive, Non-primitive.

77. What does I/O stand for in [Link]?

I/O stands for input/output, which helps in reading and writing files and performing network operations.

78. Is [Link] cross-platform?

Yes, [Link] is cross-platform and can run on Windows, Linux, Unix, and macOS.

79. How is [Link] different from other JavaScript environments?

[Link] is asynchronous and event-driven, unlike other JavaScript environments which are typically synchronous and browser-
based.

80. What types of applications can [Link] developers build?

Web applications, Chat applications, Real-time applications, Streaming applications, APIs, Desktop applications.

81. What is [Link] based on, and what engine does it use?
[Link] is based on JavaScript and uses the V8 engine developed by Google for building server-side applications.

82. Can [Link] be run on Windows?

Yes, it is possible to run [Link] on Windows.

83. What is unit testing in [Link]?

Unit testing in [Link] is the process of testing individual units of code.

84. What is blocking code?

Blocking code is code that cannot be executed until the current code is fully executed.

85. Give examples of async functions in [Link].

setTimeout(), setInterval(), [Link]().

86. What provides the JavaScript engine for [Link]?

The V8 library provides the JavaScript engine for [Link].

87. What are the states of a Promise object in JavaScript?

A Promise object can have three states: Pending: Initial state before resolution or rejection. Fulfilled (Resolved): Represents a
successful operation. Rejected: Represents a failed operation.

88. What are the main applications of [Link]?

Building real-time web applications, Distributed systems, General and complex network applications, Creating, reading, writing, or
closing server files.

89. Do all browsers support AJAX?

Yes, all browsers support AJAX.


90. How do you get the client IP address in [Link]?

Use [Link] to get the client's IP address.

91. How do you install the body-parser module in [Link]?

Open a command prompt or terminal. Navigate to your project directory. Run: npm install body-parser.

92. What are exit codes in [Link]?

Exit codes are specific codes used to complete a process. Examples include: Fatal error, Unused, Internal JavaScript evaluation
failure.

93. What causes server latency and prevents scalability in


[Link]?

Blocking I/O: Can make the server unresponsive. Use non-blocking I/O to avoid. Inefficient code: Poor algorithms, synchronous
operations, or inefficient data structures. Insufficient hardware: Low CPU, memory, or network bandwidth. Improper configuration:
Incorrect network settings, load balancing, etc.

94. How does [Link] use the V8 engine?

[Link] uses the Google V8 JavaScript engine to convert JavaScript code to C++.

95. What is event programming?

Event programming is a paradigm that uses events to trigger actions. Events can be generated by users, systems, or programs.

96. What is the difference between AJAX and [Link]?

AJAX: A client-side technology to make web pages interactive and dynamic. [Link]: A server-side technology for building
scalable, high-performance web applications.

97. Where are dependencies stored in a [Link] project?

Dependencies are stored in the [Link] file.

98. What is a control function in [Link]?


A control function manages and manipulates the flow of asynchronous code execution.

99. Why are control functions needed in [Link]?

[Link] handles asynchronous I/O, but managing execution order is challenging. Control functions help define the order of
operations, handle errors, manage callbacks, and control flow.

100. How does modularization benefit [Link] applications?

Modularization provides scalability in complex applications by allowing the import of objects, classes, functions, modules, and
external files.

101. What is a callback function in [Link]?

A callback function is executed after a certain event occurs. Callback is an asynchronous equivalent for a function. A callback
function is called at the completion of a given task. Node makes heavy use of callbacks.

102. Why are callback functions important in [Link]?

Due to [Link]'s event mechanism, a callback is called every time an event starts, preventing blocking.

103. What are the three layers in [Link] application architecture?

API layer, Service layer, Integration layer.

104. What are the two input arguments for an asynchronous


queue in [Link]?

Concurrency value, Task function.

105. Does [Link] buffer data?

No, [Link] applications do not buffer data.

106. What are the possible values of the Boolean data type in
[Link]?

The Boolean data type can be: true or false.


107. Can [Link] run external processes?

Yes, external processes can be run using the child_process module.

108. How can callback hell be avoided in [Link]?

Callback hell can be avoided using: Promises (improves readability and debuggability), async/await, Libraries, Modularization.

Created with ❤ by Basant Elsaey

You might also like