MERN Stack Interview Questions (With Short Answers)
General MERN Stack Questions
1. What is MERN Stack?
- MongoDB, [Link], [Link], and [Link] combined to build full stack apps.
2. How does MERN architecture work?
- React (frontend) communicates with Express + Node (backend), which interacts with MongoDB
(database).
3. Role of each technology?
- MongoDB stores data, Express handles APIs, React builds UI, Node runs JS on server.
[Link] Questions
1. What is a component?
- Reusable piece of UI; can be functional or class-based.
2. What are hooks?
- Special functions like useState, useEffect to manage state and side effects.
3. What is Virtual DOM?
- A lightweight copy of real DOM that updates only changed parts.
4. Controlled vs Uncontrolled components?
- Controlled: React manages input value. Uncontrolled: DOM manages it.
[Link] and [Link] Questions
1. What is [Link]?
- Web framework for [Link] to build APIs and handle requests.
2. What is middleware?
- Functions that process requests before reaching route handler.
3. Use of req, res, next?
- Represent request, response and next middleware function.
4. How to handle errors?
MERN Stack Interview Questions (With Short Answers)
- Use try-catch or error-handling middleware.
MongoDB Questions
1. What is MongoDB?
- A NoSQL document-based database.
2. MongoDB vs SQL?
- MongoDB uses collections/documents; SQL uses tables/rows.
3. What are indexes?
- Improve query performance.
4. How to model relationships?
- Embedding for nested data, referencing for normalization.
Authentication & Deployment
1. Authentication in MERN?
- Use JWT and bcrypt for login/signup.
2. Protect private routes?
- Use React Router and tokens.
3. Deploy MERN app?
- Vercel (frontend), Render/Heroku (backend), MongoDB Atlas (DB).
Miscellaneous
1. What is dotenv?
- Loads environment variables from .env file.
2. What is CORS?
- Cross-Origin Resource Sharing; handle with cors middleware.
3. Purpose of nodemon?
- Auto-restarts server on file changes.
MERN Stack Interview Questions (With Short Answers)
4. Connecting MongoDB?
- [Link]([Link].MONGO_URI)