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

Advanced MERN Stack Interview Q&A

The document provides advanced interview questions and answers related to the MERN stack, covering topics such as JWT for authentication, deployment strategies, performance optimization in React, security practices, file uploads, Redux for state management, and error handling in Express. Key concepts include the distinction between authentication and authorization, as well as methods to secure API routes. The document serves as a comprehensive guide for candidates preparing for MERN stack interviews.

Uploaded by

taruncoder7
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 views2 pages

Advanced MERN Stack Interview Q&A

The document provides advanced interview questions and answers related to the MERN stack, covering topics such as JWT for authentication, deployment strategies, performance optimization in React, security practices, file uploads, Redux for state management, and error handling in Express. Key concepts include the distinction between authentication and authorization, as well as methods to secure API routes. The document serves as a comprehensive guide for candidates preparing for MERN stack interviews.

Uploaded by

taruncoder7
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

Advanced MERN Stack Interview Questions and Answers

Q: What is JWT and how is it used in MERN applications?

A: JWT (JSON Web Token) is used for authentication. It contains a payload (user data) and is

signed using a secret. It is sent in the Authorization header and verified by the server.

Q: How do you implement authentication with JWT in Express?

A: Generate a token with jsonwebtoken library after login, send it to the client, and verify it on

protected routes using middleware.

Q: What is the difference between authentication and authorization?

A: Authentication verifies user identity, while authorization checks user permissions.

Q: How do you deploy a MERN application?

A: Frontend can be deployed on Netlify or Vercel, backend on Heroku or Render, and database

(MongoDB) on Atlas.

Q: How do you optimize performance in a React application?

A: Use memoization ([Link], useMemo), code splitting, lazy loading, and avoid unnecessary

re-renders.

Q: What are some common security practices in MERN stack apps?

A: Use HTTPS, sanitize inputs, implement rate limiting, use helmet, and validate JWT tokens.

Q: How do you handle file uploads in MERN?

A: Use multer middleware in Express and FormData in React.

Q: What is Redux and when should you use it in MERN?

A: Redux is a state management library useful when multiple components need to share and

manage state.

Q: How do you handle errors globally in Express?

A: Use custom error-handling middleware at the end of route declarations.


Q: How can you secure API routes in Express?

A: Use authentication middleware, check JWT tokens, and restrict access based on roles.

You might also like