0% found this document useful (0 votes)
4 views8 pages

Interview Question

The document contains a comprehensive set of questions and answers covering various web development topics, including Core Web technologies (HTML, CSS, JS), React.js, Node.js, databases, TypeScript, Redux, authentication, and system design. Each section provides essential concepts, definitions, and differences relevant to developers. It serves as a study guide for understanding key principles and practices in modern web development.

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)
4 views8 pages

Interview Question

The document contains a comprehensive set of questions and answers covering various web development topics, including Core Web technologies (HTML, CSS, JS), React.js, Node.js, databases, TypeScript, Redux, authentication, and system design. Each section provides essential concepts, definitions, and differences relevant to developers. It serves as a study guide for understanding key principles and practices in modern web development.

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

🔹 Section 1: Core Web (HTML, CSS, JS) – 15 Qs

1. What are semantic HTML tags?


👉 Tags like <header>, <main>, <footer>, <article> that describe content meaningfully.

2. Difference between inline, inline-block, and block elements?


👉 Inline: no line break (<span>), Block: takes full width (<div>), Inline-block: behaves like
inline but allows width/height.

3. What are pseudo-classes in CSS?


👉 Special states of elements (e.g., :hover, :focus, :nth-child).

4. Difference between == and === in JS?


👉 == checks value with type coercion, === checks value + type (strict equality).

5. What is event delegation in JavaScript?


👉 Attaching an event listener to a parent instead of multiple children (uses event bubbling).

6. What is the difference between var, let, and const?


👉 var is function-scoped, let and const are block-scoped, const cannot be reassigned.

7. What is a closure?
👉 A function that remembers variables from its lexical scope even after that scope has finished
executing.

8. Difference between synchronous and asynchronous JavaScript?


👉 Sync executes line by line, async allows tasks (like fetch, setTimeout) to run without
blocking.

9. What are promises?


👉 Objects representing the eventual completion/failure of an async operation (pending →
fulfilled/rejected).

10. Explain async/await.


👉 Syntax sugar over promises, makes async code look synchronous.

11. What are arrow functions, and when not to use them?
👉 Shorter syntax, they don’t bind their own this, so not good for object methods.

12. What is localStorage vs sessionStorage vs cookies?


👉 localStorage: permanent until cleared, sessionStorage: cleared on tab close, cookies: small
data sent with HTTP requests.
13. What is hoisting in JavaScript?
👉 Variables (var) and function declarations are moved to the top during compilation.

14. What is the DOM?


👉 Document Object Model: tree structure of HTML elements.

15. What is debouncing and throttling?


👉 Debounce: delays execution until user stops (e.g., search input). Throttle: executes at fixed
intervals.

🔹 Section 2: [Link] + [Link] – 20 Qs


16. What is the virtual DOM?
👉 A lightweight copy of the DOM that React uses to optimize rendering.

17. What are React hooks?


👉 Functions (useState, useEffect, useMemo) that allow using state and lifecycle in functional
components.

18. Difference between functional and class components?


👉 Class: use lifecycle methods, this; Functional: hooks, simpler syntax, better performance.

19. Explain useEffect.


👉 Runs side effects (fetch, subscriptions). Runs on mount/update depending on dependency
array.

20. What is useMemo vs useCallback?


👉 useMemo: memoizes values, useCallback: memoizes functions.

21. What is prop drilling, and how to avoid it?


👉 Passing props through multiple levels unnecessarily. Avoid with Context API/Redux.

22. Controlled vs uncontrolled components?


👉 Controlled: state handled by React (value with setState), Uncontrolled: uses ref.

23. What is reconciliation in React?


👉 The process React uses to diff the virtual DOM and update only changed parts.

24. What is server-side rendering (SSR)?


👉 Rendering React pages on server before sending HTML to client ([Link] supports it).
25. Difference between SSR, SSG, and CSR in [Link]?
👉 SSR: rendered on server request, SSG: built at compile time, CSR: rendered in browser.

26. What is getServerSideProps?


