🚀 Web Development Interview Questions with Answers — Part 5: Node.js
🧠 111. What is Node.js?
Node.js is a JavaScript runtime built on Chrome’s V8 engine.
It allows JavaScript to run outside the browser.
Features:
✅ Fast execution
✅ Event-driven
✅ Non-blocking I/O
✅ Scalable applications
Example:
console.log("Hello Node.js");
🧠 112. Why Use Node.js?
Advantages:
✅ Fast performance
✅ Single programming language for frontend & backend
✅ Handles multiple requests efficiently
✅ Huge npm ecosystem
Best Use Cases:
• APIs
• Real-time apps
• Chat applications
• Streaming services
🧠 113. What is npm?
npm stands for: 👉 Node Package Manager
Used to install libraries/packages.
Example:
npm install express
Uses:
• Install packages
• Manage dependencies
• Run scripts
🧠 114. Difference Between CommonJS and ES Modules
CommonJS : Uses require() : Uses module.exports
ES Modules : Uses import : Uses export
CommonJS:
const fs = require("fs");
ES Modules:
import fs from "fs";
🧠 115. What is Express.js?
Express.js is a minimal backend framework for Node.js.
Features:
✅ Routing
✅ Middleware support
✅ API development
Example:
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("Hello");
});
🧠 116. What is Middleware?
Middleware functions execute between: Request → Response
Uses:
• Authentication
• Logging
• Validation
Example:
app.use((req, res, next) => {
console.log("Middleware");
next();
});
🧠 117. What is REST API?
REST API follows REST architecture principles.
Common Methods:
• GET
• POST
• PUT
• DELETE
Example:
app.get("/users", (req, res) => {
res.json(users);
});
🧠 118. Difference Between PUT and PATCH
PUT : Updates entire resource
PATCH : Updates partial resource
Example:
PUT /user/1
PATCH /user/1
🧠 119. What is JWT?
JWT stands for: 👉 JSON Web Token
Used for authentication.
Structure:
Header.Payload.Signature
Benefits:
✅ Secure authentication
✅ Stateless sessions
🧠 120. What is Authentication vs Authorization?
Authentication : Verifies identity
Authorization : Verifies permissions
Example:
• Login → Authentication
• Admin access → Authorization
🧠 121. What is CORS?
CORS stands for: 👉 Cross-Origin Resource Sharing
It controls resource sharing between different domains.
Example:
app.use(cors());
🧠 122. What is dotenv?
dotenv loads environment variables from .env file.
Example:
require("dotenv").config();
.env
PORT=5000
🧠 123. What is Event Loop?
Event loop handles asynchronous operations in Node.js.
Process:
1. Executes synchronous code
2. Handles callbacks
3. Processes async tasks
Benefits:
✅ Non-blocking execution
✅ Efficient concurrency
🧠 124. What is Non-Blocking I/O?
Node.js can process multiple requests without waiting.
Benefits:
✅ Faster performance
✅ Better scalability
🧠 125. What is package.json?
package.json stores project metadata and dependencies.
@CodingCoursePro
Shared with Love➕
🧠 111. What is Node.js?
Node.js is a JavaScript runtime built on Chrome’s V8 engine.
It allows JavaScript to run outside the browser.
Features:
✅ Fast execution
✅ Event-driven
✅ Non-blocking I/O
✅ Scalable applications
Example:
console.log("Hello Node.js");
🧠 112. Why Use Node.js?
Advantages:
✅ Fast performance
✅ Single programming language for frontend & backend
✅ Handles multiple requests efficiently
✅ Huge npm ecosystem
Best Use Cases:
• APIs
• Real-time apps
• Chat applications
• Streaming services
🧠 113. What is npm?
npm stands for: 👉 Node Package Manager
Used to install libraries/packages.
Example:
npm install express
Uses:
• Install packages
• Manage dependencies
• Run scripts
🧠 114. Difference Between CommonJS and ES Modules
CommonJS : Uses require() : Uses module.exports
ES Modules : Uses import : Uses export
CommonJS:
const fs = require("fs");
ES Modules:
import fs from "fs";
🧠 115. What is Express.js?
Express.js is a minimal backend framework for Node.js.
Features:
✅ Routing
✅ Middleware support
✅ API development
Example:
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.send("Hello");
});
🧠 116. What is Middleware?
Middleware functions execute between: Request → Response
Uses:
• Authentication
• Logging
• Validation
Example:
app.use((req, res, next) => {
console.log("Middleware");
next();
});
🧠 117. What is REST API?
REST API follows REST architecture principles.
Common Methods:
• GET
• POST
• PUT
• DELETE
Example:
app.get("/users", (req, res) => {
res.json(users);
});
🧠 118. Difference Between PUT and PATCH
PUT : Updates entire resource
PATCH : Updates partial resource
Example:
PUT /user/1
PATCH /user/1
🧠 119. What is JWT?
JWT stands for: 👉 JSON Web Token
Used for authentication.
Structure:
Header.Payload.Signature
Benefits:
✅ Secure authentication
✅ Stateless sessions
🧠 120. What is Authentication vs Authorization?
Authentication : Verifies identity
Authorization : Verifies permissions
Example:
• Login → Authentication
• Admin access → Authorization
🧠 121. What is CORS?
CORS stands for: 👉 Cross-Origin Resource Sharing
It controls resource sharing between different domains.
Example:
app.use(cors());
🧠 122. What is dotenv?
dotenv loads environment variables from .env file.
Example:
require("dotenv").config();
.env
PORT=5000
🧠 123. What is Event Loop?
Event loop handles asynchronous operations in Node.js.
Process:
1. Executes synchronous code
2. Handles callbacks
3. Processes async tasks
Benefits:
✅ Non-blocking execution
✅ Efficient concurrency
🧠 124. What is Non-Blocking I/O?
Node.js can process multiple requests without waiting.
Benefits:
✅ Faster performance
✅ Better scalability
🧠 125. What is package.json?
package.json stores project metadata and dependencies.
@CodingCoursePro
Shared with Love
Please open Telegram to view this post
VIEW IN TELEGRAM