0% found this document useful (0 votes)
8 views48 pages

Interview Notes

The document provides detailed interview notes on JavaScript and React fundamentals, covering topics such as variable declarations, scope, hoisting, data types, functions, asynchronous programming, and React components. It includes definitions, examples, and important distinctions relevant for interviews. Key concepts like closures, promises, and the use of props in React are also highlighted for better understanding.
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)
8 views48 pages

Interview Notes

The document provides detailed interview notes on JavaScript and React fundamentals, covering topics such as variable declarations, scope, hoisting, data types, functions, asynchronous programming, and React components. It includes definitions, examples, and important distinctions relevant for interviews. Key concepts like closures, promises, and the use of props in React are also highlighted for better understanding.
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

Interview Notes – Roman Urdu

JavaScript Fundamentals + React Fundamentals + Node/Express/Backend


Fundamentals

1) JavaScript Fundamentals

1.1 JavaScript kya hai?

JavaScript ek programming language hai jo originally web pages ko interactive banane ke


liye use hoti thi. Aaj kal JavaScript sirf browser mein hi nahi balkay backend par bhi use hoti
hai through [Link].

Simple definition jo interview mein bol sakti ho:

“JavaScript ek high-level, dynamically typed scripting/programming language hai jo web


applications mein interactivity, DOM manipulation, API handling aur asynchronous
operations ke liye use hoti hai. Browser ke sath sath [Link] ki wajah se backend
development mein bhi use hoti hai.”

1.2 JavaScript single-threaded hoti hai — iska matlab?

JavaScript single-threaded hoti hai, yani ek waqt mein ek hi kaam main thread par
execute karti hai.

Lekin phir async kaise hota hai?

JavaScript ke paas event loop, callback queue, aur browser/Node ke provided APIs hotay
hain jo async operations handle karte hain.

Example:

Agar hum API call karein ya setTimeout() lagayein, to JavaScript us operation ko


background mein handoff kar deti hai aur apna agla code chala leti hai. Jab async task
complete hota hai, to uska callback/event queue mein aata hai aur event loop usay
execute karwata hai.

Interview line:

“JavaScript single-threaded hai, lekin event loop aur async APIs ki help se non-blocking
behavior achieve karti hai.”
1.3 Variables: var, let, const

var

• Old way of declaring variable

• Function-scoped hota hai

• Re-declare bhi ho sakta hai

• Hoisting hoti hai aur initial value undefined hoti hai

let

• Modern variable declaration

• Block-scoped

• Re-declare same scope mein nahi ho sakta

• Reassign ho sakta hai

• Hoist hota hai but Temporal Dead Zone (TDZ) mein hota hai

const

• Block-scoped

• Reassign nahi ho sakta

• Initialize karna zaroori hota hai

• Agar object/array const ho to uske andar ki values change ho sakti hain, lekin
variable reference reassign nahi hota

Example:

let age = 22;

age = 23; // allowed

const name = "Sehrish";

// name = "Ali"; // not allowed

Interview mein important difference:

• var function scope


• let aur const block scope

• const ko mostly use karte hain jab value/reference reassign nahi karni

• let jab reassign karna ho

• var avoid karna better hota hai in modern JS

1.4 Scope kya hota hai?

Scope ka matlab hai variable kahan accessible hoga.

Types of scope:

1) Global scope

Jo variable function/block ke bahar declare ho, wo generally global hota hai.

2) Function scope

Jo variable function ke andar var se declare ho, wo function ke andar hi accessible hota hai.

3) Block scope

Jo variable {} block ke andar let ya const se declare ho, wo sirf us block ke andar accessible
hota hai.

Example:

