๐ฅ Web Development Interview Questions with Sample Answers โ Part 3
๐ง 21) What is the difference between authentication and authorization?
๐ Answer: โAuthentication verifies who the user is (login). Authorization checks what the user is allowed to do (permissions). Example: Login = authentication, Access admin panel = authorization.โ
โก 22) What happens if you donโt use keys in React lists?
๐ Answer: โReact cannot efficiently track elements, leading to incorrect UI updates and performance issues. Keys help React identify which items changed.โ
๐ 23) What is the difference between useEffect with and without dependency array?
๐ Answer: โNo dependency array โ runs on every render, Empty array [] โ runs once (on mount), With dependencies โ runs when values changeโ
๐ฆ 24) Why should you not mutate state directly in React?
๐ Answer: โReact relies on state changes to detect updates. Direct mutation does not trigger re-render. We should create a new copy using spread operator.โ
๐ 25) What is the risk of storing JWT in localStorage?
๐ Answer: โIt is vulnerable to XSS attacks. If attacker accesses JS, they can steal token. Safer approach is HttpOnly cookies.โ
๐ 26) What is the difference between client-side and server-side rendering?
๐ Answer: โClient-side rendering โ UI rendered in browser (React), Server-side rendering โ UI rendered on server before sending to client, SSR improves SEO and initial load speed.โ
๐๏ธ 27) What are indexes in MongoDB and why are they important?
๐ Answer: โIndexes improve query performance by allowing faster data retrieval instead of scanning entire collection.โ
โ๏ธ 28) What is event loop in Node.js?
๐ Answer: โEvent loop handles asynchronous operations. It allows Node.js to process multiple requests without blocking.โ
๐ 29) What is difference between PUT and PATCH?
๐ Answer: โPUT replaces entire resource, PATCH updates only specific fieldsโ
๐ 30) How would you scale your application if users increase?
๐ Answer:
I would use:
โข Load balancing
โข Database indexing
โข Caching (Redis)
โข Microservices architecture
โข CDN for static assets
๐ฏ Bonus Tip
If stuck, always say: ๐ โHereโs how I would approach solving thisโฆโ Interviewers value thinking process more than perfect answers.
Double Tap โค๏ธ For More
Post #3622
5.98K
- โค 10
- ๐ 1