1739514073839
1739514073839
https://www.engrsakib.com/
REACT
• PERFORMANCE OPTIMIZATION
• HOOKS AND ADVANCED STATE MANAGEMENT
• ROUTING AND NAVIGATION
• STYLING AND ANIMATION
• STATE MANAGEMENT (REDUX, ZUSTAND, RECOIL)
• ADVANCED CONCEPTS
MONGODB
• SCHEMA DESIGN AND DATA MODELING
• INDEXES AND QUERY OPTIMIZATION
• REPLICATION AND SHARDING
• SECURITY AND ACCESS CONTROL
• AGGREGATION AND ADVANCED QUERYING
NODE
• CORE CONCEPTS AND ARCHITECTURE
• MODULES AND PACKAGE MANAGEMENT
• SECURITY AND ERROR HANDLING
• NETWORKING AND APIS
• PERFORMANCE OPTIMIZATION AND DEBUGGING
https://www.engrsakib.com/
EXPRESS
• CORE CONCEPTS AND SETUP
• ROUTING AND ADVANCED ROUTING
• SECURITY AND ERROR HANDLING
• ROUTING, MIDDLEWARE, AND APIS
• PERFORMANCE AND SCALABILITY
• DATABASE INTEGRATION AND ORM
https://www.engrsakib.com/
REACT
PERFORMANCE OPTIMIZATION
o Answer: Code splitting breaks down the application bundle into smaller
chunks that are loaded on demand, enhancing performance. It is achieved
using dynamic import() and React.lazy with Suspense.
https://www.engrsakib.com/
o Answer: useMemo memoizes the result of a computation, whereas
useCallback memoizes a function definition. Both optimize performance by
preventing unnecessary re-renders.
o Answer: useReducer is used for complex state logic involving multiple state
variables or when the next state depends on the previous one. useState is
simpler and suitable for independent state values.
o Answer: Context API provides a way to pass data through the component
tree without prop drilling. It is useful for global state management but should
be used cautiously to avoid re-renders of all consuming components.
10. What are custom hooks, and why are they useful?
o Answer: Custom hooks are user-defined functions that allow reusing stateful
logic across multiple components. They enhance code readability and
maintainability.
11. How does React Router's dynamic routing differ from traditional routing?
o Answer: Lazy loading in React Router delays component loading until a route
is accessed. It is implemented using React.lazy and Suspense in combination
with React Router's Route component.
https://www.engrsakib.com/
13. How do nested routes work in React Router?
o Answer: Nested routes allow defining routes within other routes, creating a
hierarchical navigation structure. It is achieved using nested <Route>
components and rendering child routes within parent routes.
16. What are CSS Modules, and how are they used in React?
o Answer: CSS Modules provide scoped CSS by generating unique class names,
preventing style conflicts. They are imported as objects in React components
for modular styling.
https://www.engrsakib.com/
o Answer: Theming is implemented using the Context API or third-party
libraries like Styled-Components and Emotion, allowing consistent styling
across the application.
20. What are CSS-in-JS libraries, and what are their benefits?
23. How does Zustand differ from Redux for state management?
https://www.engrsakib.com/
ADVANCED CONCEPTS
28. How does Server-Side Rendering (SSR) differ from Client-Side Rendering (CSR)?
o Answer: SSR pre-renders HTML on the server, improving SEO and initial load
time, while CSR renders content on the client-side, providing a faster,
dynamic experience.
https://www.engrsakib.com/
MONGODB
SCHEMA DESIGN AND DATA MODELING
6. What are indexes in MongoDB, and how do they improve query performance?
o Answer: Indexes are data structures that store a subset of a collection's fields
for quick lookups. They improve query performance by reducing the need for
full collection scans.
7. What is a compound index, and when should it be used?
https://www.engrsakib.com/
o Answer: A compound index indexes multiple fields in a specified order,
enhancing query performance for queries that filter on multiple fields. It is
useful when querying by combinations of fields.
8. How do you analyze query performance in MongoDB?
o Answer: Query performance is analyzed using the .explain() method, which
provides details about query execution, index usage, and query planning,
helping identify slow queries.
9. What is index cardinality, and why is it important?
o Answer: Index cardinality refers to the uniqueness of values in an indexed
field. High cardinality indexes are more efficient because they filter out more
documents, speeding up queries.
10. How does MongoDB handle query optimization internally?
o Answer: MongoDB uses a query planner that evaluates multiple execution
plans and chooses the most efficient one based on cost estimation, caching
the plan for repeated queries.
https://www.engrsakib.com/
o Answer: Challenges include choosing the right shard key, managing data
rebalancing, and maintaining consistency. Proper shard key selection and
monitoring tools like balancer help manage these challenges.
https://www.engrsakib.com/
23. What is the $facet stage in aggregation pipelines?
o Answer: $facet runs multiple aggregation pipelines in parallel and combines
their results. It is used for multi-faceted reporting, such as pagination and
analytics dashboards.
24. How do you optimize aggregation pipelines in MongoDB?
o Answer: Aggregation pipelines are optimized by matching early in the
pipeline, using projections to limit fields, indexing fields used in $match, and
avoiding $unwind on large arrays.
25. What is MongoDB's $graphLookup, and when is it used?
o Answer: $graphLookup performs recursive searches on hierarchical data,
enabling queries on parent-child relationships or graph structures. It is useful
for organizational hierarchies or social networks.
https://www.engrsakib.com/
NODE.JS
o Answer: Streams are objects that handle continuous data flows efficiently,
such as reading from or writing to files or network connections. They improve
performance by processing data in chunks.
https://www.engrsakib.com/
o Answer: NPM (Node Package Manager) is the default package manager for
Node.js, while Yarn is an alternative package manager known for faster
installations and better dependency management.
o Answer: A Node.js package is created using npm init, and publishing is done
with npm publish after authentication. Versioning follows Semantic
Versioning (SemVer) guidelines.
10. How can you manage multiple versions of Node.js on the same machine?
o Answer: Multiple versions are managed using Node Version Manager (NVM),
which allows installing, switching, and maintaining different Node.js versions.
o Answer: Errors are handled using try-catch blocks with async/await, .catch()
with Promises, or passing errors to callbacks using the Node.js error-first
callback pattern.
12. What are the best practices for securing a Node.js application?
https://www.engrsakib.com/
o Answer: Helmet is a middleware that secures Express apps by setting HTTP
headers to prevent common vulnerabilities like cross-site scripting (XSS) and
clickjacking.
o Answer: Input validation checks data types and formats, while sanitization
removes malicious code. Both protect against injection attacks, ensuring data
integrity and security.
o Answer: An HTTP server is created using the built-in http module with
http.createServer() method, handling requests and responses manually.
o Answer: A RESTful API follows the REST architecture, using standard HTTP
methods (GET, POST, PUT, DELETE) to perform CRUD operations. It is
implemented using Express routes.
https://www.engrsakib.com/
o Answer: HTTP requests are made using the built-in http or https modules, or
third-party libraries like Axios and node-fetch for easier syntax and Promise-
based requests.
24. What are memory leaks in Node.js, and how do you identify them?
o Answer: Memory leaks occur when unused objects are not garbage collected.
They are identified using tools like Node.js heap snapshots, Memory Profiler,
and clinic.js.
https://www.engrsakib.com/
EXPRESS.JS
https://www.engrsakib.com/
o Answer: Routing in Express is done by defining HTTP methods and specifying
URL patterns. Route parameters, queries, and middleware functions can be
used for dynamic routing.
7. What are route parameters in Express.js, and how do you access them?
o Answer: Route parameters are dynamic parts of a URL that can capture
values. They are accessed using req.params in route handlers, e.g.,
app.get('/user/:id', (req, res) => {...}).
o Answer: Query parameters are values passed in the URL after the ? symbol.
They are accessed using req.query, e.g., req.query.name.
9. How can you handle multiple route methods for the same route?
o Answer: Multiple methods for a single route can be handled using the same
route path but different HTTP methods. For example, app.get() and
app.post() can be used for the same route with different logic.
o Answer: The next() function passes control to the next middleware function
in the stack. It is used to handle asynchronous operations or chain multiple
middleware.
https://www.engrsakib.com/
o Answer: XSS is prevented by sanitizing user inputs, using libraries like
express-validator, and setting proper HTTP headers such as Content Security
Policy (CSP).
o Answer: app.use() is used for middleware that executes for all HTTP
methods, while app.all() handles all HTTP methods for a specific route.
o Answer: Template engines like Pug, EJS, and Handlebars are used to generate
dynamic HTML content on the server-side before sending it to the client.
https://www.engrsakib.com/
o Answer: app.set() is used to set application settings (e.g., views,
environment), while app.get() is used to retrieve those settings within the
application.
o Answer: Large file uploads are handled using multer middleware, which
supports storage configurations and file size limits.
o Answer: The compression middleware reduces the size of the response body
by compressing it using gzip or deflate, improving the performance of the
application.
https://www.engrsakib.com/
DATABASE INTEGRATION AND ORM
28. How do you perform CRUD operations using MongoDB and Mongoose in
Express.js?
29. How do you set up a connection pool with a SQL database in Express?
30. How do you ensure data consistency and reliability in Express.js with MongoDB?
https://www.engrsakib.com/