Python Developer Interview Questions (Part 2): Multithreading, Async, FastAPI, Django and Flask
Python interview questions for 2–4 years: multithreading, multiprocessing, asyncio, FastAPI, Django, Flask and real scenarios, with code and real output.
The 30 Node.js interview questions asked most — event loop, modules, streams, async code, Express and performance — with clear answers and code examples.
Node.js has become one of the most widely used technologies for building modern web applications, REST APIs, microservices, real-time chat systems, and scalable backend platforms. From startups to large enterprises, thousands of applications today rely on Node.js because of its speed, flexibility, and ability to handle large numbers of concurrent requests efficiently.
As a result, Node.js is now a core skill for Backend Developers, Full Stack Developers, MERN Stack Developers, and Software Engineers. Whether you are preparing for your first job interview or looking to switch to a better role, a strong understanding of Node.js fundamentals and advanced concepts is essential.
In interviews, recruiters usually start with basic questions about the Event Loop, npm, modules, streams, and asynchronous programming. For experienced candidates, discussions often move towards Express.js, REST APIs, JWT authentication, caching, microservices, clustering, performance optimization, and real-world application architecture.
To help you prepare effectively, we have compiled the Top 30 Node.js Interview Questions and Answers that are frequently asked in technical interviews at startups, product-based companies, service-based organizations, and enterprise projects.
Each question includes a clear explanation, practical examples, and interview-focused answers so that you can confidently explain the concepts instead of simply memorizing definitions.
Let's begin with the most important Node.js fundamentals that every developer should know before attending an interview.
Node.js is an open-source, cross-platform JavaScript runtime environment built on Google's V8 JavaScript Engine. It allows developers to execute JavaScript code outside the browser and build fast, scalable server-side applications.
Unlike traditional web servers that create a separate thread for every request, Node.js follows a single-threaded, event-driven, non-blocking I/O architecture, making it highly efficient for handling multiple concurrent connections.
console.log("Hello Node.js!");
Output
Hello Node.js!
Node.js is not a programming language or framework. It is a JavaScript Runtime Environment.
Node.js works using an Event-Driven and Non-Blocking I/O Model. Instead of creating a separate thread for every request, Node.js uses a single thread along with an Event Loop to handle thousands of concurrent requests efficiently.
Client Request
↓
Event Loop
↓
Non-Blocking Task
↓
Callback Queue
↓
Response Sent
console.log("Start");
setTimeout(() => {
console.log("Async Task");
}, 2000);
console.log("End");
Output
Start
End
Async Task
The Event Loop is the heart of Node.js and one of the most frequently asked interview topics.
Node.js offers several advantages that make it one of the most preferred backend technologies for modern web development.
| Feature | Benefit |
|---|---|
| Fast Execution | Powered by Google's V8 Engine |
| Non-Blocking I/O | Handles multiple requests efficiently |
| Single Language | JavaScript on both Frontend and Backend |
| npm Ecosystem | Millions of reusable packages |
| Scalable | Supports high traffic applications |
| Real-Time Support | Perfect for chat apps and live updates |
Node.js performs exceptionally well for I/O-intensive applications but is not the best choice for CPU-intensive tasks.
Event-Driven Architecture is a programming model where the application's flow is determined by events such as user actions, API requests, file uploads, or database updates.
Node.js heavily relies on events and provides the EventEmitter class to create and handle custom events.
const EventEmitter = require('events');
const emitter = new EventEmitter();
emitter.on('greet', () => {
console.log('Welcome to LearnFrenzy!');
});
emitter.emit('greet');
Output
Welcome to LearnFrenzy!
Event Occurs
↓
Event Listener
↓
Event Handler Executes
Many built-in Node.js modules internally use the EventEmitter class.
The Event Loop is a mechanism that allows Node.js to perform non-blocking operations despite being single-threaded.
It continuously monitors the Call Stack and Callback Queue and executes callbacks whenever the Call Stack becomes empty.
Call Stack
↓
Event Loop
↓
Callback Queue
↓
Execute Callback
console.log("1");
setTimeout(() => {
console.log("2");
}, 0);
console.log("3");
Output
1
3
2
Even though the timeout is set to 0 milliseconds, the callback is added to the Callback Queue and executes only after the current Call Stack becomes empty.
Explain the Event Loop with an example. Almost every Node.js interview includes at least one question related to the Event Loop.
Q6–Q10 covers Streams, Buffers, Node.js vs JavaScript, npm, and package.json.
Streams are objects that allow you to read or write data continuously instead of loading the entire file into memory at once.
Streams are useful when working with large files, videos, logs, or network data because they improve performance and reduce memory usage.
const fs = require('fs');
const readStream = fs.createReadStream('input.txt');
readStream.on('data', chunk => {
console.log(chunk.toString());
});
Streams process data piece by piece instead of loading the entire data into memory. They are highly efficient for handling large files and real-time data transfer.
A Buffer is a temporary memory area used to store binary data.
JavaScript was originally designed to work with text data, but Node.js often deals with files, images, videos, network packets, and other binary data. Buffers help handle such data efficiently.
const buffer = Buffer.from('LearnFrenzy');
console.log(buffer);
console.log(buffer.toString());
<Buffer 4c 65 61 72 6e 46 72 65 6e 7a 79>
LearnFrenzy
A Buffer is a global Node.js object used to store raw binary data temporarily. It is commonly used while working with file systems, streams, and network operations.
Many beginners think Node.js and JavaScript are the same thing, but they are different.
| Feature | JavaScript | Node.js |
|---|---|---|
| Type | Programming Language | Runtime Environment |
| Execution | Browser | Server |
| Access File System | No | Yes |
| DOM Access | Yes | No |
| Modules | Limited | Rich Module Ecosystem |
| Main Use | Frontend Development | Backend Development |
JavaScript is a programming language, whereas Node.js is a runtime environment that allows JavaScript code to run outside the browser and build server-side applications.
npm stands for Node Package Manager.
It is the default package manager for Node.js and is used to install, update, and manage third-party libraries and dependencies.
npm init
npm install express
npm install
npm uninstall express
npm update
npm install express
This command downloads and installs the Express.js framework into your project.
npm is the package manager of Node.js that helps developers install and manage project dependencies efficiently. It provides access to millions of open-source packages.
package.json is the main configuration file of a Node.js project.
It contains important information such as project details, dependencies, scripts, version information, and metadata.
{
"name": "node-demo",
"version": "1.0.0",
"description": "Node.js Project",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "^5.0.0"
}
}
package.json is the heart of a Node.js application. It stores project metadata, dependency information, scripts, and configuration required for running and maintaining the application.
✅ Next Section: Q11–Q20 (Express.js, Middleware, REST APIs, Authentication, JWT, File Uploads, Error Handling, Clustering & Security)
Callback Hell occurs when multiple asynchronous operations are nested inside each other, making the code difficult to read, maintain, and debug.
getUser(function(user){
getOrders(user.id, function(orders){
getPayment(orders[0].id, function(payment){
console.log(payment);
});
});
});
Callback Hell is one of the main reasons Promises and Async/Await were introduced.
A Promise represents the eventual completion or failure of an asynchronous operation.
const promise = new Promise((resolve, reject) => {
resolve("Success");
});
promise.then(result => {
console.log(result);
});
Output
Success
Promises improve readability and eliminate deep callback nesting.
Async/Await is built on top of Promises and makes asynchronous code appear synchronous.
function fetchData() {
return Promise.resolve("Data Loaded");
}
async function getData() {
const result = await fetchData();
console.log(result);
}
getData();
Output
Data Loaded
Modern Node.js applications heavily use Async/Await.
CommonJS is the default module system used by Node.js.
function greet() {
return "Hello";
}
module.exports = greet;
const greet = require('./greet');
console.log(greet());
Hello
CommonJS uses require() and module.exports.
ES Modules are the modern JavaScript module system introduced in ES6.
export function greet() {
return "Hello";
}
import { greet } from './greet.js';
console.log(greet());
| CommonJS | ES Modules |
|---|---|
| require() | import |
| module.exports | export |
| Synchronous | Asynchronous |
Middleware functions execute during the request-response cycle.
app.use((req, res, next) => {
console.log("Middleware Executed");
next();
});
Express.js middleware is one of the most frequently asked interview topics.
| process.nextTick() | setImmediate() |
|---|---|
| Executes before Event Loop continues | Executes during next iteration |
| Higher Priority | Lower Priority |
| Runs immediately | Runs later |
process.nextTick(() => {
console.log("nextTick");
});
setImmediate(() => {
console.log("setImmediate");
});
nextTick
setImmediate
Clustering allows Node.js applications to utilize multiple CPU cores by creating child processes.
const cluster = require('cluster');
if(cluster.isMaster){
cluster.fork();
cluster.fork();
}
Node.js is single-threaded, but clustering allows multi-core utilization.
The Child Process module allows Node.js to create and manage separate processes.
const { exec } = require('child_process');
exec('dir', (error, stdout) => {
console.log(stdout);
});
Worker Threads allow Node.js to execute CPU-intensive tasks in separate threads without blocking the Event Loop.
const {
Worker
} = require('worker_threads');
new Worker('./worker.js');
Difference between Clustering and Worker Threads. Clustering creates multiple processes, while Worker Threads create multiple threads within the same process.
Q21–Q30 covers REST APIs, JWT Authentication, CORS, Redis, Socket.IO, Microservices, Performance Optimization, and Production-Level Node.js Questions.
A REST API (Representational State Transfer Application Programming Interface) is a set of rules that allows applications to communicate with each other using HTTP methods such as GET, POST, PUT, PATCH, and DELETE.
Node.js is commonly used with Express.js to build RESTful APIs that serve data to web applications, mobile apps, and third-party systems.
const express = require('express');
const app = express();
app.get('/users', (req, res) => {
res.json({
message: 'Users fetched successfully'
});
});
app.listen(3000);
Almost every Node.js project involves REST APIs, making this one of the most important interview topics.
Error handling is an important part of Express.js applications. Express provides dedicated middleware for handling application errors.
app.use((err, req, res, next) => {
res.status(500).json({
message: err.message
});
});
app.get('/user', (req, res, next) => {
try {
throw new Error("Something went wrong");
} catch(error) {
next(error);
}
});
JWT (JSON Web Token) is a secure method used for authentication and authorization between client and server.
Header.Payload.Signature
const jwt = require('jsonwebtoken');
const token = jwt.sign(
{ userId: 101 },
'secretKey',
{ expiresIn: '1h' }
);
console.log(token);
JWT Authentication is one of the most frequently asked backend interview topics.
CORS (Cross-Origin Resource Sharing) is a browser security feature that controls how resources are shared between different domains.
Frontend:
http://localhost:4200
Backend:
http://localhost:3000
Browsers block requests across different origins unless CORS is enabled.
const cors = require('cors');
app.use(cors());
Rate Limiting restricts the number of requests a client can make within a specified period.
const rateLimit = require('express-rate-limit');
const limiter = rateLimit({
windowMs: 15 * 60 * 1000,
max: 100
});
app.use(limiter);
Redis is an in-memory key-value database commonly used for caching and performance optimization.
const redis = require('redis');
const client = redis.createClient();
client.set('username', 'LearnFrenzy');
Redis is widely used in enterprise applications to improve API response times.
Socket.IO is a library that enables real-time bidirectional communication between client and server.
io.on('connection', (socket) => {
console.log('User Connected');
socket.emit('message', 'Welcome User');
});
Performance optimization is a critical skill for Node.js developers.
Performance optimization questions are common for experienced Node.js positions.
Microservices is an architectural style where an application is divided into small independent services that communicate through APIs.
User Service
↓
Order Service
↓
Payment Service
↓
Notification Service
Production applications must be optimized for performance, security, maintainability, and scalability.
PORT=3000
DB_URL=mongodb://localhost/app
JWT_SECRET=mySecretKey
How would you design and deploy a scalable Node.js application for millions of users?
| Section | Topics Covered |
|---|---|
| Q1–Q10 | Node.js Fundamentals, Event Loop, Streams, Buffers, npm, package.json |
| Q11–Q20 | Promises, Async/Await, Middleware, Modules, Clustering, Worker Threads |
| Q21–Q30 | REST APIs, JWT, CORS, Redis, Socket.IO, Microservices, Performance Optimization |
Node.js remains one of the most in-demand backend technologies in 2026. Whether you're preparing for a Fresher, MERN Stack Developer, Backend Developer, Full Stack Developer, or Senior Software Engineer interview, mastering these 30 Node.js interview questions will significantly improve your chances of success.
Focus on understanding concepts like the Event Loop, Asynchronous Programming, Express.js, JWT Authentication, Redis Caching, and Microservices Architecture, as these topics frequently appear in technical interviews.
The best way to crack a Node.js interview is to combine theoretical knowledge with hands-on project experience.
Practice consistently, build real-world projects, and keep learning. 😊
⭐ Found this guide useful?
Share it with your friends and help them crack their Node.js interviews.
One short email when we publish something new — interview questions, Salesforce guides and career tips. No spam, unsubscribe in one click.
Python interview questions for 2–4 years: multithreading, multiprocessing, asyncio, FastAPI, Django, Flask and real scenarios, with code and real output.
Python developer interview questions for 2–4 years experience with real code and output: core Python, OOP, decorators and 15 coding problems.
Agentforce interview questions for Python developers (2–4 years): Apex actions, Agentforce Python SDK, Agent API, Azure AI and real scenarios, with code.
Questions, corrections or your own experience — they all help the next reader.
Jhanvi Mehta
Nitya Bansal
Shreya Gupta
Anil Yadav