function test() {

var a = 10;

let b = 20;

const c = 30;

Yahan a, b, c function ke bahar access nahi hongay.

if (true) {

let x = 5;

const y = 6;

}
Yahan x aur y block ke bahar access nahi hongay.

1.5 Hoisting kya hoti hai?

Hoisting ka matlab yeh nahi ke variable physically upar move ho jata hai. Iska matlab yeh
hai ke execution se pehle memory phase mein declarations register ho jati hain.

var hoisting:

[Link](a); // undefined

var a = 10;

var a hoist hota hai aur initial value undefined milti hai.

let/const hoisting:

let aur const bhi hoist hotay hain, lekin Temporal Dead Zone ki wajah se initialization se
pehle access nahi kar sakte.

[Link](x); // ReferenceError

let x = 5;

1.6 Temporal Dead Zone (TDZ)

TDZ woh phase hota hai jab variable memory mein to hota hai, lekin initialize nahi hua hota,
aur us duration mein usay access karne par error aati hai.

Example:

[Link](a); // ReferenceError

let a = 10;

1.7 Data Types in JavaScript

Primitive data types

1. String

2. Number

3. Boolean
4. Undefined

5. Null

6. BigInt

7. Symbol

Non-primitive / reference types

• Object

• Array

• Function

Important interview difference:

undefined

Jab variable declare ho gaya ho lekin value assign na hui ho.

let a;

[Link](a); // undefined

null

Intentional empty value. Developer ne khud empty assign ki.

let user = null;

NaN

“Not a Number” — jab koi invalid numeric operation ho.

Number("abc"); // NaN

1.8 Primitive vs Reference types

Primitive

Value directly store hoti hai.

Reference

Object/array/function reference ke through memory mein store hotay hain.

Example:
let a = 5;

let b = a;

b = 10;

// a still 5

let obj1 = { name: "Ali" };

let obj2 = obj1;

[Link] = "Ahmed";

// [Link] bhi Ahmed ho jayega

Interview concept:

Primitives copy by value, objects/arrays copy by reference behavior show karte hain.

1.9 Operators

• Arithmetic: + - * / %

• Comparison: ==, ===, !=, !==, >, <

• Logical: &&, ||, !

• Assignment: =, +=, -=

== vs ===

==

Sirf values compare karta hai aur type coercion kar sakta hai.

===

Value + type dono compare karta hai.

5 == "5" // true

5 === "5" // false

Interview line:
“Best practice hai ke mostly strict equality === use ki jaye takay unexpected type coercion
avoid ho.”

1.10 Type Coercion

JavaScript kabhi kabhi automatically ek type ko doosri type mein convert kar deti hai.

"5" + 1 // "51"

"5" - 1 // 4

Interview point:

JavaScript dynamically typed hai, is liye implicit coercion hoti hai. Isi wajah se strict
comparison aur clean validation important hoti hai.

1.11 Functions in JavaScript

Function kya hota hai?

Function reusable block of code hota hai jo specific task perform karta hai.

Function declaration

function greet(name) {

return "Hello " + name;

Function expression

const greet = function(name) {

return "Hello " + name;

};

Arrow function

const greet = (name) => {

return "Hello " + name;

};

Agar single expression ho:


const add = (a, b) => a + b;

1.12 Function declaration vs function expression

Function declaration

• Hoist hoti hai

• Define hone se pehle call kar sakte hain

sayHi();

function sayHi() {

[Link]("Hi");

Function expression

• Variable ki tarah behave karti hai

• Agar const/let se hai to initialization se pehle use nahi kar sakte

sayHi(); // error

const sayHi = function() {

[Link]("Hi");

};

1.13 Arrow functions aur normal functions ka difference

Arrow function:

• Apna this create nahi karti

• Parent scope ka this use karti hai

• Chhoti syntax

Normal function:

• Apna this context hota hai depending on how function is called


Interview mein simple line:

“Arrow functions lexical this use karti hain, is liye React aur callbacks mein kaafi
convenient hoti hain.”

1.14 Arrays

Array ordered collection hoti hai.

const arr = [1, 2, 3];

Common array methods:

• push() → end mein add

• pop() → end se remove

• shift() → start se remove

• unshift() → start mein add

• map() → har item ko transform karta hai

• filter() → condition match karne wale items deta hai

• find() → pehla matching item return karta hai

• forEach() → iterate karta hai

• some() → check if at least one matches

• every() → check if all match

• includes() → existence check

• sort() → sorting

Example:

const nums = [1, 2, 3];

const doubled = [Link](num => num * 2); // [2,4,6]

const even = [Link](num => num % 2 === 0); // [2]

map vs forEach
• map() new array return karta hai

• forEach() sirf iterate karta hai, new array return nahi karta useful way mein

1.15 Objects

Object key-value pairs ka collection hota hai.

const user = {

name: "Sehrish",

age: 22

};

Access:

[Link]

user["age"]

Add/update:

[Link] = "Islamabad";

1.16 Destructuring

Object/array se values nikalne ka clean tareeqa.

const user = { name: "Sehrish", age: 22 };

const { name, age } = user;

const arr = [10, 20];

const [a, b] = arr;

Interview point:

Destructuring React props/state aur backend responses handle karne mein bohat use hoti
hai.
1.17 Spread operator ...

Copy/merge/expand ke liye use hota hai.

const arr1 = [1,2];

const arr2 = [...arr1, 3,4];

const user = { name: "A" };

const updated = { ...user, age: 22 };

1.18 Rest operator

Multiple values ko ek array mein collect karta hai.

function sum(...nums) {

return [Link]((acc, curr) => acc + curr, 0);

1.19 Template literals

Backticks `

const name = "Sehrish";

[Link](`Hello ${name}`);

Readable strings ban jati hain.

1.20 Truthy and Falsy values

Falsy values:

• false

• 0

• ""

• null
• undefined

• NaN

Baaki aksar truthy hoti hain.

1.21 Closures

Closure tab hota hai jab inner function outer function ke variables ko yaad rakhta hai even
after outer function execute ho chuka ho.

function outer() {

let count = 0;

return function inner() {

count++;

return count;

};

const counter = outer();

Interview line:

“Closure ka matlab hai function apne lexical scope ko yaad rakhta hai.”

1.22 Callbacks

Callback ek function hota hai jo kisi dusre function ko argument ke ‫ طور‬par pass kiya jata
hai aur baad mein execute hota hai.

function greet(name, cb) {

[Link]("Hello " + name);

cb();

1.23 Asynchronous JavaScript


Async ka matlab hai ke kuch operations time lete hain, aur JS unka wait karte hue pura
program block nahi karti.

Examples:

• API requests

• File reading

• Database calls

• Timers

1.24 setTimeout

[Link]("A");

setTimeout(() => {

[Link]("B");

}, 0);

[Link]("C");

Output:
A
C
B

Kyunkay setTimeout callback queue mein jata hai, aur synchronous code pehle execute
hota hai.

1.25 Promises

Promise ek object hota hai jo future result represent karta hai.

States:

• pending
• fulfilled

• rejected

Example:

const p = new Promise((resolve, reject) => {

resolve("done");

});

Use:

[Link](res => [Link](res)).catch(err => [Link](err));

1.26 async/await

Promises ko readable banane ka tareeqa.

async function getData() {

try {

const res = await fetch("url");

const data = await [Link]();

[Link](data);

} catch (error) {

[Link](error);

Interview line:

“async/await promise-based asynchronous code ko synchronous style mein readable


banata hai.”

1.27 try/catch

Error handling ke liye.


try {

// risky code

} catch (error) {

[Link]([Link]);

Backend aur frontend dono mein important hai.

1.28 DOM kya hota hai?

DOM = Document Object Model


Browser HTML page ko object tree ki form mein represent karta hai.

Hum kya kar sakte hain?

• elements select

• text change

• styles change

• event listeners add

const btn = [Link]("button");

[Link]("click", () => {

[Link]("clicked");

});

1.29 Event bubbling

Jab event child element par hota hai aur parent tak bubble karta hai.

Example:

button click parent div tak propagate ho sakta hai.

Interview concept:

Kabhi event delegation ke liye useful hota hai.


1.30 Local Storage vs Session Storage

localStorage

• Browser mein data store

• Persist rehta hai until manually removed

sessionStorage

• Tab/session tak limited hota hai

Note:

Sensitive info ‫ جیسے‬passwords store nahi karni chahiye.

1.31 ES6 features jo bohat important hain

• let / const

• arrow functions

• template literals

• destructuring

• spread/rest

• promises

• classes basic idea

• modules (import/export)

• default parameters

1.32 JavaScript interview mein commonly poochay jaane wale sawal

Q: null aur undefined mein difference?

undefined matlab value assign nahi hui.


null intentionally empty value hoti hai.

Q: == aur ===?
== type coercion karta hai, === strict comparison karta hai.

Q: Hoisting kya hoti hai?

Execution se pehle declarations memory phase mein register hoti hain.

Q: Closure kya hota hai?

Function outer scope ki values ko yaad rakhta hai.

Q: Promise kya hai?

Future async result ka representation.

Q: map() aur forEach() mein difference?

map new array return karta hai, forEach mainly iteration ke liye hota hai.

Q: var, let, const difference?

Scope + redeclaration + reassignment + TDZ.

1.33 Interview mein JavaScript ke answers ka style

Agar interviewer pooche “What is closure?” to seedha definition + tiny example do.

Example answer:

“Closure JavaScript ka concept hai jahan inner function apne outer function ke variables ko
access aur remember karta hai, even after outer function execution complete ho jaye. Yeh
data privacy, counters aur factory functions mein useful hota hai.”

2) React Fundamentals

2.1 React kya hai?

React ek JavaScript library hai jo user interfaces build karne ke liye use hoti hai,
especially single-page applications mein.

Simple interview definition:

“React ek component-based frontend library hai jo reusable UI components banane, state


manage karne aur efficiently DOM update karne ke liye use hoti hai.”
2.2 React kyun use karte hain?

• Reusable components

• Better UI structure

• Fast updates through virtual DOM

• State-driven UI

• Large apps manage karna easier hota hai

2.3 Component kya hota hai?

React app chhote chhote reusable pieces mein break hoti hai jinhein components kehte
hain.

Example:

• Navbar

• Button

• Card

• Product list

• Form

Component types:

Functional components

Modern React mein mostly yehi use hotay hain.

function Welcome() {

return <h1>Hello</h1>;

2.4 JSX kya hota hai?

JSX ek syntax hai jo HTML jaisa lagta hai, lekin actually JavaScript ke andar likha jata hai.
const element = <h1>Hello</h1>;

Browser directly JSX nahi samajhta; Babel usay JavaScript mein convert karta hai.

Interview line:

“JSX JavaScript XML-like syntax hai jo React components ka UI readable tareeqay se define
karne mein help karti hai.”

2.5 Props kya hoti hain?

Props parent component se child component ko data pass karne ka tareeqa hoti hain.

function UserCard(props) {

return <h1>{[Link]}</h1>;

Ya destructuring ke sath:

function UserCard({ name }) {

return <h1>{name}</h1>;

Important:

Props read-only hoti hain. Child component directly props modify nahi karta.

2.6 State kya hoti hai?

State component ke andar ka data hota hai jo time ke sath change ho sakta hai aur UI ko
update kar sakta hai.

Example:

• Counter value

• Form input

• Loading state

• API data
2.7 useState hook

import { useState } from "react";

function Counter() {

const [count, setCount] = useState(0);

return (

<button onClick={() => setCount(count + 1)}>

{count}

</button>

);

Samajh:

• count current state value hai

• setCount state update function hai

• state update hone par component re-render hota hai

Interview point:

State ko directly mutate nahi karna, setter function use karna hota hai.

2.8 Props vs State

Props

• Parent se aati hain

• Read-only hoti hain

State

• Component ke andar manage hoti hai

• Change ho sakti hai


• UI ko re-render kar sakti hai

2.9 Event handling in React

React mein event listeners JSX mein lagte hain.

<button onClick={handleClick}>Click</button>

Note:

• camelCase use hota hai onClick

• function reference pass karte hain

2.10 Conditional rendering

UI ko condition ke basis par show/hide karna.

{isLoggedIn ? <Dashboard /> : <Login />}

Ya:

{loading && <p>Loading...</p>}

2.11 List rendering

Array ko UI mein render karna using map().

{[Link](user => (

<li key={[Link]}>{[Link]}</li>

))}

key kyun important hai?

React ko identify karne mein help milti hai ke kaunsa item change hua, add hua ya remove
hua.

Interview line:

“Key React ko efficient reconciliation aur rendering mein help karti hai.”
2.12 useEffect kya hota hai?

useEffect side effects handle karne ke liye use hota hai.

Side effects examples:

• API call

• event listener

• timer

• local storage interaction

import { useEffect, useState } from "react";

useEffect(() => {

fetchData();

}, []);

Dependency array ka role:

[]

Component mount par ek baar chalega

[value]

Jab value change hogi tab effect chalega

no dependency array

Har render par chalega

2.13 React lifecycle ko functional components mein kaise samjhayen?

Class components mein lifecycle methods hoti thin, lekin functional components mein
hum useEffect se mount/update/unmount logic handle kar sakte hain.

Example:

useEffect(() => {

[Link]("mounted");
return () => {

[Link]("cleanup / unmount");

};

}, []);

2.14 Controlled components

Forms mein input value React state se control hoti hai.

const [name, setName] = useState("");

<input

value={name}

onChange={(e) => setName([Link])}

/>

Kyun important?

• Form validation easy

• Single source of truth

• Data handle karna easy

2.15 Lifting state up

Jab do sibling components ko same data chahiye ho, to state unke common parent mein
rakh dete hain.

Interview line:

“State ko nearest common parent tak lift kiya jata hai takay multiple components
synchronized data use kar saken.”

2.16 React mein re-render kab hota hai?


Generally component re-render hota hai jab:

• state change ho

• props change hon

• parent re-render ho

2.17 Virtual DOM kya hota hai?

React actual DOM ko directly har choti change par update nahi karta. Wo ek virtual DOM
representation banata hai, changes compare karta hai, phir efficiently actual DOM update
karta hai.

Interview line:

“Virtual DOM React ko efficient updates mein help karta hai by minimizing direct DOM
manipulation.”

2.18 One-way data flow

React mein data generally parent se child jata hai via props. Is se application predictable
hoti hai.

2.19 Forms handling in React

Basic example:

const [email, setEmail] = useState("");

const handleSubmit = (e) => {

[Link]();

[Link](email);

};

Important:

• [Link]() page reload rokta hai


• input controlled ho sakta hai through state

2.20 API call in React

Usually useEffect ke andar API call karte hain.

useEffect(() => {

const fetchUsers = async () => {

const res = await fetch("/api/users");

const data = await [Link]();

setUsers(data);

};

fetchUsers();

}, []);

Saath mein usually yeh states hoti hain:

• loading

• error

• data

2.21 React Router basic idea

React Router SPA mein pages/navigation handle karta hai without full page reload.

Concepts:

• Routes

• Route path

• Link

• dynamic params

Example conceptually:
• /login

• /dashboard

• /products/:id

2.22 useRef basic idea

useRef DOM element reference ya mutable value store karne ke liye use hota hai without
causing re-render.

Example uses:

• input focus

• previous value track

• timers

2.23 useMemo / useCallback basic high-level idea

Fresh graduate interview mein basic level enough hota hai:

useMemo

Expensive calculation ka memoized result rakhne ke liye

useCallback

Function reference memoize karne ke liye

Interview line:

“In optimization scenarios, unnecessary recalculations ya re-renders reduce karne ke liye


useMemo aur useCallback use kiye ja sakte hain.”

2.24 React mein state update async kyun lagti hai?

React performance optimize karne ke liye updates batch kar sakta hai. Is liye turant
updated value console mein na mile.

2.25 React best practices jo interview mein mention kar sakti ho


• Components ko reusable aur small rakho

• State ko unnecessary deeply nest na karo

• Props clearly pass karo

• API logic ko organized rakho

• Forms controlled rakho jab zarurat ho

• Keys sahi use karo

• Error/loading states handle karo

2.26 React interview questions

Q: React kya hai?

Component-based library for building UI.

Q: Props aur state mein difference?

Props parent se aati hain aur read-only hoti hain; state component ka internal mutable
data hota hai.

Q: useEffect kis liye use hota hai?

Side effects ke liye — API calls, event listeners, timers, subscriptions.

Q: Key ka role kya hai?

List items ko uniquely identify karna for efficient rendering.

Q: Controlled component kya hota hai?

Jahan input value React state se control ho.

Q: Virtual DOM kya hai?

Actual DOM ka lightweight representation jo efficient updates enable karti hai.

2.27 Interview mein React ka answer kaise dena hai?

Agar poochain: “How have you used React in your project?”

Sample answer:
“Maine React ko reusable components banane, forms handle karne, API data fetch karne
aur state manage karne ke liye use kiya. Apne project mein maine pages ko components
mein break kiya, useState aur useEffect use kiye, forms ko controlled inputs se manage
kiya, aur backend APIs se data fetch karke UI render ki.”

3) Node / Express / Backend Fundamentals

3.1 Backend kya hota hai?

Backend application ka wo hissa hota hai jo server side par run karta hai aur handle karta
hai:

• business logic

• database operations

• authentication

• APIs

• data validation

• server responses

Simple interview definition:

“Backend user se aane wali requests ko process karta hai, business logic apply karta hai,
database ke sath interact karta hai aur appropriate response return karta hai.”

3.2 [Link] kya hai?

[Link] JavaScript runtime environment hai jo JavaScript ko browser ke bahar, especially


server side par run karne deta hai.

Interview line:

“[Link] Chrome V8 engine par based JavaScript runtime hai jo event-driven, non-blocking
I/O model ki wajah se scalable backend applications banane mein help karta hai.”

3.3 [Link] kyun use karte hain?


• JavaScript frontend + backend dono mein use ho sakti hai

• Fast development

• Non-blocking I/O

• APIs banane ke liye popular

• Large npm ecosystem

3.4 [Link] kya hai?

Express [Link] ka lightweight web framework hai jo server banana, routes define karna,
middleware use karna aur APIs develop karna easy banata hai.

Interview line:

“[Link] [Link] ke upar ek minimal framework hai jo routing, middleware aur request-
response handling ko simple banata hai.”

3.5 Server kya hota hai?

Server ek system/application hota hai jo client ki requests ko receive karta hai aur response
bhejta hai.

Client examples:

• Browser

• mobile app

• frontend React app

3.6 Request aur Response

Request

Client ki ‫ طرف‬se server ko bheja gaya data/action

Response

Server ki ‫ طرف‬se client ko wapas bheja gaya result/data/status

Example:
Frontend /api/users hit kare → server users ka data response mein bhej de.

3.7 HTTP methods

GET

Data fetch karna

POST

Naya data create karna

PUT / PATCH

Data update karna

• PUT often full update

• PATCH partial update

DELETE

Data remove karna

Interview point:

REST APIs mein in methods ka proper use important hota hai.

3.8 REST API kya hoti hai?

REST API ek structured way hai jisme frontend aur backend HTTP requests ke through
communicate karte hain.

Example endpoints:

• GET /users

• GET /users/:id

• POST /users

• PUT /users/:id

• DELETE /users/:id

Interview line:
“RESTful API resources ko endpoints ke through expose karti hai aur standard HTTP
methods use karti hai.”

3.9 Basic Express server

const express = require("express");

const app = express();

[Link]("/", (req, res) => {

[Link]("Server is running");

});

[Link](5000, () => {

[Link]("Server running on port 5000");

});

Samajh:

• express() app banata hai

• [Link]() route define karta hai

• req request object

• res response object

• listen() server start karta hai

3.10 Middleware kya hota hai?

Middleware wo function hota hai jo request aur response ke beech execute hota hai.

Common uses:

• request body parse karna

• authentication check
• logging

• error handling

Example:

[Link]([Link]());

Yeh incoming JSON body parse karta hai.

3.11 [Link]() kya karta hai?

Request body mein agar JSON data aa raha ho to usay parse karke [Link] mein available
karta hai.

3.12 Routing

Routes define karte hain ke kis URL aur method par kya logic chalega.

[Link]("/users", getUsers);

[Link]("/users", createUser);

Better structure:

Routes alag file mein rakhte hain, controllers alag.

3.13 MVC pattern

MERN/backend interviews mein bohat useful concept.

Model

Database structure / schema / data layer

View

Traditional apps mein UI layer hoti hai; MERN API backend mein kabhi kabhi direct use nahi
hoti as frontend separate hota hai

Controller

Request handle karta hai, logic chalata hai, response bhejta hai

Interview line:
“MVC se code modular aur maintainable hota hai kyun ke concerns separate ho jate hain.”

3.14 Controllers kya hotay hain?

Controllers route hit hone par actual business logic handle karte hain.

Example:

const getUsers = async (req, res) => {

const users = await [Link]();

[Link](users);

};

3.15 Database se backend ka relation

Backend database se:

• data fetch karta hai

• insert karta hai

• update/delete karta hai

• validation aur business logic apply karta hai

Tum MERN background ke hisaab se MongoDB mention kar sakti ho, aur agar SQL poocha
jaye to MySQL/PostgreSQL ka basic idea bata sakti ho.

3.16 MongoDB basic idea

MongoDB ek NoSQL document database hai jahan data JSON-like documents ki form mein
store hota hai.

Terms:

• database

• collection

• document

Example document:
{

"name": "Sehrish",

"email": "abc@[Link]"

3.17 Mongoose kya hai?

Mongoose MongoDB ke sath kaam karne ke liye ODM (Object Data Modeling) library hai
[Link] mein.

Is se kya hota hai?

• schema define kar sakte ho

• validation

• querying easier hoti hai

• models ban jate hain

Example:

const userSchema = new [Link]({

name: String,

email: String

});

3.18 CRUD operations

CRUD = Create, Read, Update, Delete

Example mapping:

• Create user → POST

• Get users → GET

• Update user → PUT/PATCH

• Delete user → DELETE


3.19 [Link], [Link], [Link]

[Link]

Route params

GET /users/:id

[Link]

[Link]

URL query parameters

/users?page=1

[Link]

[Link]

Client se body mein bheja gaya data

POST /users

[Link]

Interview mein yeh bohat poocha ja sakta hai.

3.20 Status codes

200

OK

201

Created

400

Bad Request

401

Unauthorized

403
Forbidden

404

Not Found

500

Internal Server Error

Interview line:

“Proper HTTP status codes dena important hota hai takay frontend ko clear response state
mil sake.”

3.21 Error handling in backend

Agar server/db/API mein issue ho to proper try/catch aur status code ke sath error response
dena chahiye.

try {

const users = await [Link]();

[Link](200).json(users);

} catch (error) {

[Link](500).json({ message: "Server error" });

3.22 Async/await in backend

Database calls aur APIs async hoti hain, is liye async/await commonly use hota hai.

[Link]("/users", async (req, res) => {

try {

const users = await [Link]();

[Link](users);

} catch (err) {

[Link](500).json({ message: [Link] });


}

});

3.23 Authentication vs Authorization

Authentication

User kaun hai?


Example: login, verify credentials

Authorization

User kya kar sakta hai?


Example: admin delete kar sakta hai ya nahi

Interview line:

“Authentication identity verify karti hai, jab ke authorization permissions determine karti
hai.”

3.24 JWT basic idea

JWT = JSON Web Token


Login ke baad user ko token mil sakta hai jo future requests mein bheja jata hai for
protected routes.

Flow:

1. User login karta hai

2. Server credentials verify karta hai

3. JWT generate hota hai

4. Client token store karta hai

5. Protected route hit karte waqt token bhejta hai

6. Server token verify karta hai

3.25 Password hashing


Passwords plain text mein database mein save nahi karne chahiye. Usually hash ki jati hain
using bcrypt.

Interview point:

“Security ke liye passwords ko hash karke store karna best practice hai.”

3.26 Protected routes

Aise routes jo sirf authenticated user access kar sake.

Example:

• profile

• dashboard data

• admin actions

Usually middleware token verify karta hai.

3.27 CORS kya hota hai?

Cross-Origin Resource Sharing.


Jab frontend aur backend different origins par hon, to browser restrictions handle karne ke
liye CORS config karna parta hai.

Example:

React app localhost:3000


Backend localhost:5000
In ke beech communication ke liye CORS ki zarurat ho sakti hai.

3.28 Environment variables

Sensitive ya configurable values .env mein rakhte hain:

• PORT

• DB URL

• JWT secret
Kyun?

Security aur flexibility.

3.29 Postman kya hai?

Postman API testing tool hai.

Use cases:

• GET/POST request test karna

• request body bhejna

• headers test karna

• response dekhna

• auth token test karna

Interview line:

“Maine backend APIs ko Postman se test kiya, including CRUD endpoints aur auth routes.”

3.30 API testing ke dauran kya check karte hain?

• correct response data

• correct status code

• validation errors

• auth behavior

• edge cases

• wrong/missing fields

• invalid IDs

3.31 Validation kya hoti hai?

Incoming data ko check karna ke wo sahi format mein hai ya nahi.

Example:
• email required hai?

• password minimum length?

• duplicate user to nahi?

• required fields missing to nahi?

Interview point:

Validation frontend aur backend dono par honi chahiye, lekin backend validation zaroori
hai kyun ke frontend bypass ho sakta hai.

3.32 Pagination basic idea

Agar bohat zyada records hon to sab ek sath bhejne ke bajaye chunks mein bhejte hain.

Example:

/users?page=1&limit=10

3.33 Search/filter basic idea

Query params ke through filters lag sakte hain:

• category

• status

• date

• keyword

3.34 Project structure (Express app) ka clean idea

Ek organized backend structure kuch aisa ho sakta hai:

• [Link] / [Link]

• routes/

• controllers/

• models/
• middlewares/

• config/

• utils/

Benefit:

Readable, scalable, maintainable

3.35 Backend security basics jo fresh graduate ko pata honi chahiye

• passwords hash karna

• sensitive keys .env mein rakhna

• input validate karna

• proper auth use karna

• raw trust on client input avoid karna

• proper error handling

3.36 Node event-driven/non-blocking ka simple idea

[Link] I/O tasks ko efficient tareeqay se handle karta hai without har request par thread
block kiye. Is liye concurrent requests handle karne mein useful hota hai.

Fresh interview mein is concept ko high-level samajhna enough hota hai.

3.37 Common backend interview questions

Q: [Link] kya hai?

JavaScript runtime for server-side development.

Q: Express kya hai?

[Link] framework for building web servers and APIs.

Q: Middleware kya hota hai?

Function that runs during request-response cycle for tasks like parsing, auth, logging, error
handling.
Q: REST API kya hoti hai?

HTTP-based API design jahan resources endpoints aur methods ke through expose hotay
hain.

Q: [Link], [Link], [Link] difference?

• params = route values

• query = URL query params

• body = request payload

Q: Authentication aur authorization mein difference?

Authentication = who are you


Authorization = what can you access

Q: JWT kyun use hota hai?

Authenticated user ko token-based access dene ke liye.

Q: MongoDB aur SQL mein broad difference?

MongoDB document-based NoSQL hai; SQL relational tables use karta hai.

3.38 Interview mein apne project ko backend angle se kaise explain karna hai

Agar tumse poocha jaye:


“Apne final year project / FoodBridge ka backend explain karo.”

To structure yeh rakho:

1) Problem statement

“Project ka goal food donation aur distribution process ko manage karna tha.”

2) Tech stack

“Backend mein maine [Link], [Link] aur MongoDB/Mongoose use kiya.”

3) Backend responsibilities

• user authentication

• donor/receiver/admin related APIs

• data store/fetch/update
• form submissions handle karna

• request validation

• protected routes

• dashboard data

4) API examples

• user registration/login

• create donation request

• fetch available donations

• update status

• manage users or records

5) Security / structure

• JWT based auth (agar use kiya)

• password hashing (agar use ki)

• MVC ya modular route/controller structure

• Postman testing

Sample answer:

“Maine backend mein Express ke through REST APIs banayi jo user registration, login,
donation record management aur data retrieval handle karti thin. MongoDB ko database ke
‫ طور‬par use kiya aur Mongoose ke through schemas/models define kiye. API testing ke liye
Postman use kiya, aur jahan zarurat thi wahan validation aur authentication logic
implement ki.”

4) Full Stack Connection Samajhna – Frontend aur Backend ka flow

Aksar interview mein poochte hain:


“React frontend backend se kaise communicate karta hai?”

Answer structure:

1. React frontend user se input leta hai


2. API request bhejta hai using fetch ya axios

3. Backend Express route request receive karta hai

4. Controller logic chalti hai

5. Database se data fetch/store hota hai

6. Backend JSON response return karta hai

7. Frontend state update karta hai aur UI render hoti hai

Example answer:

“React frontend forms ya user actions ke through API requests send karta hai. Express
backend un requests ko routes/controllers ke through process karta hai, database se data
fetch ya update karta hai, aur phir JSON response return karta hai. Frontend us response ko
state mein store karke UI update karta hai.”

5) Interview ke liye Bohat Important Practical Questions

5.1 “Apna introduction dein”

Ek technical fresher intro kuch is tarah ho sakta hai:

“Assalamualaikum, mera naam Sehrish Siddique hai. Maine Quaid-e-Azam University se


Computer Science ki degree complete ki hai / kar rahi hoon. Mera main focus software
engineering aur full-stack web development par raha hai. Maine JavaScript, [Link],
[Link], [Link] aur MongoDB ke sath academic aur personal projects build kiye hain.
Apne final year project mein maine real-world problem ko address karne ke liye full-stack
application par kaam kiya. Ab main Associate Software Engineer ke role mein apni
fundamentals aur practical development skills ko industry level par apply karna chahti
hoon, aur sath hi seekhna aur grow karna chahti hoon.”

5.2 “JavaScript mein kitni comfort hai?”

“JavaScript meri core language rahi hai for web development. Mujhe variables, scopes,
functions, arrays/objects, promises, async/await, DOM basics aur ES6 concepts ka
practical understanding hai. React ke through maine frontend development aur
Node/Express ke through backend APIs par bhi kaam kiya hai.”
5.3 “React mein kya kya use kiya?”

“Maine React mein reusable components banaye, useState aur useEffect use kiya, forms
ko controlled inputs ke sath handle kiya, API data fetch kiya aur components ke through UI
structure ki. List rendering, conditional rendering aur props/state flow par bhi kaam kiya.”

5.4 “Backend mein kya experience hai?”

“Maine [Link] aur [Link] ke sath REST APIs banayi hain, MongoDB ke sath data
models aur CRUD operations handle kiye hain, Postman se APIs test ki hain, aur project
structure ko routes/controllers/models mein organize karne ki practice ki hai. Mujhe
request-response cycle, middleware, auth basics aur error handling ka understanding hai.”

5.5 “Agar koi cheez na aaye to kya karein?”

Interview mein agar answer 100% yaad na ho to ghabrana nahi.

Smart response style:

“I’m not fully sure about the exact low-level detail, but my understanding is that…”
ya
“I haven’t implemented that deeply yet, but from my understanding…”

Yeh better hota hai banisbat ghalat confident answer dene ke.

6) Rapid Revision Sheet

JavaScript quick revision

• JS single-threaded hai

• var function scope, let/const block scope

• hoisting + TDZ

• primitive vs reference types

• == vs ===

• functions, arrow functions

• arrays: map/filter/forEach
• objects, destructuring, spread

• callbacks, promises, async/await

• DOM basics

• event loop basic idea

React quick revision

• React = component-based UI library

• JSX

• components

• props vs state

• useState

• useEffect

• list rendering + keys

• controlled forms

• conditional rendering

• virtual DOM

• API calls

• one-way data flow

Node/Express/backend quick revision

• [Link] runtime

• Express framework

• server, request, response

• REST APIs

• GET/POST/PUT/DELETE

• middleware

• [Link], [Link], [Link]

• MongoDB + Mongoose basics


• CRUD

• auth vs authorization

• JWT basics

• status codes

• error handling

• Postman testing

7) Sab se important advice for interview

Sirf definitions ratna kaafi nahi hota. Har topic ke liye yeh 3 cheezein tayyar rakho:

1) Definition

Topic kya hai?

2) Simple example

Chhota example ya use case

3) Project relation

“Maine isay apne project mein kahan use kiya?”

Agar tum har concept ko definition + example + project usage ke format mein prepare kar
lo, to tumhare answers bohat zyada natural aur strong lagenge.

8) Final preparation strategy

Day 1:

JavaScript fundamentals revise + 15 common JS questions

Day 2:

React fundamentals + hooks + forms + API flow

Day 3:

Node/Express + REST APIs + middleware + MongoDB basics

Day 4:
Apna project prepare karo in detail:

• project intro

• features

• tech stack

• frontend flow

• backend flow

• challenges

• kya seekha

Day 5:

Mock interview:

• intro

• strengths

• project explanation

• JS/React/Node questions

• why should we hire you

9) Golden Rule for Fresh Graduate Interview

Interviewer perfect expert answer expect nahi karta. Wo yeh dekhna chahta hai:

• fundamentals clear hain?

• logically soch sakti ho?

• project ka kaam samajhti ho?

• seekhne ka attitude hai?

• communication clear hai?

Is liye tumhara focus hona chahiye:


clear concepts + honest answers + project understanding + confidence

You might also like