👉 [Link] function for SSR that fetches data on each request.

27. What is getStaticProps vs getStaticPaths?


👉 Used for SSG, getStaticProps: fetch data at build, getStaticPaths: dynamic routes.

28. Difference between API routes in [Link] and [Link] backend?


👉 [Link] API routes are built-in serverless functions, Express gives full control.

29. What is hydration in [Link]?


👉 Process of attaching React event handlers to SSR HTML after page load.

30. What is dynamic import in [Link]?


👉 Lazy-loading components only when needed.

31. What are React keys, and why are they important?
👉 Unique identifiers for list items, help React track element changes.

32. What is suspense in React?


👉 Lets components wait for async data or code before rendering fallback.

33. What is context API?


👉 Provides global state without prop drilling.

34. How do you optimize React app performance?


👉 Memoization, lazy loading, code splitting, avoiding unnecessary re-renders.

35. What are React fragments?


👉 <></> used to group children without adding extra DOM nodes.

🔹 Section 3: [Link] + [Link] – 15 Qs


36. What is [Link]?
👉 JavaScript runtime built on Chrome V8 engine, used for server-side apps.

37. What is [Link]?


👉 A minimal framework for [Link] that helps build REST APIs.
38. What is middleware in [Link]?
👉 Functions that process requests before reaching the route handler.

39. What are streams in [Link]?


👉 Objects that handle continuous data flow (read/write).

40. Difference between CommonJS and ES modules?


👉 CommonJS uses require, ES modules use import/export.

41. How do you handle errors in [Link]?


👉 Use next(err) with error-handling middleware.

42. What is CORS, and how do you enable it in Express?


👉 Cross-Origin Resource Sharing; enable with cors middleware.

43. What is clustering in [Link]?


👉 Running multiple worker processes to utilize multi-core CPUs.

44. How do you secure Express apps?


👉 [Link], rate limiting, sanitizing input, HTTPS.

45. Difference between [Link]() and [Link]()?


👉 [Link]() sends text/html/data, [Link]() automatically converts to JSON.

46. What is JWT, and how is it used in authentication?


👉 JSON Web Token: signed token for verifying user identity.

47. What is the event loop in [Link]?


👉 Mechanism that handles async callbacks (non-blocking I/O).

48. Difference between [Link]() and setImmediate()?


👉 nextTick: runs immediately after current phase, setImmediate: runs in next iteration.

49. What is rate limiting in APIs?


👉 Restricting request frequency to prevent abuse.

50. Difference between synchronous and asynchronous file reading in [Link]?


👉 Sync blocks execution, async uses callbacks/promises.

🔹 Section 4: Databases (MongoDB + PostgreSQL) – 20 Qs


51. Difference between SQL and NoSQL?
👉 SQL: structured, relational, schema-based (Postgres). NoSQL: flexible, document-based
(MongoDB).

52. What is a schema in MongoDB?


👉 Defines structure of documents in a collection (via Mongoose).

53. What is indexing in databases?


👉 Speeds up queries by storing references for quick lookup.

54. What is normalization in PostgreSQL?


👉 Process of reducing redundancy and improving consistency in relational tables.

55. Difference between INNER JOIN, LEFT JOIN, RIGHT JOIN?


👉 INNER: common records, LEFT: all left + matches, RIGHT: all right + matches.

56. What are transactions in PostgreSQL?


👉 Group of queries executed as one unit, either all succeed or all fail.

57. What is ACID in databases?


👉 Atomicity, Consistency, Isolation, Durability → ensures reliable transactions.

58. Difference between DELETE, TRUNCATE, DROP?


👉 DELETE: removes rows, TRUNCATE: clears table but keeps schema, DROP: removes table.

59. Primary key vs foreign key?


👉 Primary: unique identifier, Foreign: references primary key of another table.

60. What are MongoDB aggregations?


👉 Advanced queries for grouping, filtering, transforming data.

61. What is $lookup in MongoDB?


👉 Joins collections like SQL JOIN.

62. How do you create indexes in PostgreSQL?


