π 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
Example:
{
"name": "myapp",
"version": "1.0.0"
}
π§ 126. What is nodemon?
nodemon automatically restarts server after code changes.
Install:
npm install -g nodemon
π§ 127. What are Streams in Node.js?
Streams process data piece by piece instead of loading all at once.
Types:
β’ Readable
β’ Writable
β’ Duplex
β’ Transform
Benefits:
β Memory efficient
β Faster processing
π§ 128. What is Buffering?
Buffer temporarily stores binary data in memory.
Example:
const buffer = Buffer.from("Hello");
π§ 129. What is Async Middleware?
Middleware using async/await.
Example:
app.get("/", async (req, res) => {
const data = await fetchData();
res.json(data);
});
π§ 130. What is Rate Limiting?
Rate limiting restricts number of requests from users.
Benefits:
β Prevents abuse
β Protects APIs
β Improves security
Example:
const rateLimit = require("express-rate-limit");
Double Tap β€οΈ For Part-6
@CodingCoursePro
Shared with Loveβ
{
"name": "myapp",
"version": "1.0.0"
}
π§ 126. What is nodemon?
nodemon automatically restarts server after code changes.
Install:
npm install -g nodemon
π§ 127. What are Streams in Node.js?
Streams process data piece by piece instead of loading all at once.
Types:
β’ Readable
β’ Writable
β’ Duplex
β’ Transform
Benefits:
β Memory efficient
β Faster processing
π§ 128. What is Buffering?
Buffer temporarily stores binary data in memory.
Example:
const buffer = Buffer.from("Hello");
π§ 129. What is Async Middleware?
Middleware using async/await.
Example:
app.get("/", async (req, res) => {
const data = await fetchData();
res.json(data);
});
π§ 130. What is Rate Limiting?
Rate limiting restricts number of requests from users.
Benefits:
β Prevents abuse
β Protects APIs
β Improves security
Example:
const rateLimit = require("express-rate-limit");
Double Tap β€οΈ For Part-6
@CodingCoursePro
Shared with Love
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π Web Development Interview Questions with Answers β Part 6: Database
π§ 131. What is SQL?
SQL stands for: π Structured Query Language
It is used to manage and manipulate relational databases.
Uses:
β’ Store data
β’ Retrieve data
β’ Update records
β’ Delete records
Example:
SELECT * FROM users;
π§ 132. Difference Between SQL and NoSQL
SQL : Relational database : Uses tables : Structured schema
NoSQL : Non-relational database : Uses collections/documents : Flexible schema
Examples:
β’ SQL β MySQL
β’ NoSQL β MongoDB
π§ 133. What is Primary Key?
Primary key uniquely identifies each record in a table.
Features:
β Unique
β Cannot be NULL
Example:
CREATE TABLE users (
id INT PRIMARY KEY,
name VARCHAR(50)
);
π§ 134. What is Foreign Key?
Foreign key creates relationship between two tables.
Example:
CREATE TABLE orders (
order_id INT,
user_id INT,
FOREIGN KEY (user_id) REFERENCES users(id)
);
π§ 135. What is Normalization?
Normalization organizes database to reduce redundancy.
Normal Forms:
β’ 1NF
β’ 2NF
β’ 3NF
Benefits:
β Reduced duplication
β Better consistency
β Improved integrity
π§ 136. What are Joins in SQL?
Joins combine data from multiple tables.
Types:
β’ INNER JOIN
β’ LEFT JOIN
β’ RIGHT JOIN
β’ FULL JOIN
Example:
SELECT users.name, orders.amount
FROM users
INNER JOIN orders
ON users.id = orders.user_id;
π§ 137. Difference Between INNER JOIN and LEFT JOIN
INNER JOIN : Returns matching rows only
LEFT JOIN : Returns all left table rows
Example:
SELECT * FROM users
LEFT JOIN orders
ON users.id = orders.user_id;
π§ 138. What is Indexing?
Index improves database query performance.
Benefits:
β Faster searches
β Faster filtering
Example:
CREATE INDEX idx_name
ON users(name);
π§ 139. What is Aggregate Function?
Aggregate functions perform calculations on multiple rows.
Common Functions:
β’ COUNT()
β’ SUM()
β’ AVG()
β’ MIN()
β’ MAX()
Example:
SELECT COUNT(*) FROM users;
π§ 140. Difference Between DELETE, DROP, and TRUNCATE
DELETE : Removes rows : Can use WHERE
DROP : Removes table : Deletes structure
TRUNCATE : Removes all rows : Faster than DELETE
Example:
DELETE FROM users WHERE id = 1;
π§ 141. What is MongoDB?
MongoDB is a NoSQL database that stores data in JSON-like documents.
Features:
β Flexible schema
β High scalability
β Fast performance
Example Document:
{
"name": "Deepak",
"age": 25
}
π§ 142. Difference Between MongoDB and MySQL
MongoDB : NoSQL : Flexible schema : Document-based
MySQL : SQL : Fixed schema : Table-based
π§ 143. What is Schema?
Schema defines structure of database.
Example:
CREATE TABLE users (
id INT,
name VARCHAR(50)
);
π§ 144. What is ORM?
ORM stands for: π Object Relational Mapping
ORM allows interaction with database using programming language objects.
Benefits:
β Easier queries
β Cleaner code
β Faster development
π§ 145. What is Sequelize?
Sequelize is an ORM for Node.js.
Example:
User.findAll();
@CodingCoursePro
Shared with Loveβ
π§ 131. What is SQL?
SQL stands for: π Structured Query Language
It is used to manage and manipulate relational databases.
Uses:
β’ Store data
β’ Retrieve data
β’ Update records
β’ Delete records
Example:
SELECT * FROM users;
π§ 132. Difference Between SQL and NoSQL
SQL : Relational database : Uses tables : Structured schema
NoSQL : Non-relational database : Uses collections/documents : Flexible schema
Examples:
β’ SQL β MySQL
β’ NoSQL β MongoDB
π§ 133. What is Primary Key?
Primary key uniquely identifies each record in a table.
Features:
β Unique
β Cannot be NULL
Example:
CREATE TABLE users (
id INT PRIMARY KEY,
name VARCHAR(50)
);
π§ 134. What is Foreign Key?
Foreign key creates relationship between two tables.
Example:
CREATE TABLE orders (
order_id INT,
user_id INT,
FOREIGN KEY (user_id) REFERENCES users(id)
);
π§ 135. What is Normalization?
Normalization organizes database to reduce redundancy.
Normal Forms:
β’ 1NF
β’ 2NF
β’ 3NF
Benefits:
β Reduced duplication
β Better consistency
β Improved integrity
π§ 136. What are Joins in SQL?
Joins combine data from multiple tables.
Types:
β’ INNER JOIN
β’ LEFT JOIN
β’ RIGHT JOIN
β’ FULL JOIN
Example:
SELECT users.name, orders.amount
FROM users
INNER JOIN orders
ON users.id = orders.user_id;
π§ 137. Difference Between INNER JOIN and LEFT JOIN
INNER JOIN : Returns matching rows only
LEFT JOIN : Returns all left table rows
Example:
SELECT * FROM users
LEFT JOIN orders
ON users.id = orders.user_id;
π§ 138. What is Indexing?
Index improves database query performance.
Benefits:
β Faster searches
β Faster filtering
Example:
CREATE INDEX idx_name
ON users(name);
π§ 139. What is Aggregate Function?
Aggregate functions perform calculations on multiple rows.
Common Functions:
β’ COUNT()
β’ SUM()
β’ AVG()
β’ MIN()
β’ MAX()
Example:
SELECT COUNT(*) FROM users;
π§ 140. Difference Between DELETE, DROP, and TRUNCATE
DELETE : Removes rows : Can use WHERE
DROP : Removes table : Deletes structure
TRUNCATE : Removes all rows : Faster than DELETE
Example:
DELETE FROM users WHERE id = 1;
π§ 141. What is MongoDB?
MongoDB is a NoSQL database that stores data in JSON-like documents.
Features:
β Flexible schema
β High scalability
β Fast performance
Example Document:
{
"name": "Deepak",
"age": 25
}
π§ 142. Difference Between MongoDB and MySQL
MongoDB : NoSQL : Flexible schema : Document-based
MySQL : SQL : Fixed schema : Table-based
π§ 143. What is Schema?
Schema defines structure of database.
Example:
CREATE TABLE users (
id INT,
name VARCHAR(50)
);
π§ 144. What is ORM?
ORM stands for: π Object Relational Mapping
ORM allows interaction with database using programming language objects.
Benefits:
β Easier queries
β Cleaner code
β Faster development
π§ 145. What is Sequelize?
Sequelize is an ORM for Node.js.
Example:
User.findAll();
@CodingCoursePro
Shared with Love
Please open Telegram to view this post
VIEW IN TELEGRAM
Benefits:
β Easy database interaction
β Supports SQL databases
π§ 146. What is Mongoose?
Mongoose is an ODM library for MongoDB.
Example:
const User = mongoose.model("User", userSchema);
π§ 147. What are ACID Properties?
ACID ensures reliable database transactions.
Properties:
β’ Atomicity
β’ Consistency
β’ Isolation
β’ Durability
Benefits:
β Data reliability
β Transaction safety
π§ 148. What is Transaction?
Transaction is a group of database operations executed together.
Example:
BEGIN;
UPDATE accounts
SET balance = balance - 500
WHERE id = 1;
COMMIT;
π§ 149. What is Database Sharding?
Sharding splits database into smaller parts.
Benefits:
β Better scalability
β Faster performance
π§ 150. What is Replication?
Replication copies database data across multiple servers.
Benefits:
β High availability
β Backup support
β Fault tolerance
Double Tap β€οΈ For Part-7
@CodingCoursePro
Shared with Loveβ
β Easy database interaction
β Supports SQL databases
π§ 146. What is Mongoose?
Mongoose is an ODM library for MongoDB.
Example:
const User = mongoose.model("User", userSchema);
π§ 147. What are ACID Properties?
ACID ensures reliable database transactions.
Properties:
β’ Atomicity
β’ Consistency
β’ Isolation
β’ Durability
Benefits:
β Data reliability
β Transaction safety
π§ 148. What is Transaction?
Transaction is a group of database operations executed together.
Example:
BEGIN;
UPDATE accounts
SET balance = balance - 500
WHERE id = 1;
COMMIT;
π§ 149. What is Database Sharding?
Sharding splits database into smaller parts.
Benefits:
β Better scalability
β Faster performance
π§ 150. What is Replication?
Replication copies database data across multiple servers.
Benefits:
β High availability
β Backup support
β Fault tolerance
Double Tap β€οΈ For Part-7
@CodingCoursePro
Shared with Love
Please open Telegram to view this post
VIEW IN TELEGRAM
Media is too big
VIEW IN TELEGRAM
Responsive design is more important than ever as we want to ensure that our website looks awesome on all devices. With Flexbox we can make our Elements more dynamic, so let's find out how this works in this tutorial!
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Box shadows in CSS can be layered. You can apply multiple box shadows for the same element. This is generally used for a rich and realistic box shadow, but what's stopping us hacking this π€
βͺοΈ Here we create a box shadow with 0 blur and some offset to create a duplicate layer
βͺοΈ Then we create a similar layer but a pixel more of spread, to create a pseudo border
βͺοΈ Finally another actual box shadow layer
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
β€1