0% found this document useful (0 votes)
5 views5 pages

Interview Question 3

The document outlines key concepts in JavaScript, React, Node.js, and databases, including differences between variable declarations (var, let, const), closures, event delegation, and promises. It also covers React components, server-side rendering, middleware in Express.js, and database principles like SQL vs NoSQL and ACID properties. Additionally, it discusses performance optimization techniques and security measures in web applications.

Uploaded by

tamp.xyz
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)
5 views5 pages

Interview Question 3

The document outlines key concepts in JavaScript, React, Node.js, and databases, including differences between variable declarations (var, let, const), closures, event delegation, and promises. It also covers React components, server-side rendering, middleware in Express.js, and database principles like SQL vs NoSQL and ACID properties. Additionally, it discusses performance optimization techniques and security measures in web applications.

Uploaded by

tamp.xyz
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

1.

Difference between var, let, and const

 var: function-scoped, hoisted, can be redeclared.


 let: block-scoped, cannot redeclare in same scope, can update.
 const: block-scoped, cannot update/redeclare.

2. What is a closure?

 Function that retains access to variables from its outer scope even after outer function
executes.
 Use: private variables, callbacks, memoization.

3. Synchronous vs Asynchronous JS

 Sync: executes line by line.


 Async: allows non-blocking operations (fetch, setTimeout).

4. Event delegation

 Attach event listener to parent; handle events via event bubbling. Efficient for dynamic
content.

5. What are promises?

 Object representing future completion/failure of async operations. States: pending →


fulfilled/rejected.

6. Async/Await

 Syntactic sugar over promises; makes async code appear synchronous.

7. Difference between == and ===

 ==: value equality with type coercion.


 ===: strict equality, checks type + value.

8. What is the DOM?

 Document Object Model; tree structure of HTML elements for JS manipulation.

9. Debouncing vs Throttling

 Debounce: waits for pause before executing.


 Throttle: executes at regular intervals.

10. LocalStorage vs SessionStorage vs Cookies


 LocalStorage: persists until cleared.
 SessionStorage: cleared on tab close.
 Cookies: small data sent with HTTP requests.

🔹 React + [Link]
11. React Hooks

 useState: state management.


 useEffect: side effects.
 useMemo/useCallback: performance optimization.

12. Functional vs Class components

 Functional: simpler, uses hooks.


 Class: lifecycle methods, this.

13. SSR vs SSG vs CSR

 CSR: client-side, slower first load.


 SSR: server-side, fast SEO-friendly.
 SSG: build-time static pages, very fast.

14. Prop drilling & solutions

 Passing props through multiple levels unnecessarily.


 Use Context API or Redux.

15. React reconciliation

 Virtual DOM diffing; updates only changed nodes in real DOM.

16. getServerSideProps vs getStaticProps ([Link])

 SSR: fetches data on each request.


 SSG: fetches data at build time.

17. Dynamic routing in [Link]

 [param].js files for dynamic routes; getStaticPaths generates paths at build time.

18. React key prop


 Unique identifier for lists to optimize DOM updates.

19. Controlled vs Uncontrolled components

 Controlled: React manages state via value + onChange.


 Uncontrolled: uses ref to access DOM value.

20. React Suspense

 Waits for async data/code to load before rendering fallback UI.

🔹 [Link] + [Link]
21. Middleware in [Link]

 Functions in request-response cycle; can modify req/res or end requests.

22. Event loop in [Link]

 Non-blocking I/O mechanism; executes async callbacks.

23. Error handling in Express

 Use next(err) + error-handling middleware.

24. JWT Authentication

 Server issues signed token → client stores → sends with requests → server verifies.

25. Clustering in [Link]

 Run multiple worker processes to utilize multi-core CPU.

26. CORS

 Cross-Origin Resource Sharing; allows/restricts requests from other domains.

27. Rate limiting

 Prevents abuse by limiting API requests; use express-rate-limit.

28. [Link]
 Sets HTTP headers for security (XSS, MIME sniffing, etc.).

29. Difference between [Link]() and [Link]()

 [Link](): sends any type; [Link](): converts object to JSON.

30. Async file reading

 [Link]: blocking; [Link]: non-blocking with callback/promise.

🔹 Databases (MongoDB + PostgreSQL)


31. SQL vs NoSQL

 SQL: relational, structured, schema-based.


 NoSQL: flexible, document/graph/key-value-based.

32. Indexing

 Improves query performance; tradeoff: slower writes, more storage.

33. ACID properties

 Atomicity, Consistency, Isolation, Durability. Ensures reliable transactions.

34. Aggregation in MongoDB

 Filter, group, transform data. $match, $group, $project.

35. Primary vs Foreign key

 Primary: unique identifier.


 Foreign: references primary key in another table.

36. Normalization in SQL

 Reduces redundancy, ensures consistency, improves maintainability.

37. Transactions in PostgreSQL

 Group queries as a single unit; all succeed or all fail.

38. Sharding in MongoDB


 Distribute data across multiple servers for scalability.

39. ON DELETE CASCADE (PostgreSQL)

 Automatically deletes child rows when parent is deleted.

40. Connecting [Link] to PostgreSQL

 Use pg library with connection string; supports queries and prepared statements.

You might also like