👉 CREATE INDEX idx_name ON table(column);

63. What is a composite key?


👉 A primary key made of multiple columns.

64. What are triggers in PostgreSQL?


👉 Automatic execution of functions when events (INSERT/UPDATE) occur.
65. What is sharding in MongoDB?
👉 Splitting data across multiple servers for scaling.

66. Difference between clustered and non-clustered index?


👉 Clustered: rearranges table data, Non-clustered: separate structure pointing to data.

67. What is ON DELETE CASCADE in PostgreSQL?


👉 Automatically deletes child rows when parent is deleted.

68. What is a document in MongoDB?


👉 JSON-like object stored in collections.

69. How do you connect [Link] with PostgreSQL?


👉 Using pg library with connection string.

70. How do you handle schema migrations?


👉 Use tools like Prisma, Sequelize, or raw migration scripts.

🔹 Section 5: TypeScript – 10 Qs
71. What is TypeScript?
👉 A superset of JavaScript that adds static typing.

72. Difference between interface and type?


👉 Interface: extendable, Type: unions, more flexible.

73. What are generics in TypeScript?


👉 Allow functions/types to work with multiple types.

74. Difference between any, unknown, never?


👉 any: no type check, unknown: must check before use, never: function never returns.

75. What is type inference?


👉 TypeScript automatically detects types when not explicitly declared.

76. Difference between readonly and const?


👉 readonly: applies to properties in objects, const: variable binding.

77. What are utility types in TypeScript?


👉 Built-in helpers like Partial<T>, Pick<T>, Omit<T>.
78. What is declaration merging?
👉 Interfaces with the same name automatically merge.

79. What is enum in TypeScript?


👉 Defines a set of named constants.

80. How does TypeScript help in large projects?


👉 Prevents runtime errors, improves maintainability, enables better tooling/autocomplete.

🔹 Section 6: Redux & State Management – 5 Qs


81. What is Redux?
👉 A predictable state container for managing app state.

82. What are the core principles of Redux?


👉 Single source of truth, state is read-only, changes via pure functions (reducers).

83. What are actions and reducers?


👉 Actions: objects with type/payload. Reducers: pure functions updating state.

84. What is middleware in Redux?


👉 Intercepts actions before reducers (e.g., Redux Thunk).

85. Difference between Redux Thunk and Redux Saga?


👉 Thunk: functions returning actions for async calls. Saga: uses generators for complex async
logic.

🔹 Section 7: Authentication & Security – 10 Qs


86. What is OAuth2?
👉 Standard for delegated authorization (Google login, Facebook login).

87. What is CSRF vs XSS?


👉 CSRF: tricking authenticated users into unwanted actions. XSS: injecting malicious scripts.

88. How do you prevent SQL injection?


👉 Use parameterized queries, ORMs.
89. How do you hash passwords in [Link]?
👉 Use bcrypt or argon2.

90. What is HTTPS, and why is it important?


👉 Encrypted HTTP for secure communication.

91. What is JWT expiration and refresh token?


👉 Expiration: token validity time. Refresh token: used to get new access token.

92. What is rate limiting, and how to implement?


👉 Restrict API requests, use express-rate-limit.

93. What is [Link]?


👉 Middleware for securing HTTP headers.

94. What is CORS?


👉 Cross-Origin Resource Sharing; restricts requests from other domains.

95. What is session vs token-based authentication?


👉 Session: stored on server, Token: stored client-side (stateless).

🔹 Section 8: System Design & Best Practices – 5 Qs


96. What is load balancing?
👉 Distributing traffic across multiple servers.

97. What is caching, and why use it?


👉 Temporarily storing data for faster responses (Redis, CDN).

98. Difference between monolithic and microservices architecture?


👉 Monolithic: single app, Microservices: small independent services.

99. What are design patterns in software development?


👉 Reusable solutions (Singleton, Factory, Observer).

100. How do you scale a [Link] app?


👉 Horizontal scaling (clustering, load balancing), caching, DB optimization.

You might also like