MERN Stack Developer Interview Questions & Answers
40 questions for MERN Stack Developer interviews — 22 easy, 18 medium.
About the MERN Stack Developer role
A MERN Stack Developer builds complete features across the stack: MongoDB schemas, Express APIs and React screens. Day to day you turn designs and requirements into working pages, connect them to REST endpoints, handle authentication and fix bugs reported by QA. This is the most common entry role at startups and IT service companies, and it rewards developers who can take a feature from database to deployment with clean, tested code.
Write an aggregation that counts orders and sums revenue per status.
Show answer
You are building a registration form with ten fields and validation. How do you manage its state?
Show answer
What are the common ways to render content conditionally in React?
Show answer
What is a closure and where is it useful?
Show answer
Write a Mongoose schema for a user with validation and timestamps.
Show answer
What are the core principles of a RESTful API, and which HTTP methods are idempotent?
Show answer
Write a register endpoint that hashes the password with bcrypt.
Show answer
Which HTTP status codes should a REST API commonly return?
Show answer
How does React protect against XSS and where can XSS still happen?
Show answer
Build a simple todo list in React with add and delete.
Show answer
How do you protect a public Express API from abuse and brute-force traffic?
Show answer
A client wants deleted records to be recoverable. How would you implement soft delete with Mongoose?
Show answer
Why does the order of middleware matter in Express?
Show answer
What is the difference between useMemo and useCallback?
Show answer
What is JSX and how is it converted into JavaScript?
Show answer
Walk me through a MERN project you built, end to end.
Show answer
What is a Buffer in Node.js?
Show answer
Write an asyncHandler wrapper for Express 4 route handlers.
Show answer
Two sibling components need to share data. How do you handle it?
Show answer
Write a reusable validation middleware for Express using zod.
Show answer
What are the important changes in Express 5 compared to Express 4?
Show answer
How does routing work in a React single-page app using React Router?
Show answer
What does the helmet middleware do in Express?
Show answer
Implement page-based pagination for a products API with Mongoose.
Show answer
After deploying a React app, refreshing on a page like /dashboard shows a 404 error. Why, and how do you fix it?
Show answer
Write an Express router with CRUD routes for a products resource.
Show answer
Write Express middleware that logs method, URL, status code and response time.
Show answer
Why does React need keys in lists, and why is using the array index risky?
Show answer
How would you structure the folders of a production Express API?
Show answer
What does lifting state up mean in React?
Show answer
Fetch a list of users from an API inside useEffect with proper cleanup.
Show answer
Tell me about a time you received critical feedback on your UI code and how you responded.
Show answer
A developer accidentally pushed the .env file with the MongoDB password and JWT secret to a public repository. What do you do?
Show answer
How do class component lifecycle methods map to hooks?
Show answer
How should passwords be stored, and why use bcrypt?
Show answer
What is a JWT and what are its three parts?
Show answer
What is the difference between props and state in React?
Show answer
How do you protect certain routes in React so that only logged-in users can access them?
Show answer
What is React and how does the virtual DOM help performance?
Show answer
Frequently asked questions
What does a MERN Stack Developer do?
A MERN Stack Developer builds complete features across the stack: MongoDB schemas, Express APIs and React screens. Day to day you turn designs and requirements into working pages, connect them to REST endpoints, handle authentication and fix bugs reported by QA. This is the most common entry role at startups and IT service companies, and it rewards developers who can take a feature from database to deployment with clean, tested code.
Which skills are tested in a MERN Stack Developer interview?
Expect questions on React components, REST APIs, MongoDB queries, JWT auth, Git. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a MERN Stack Developer interview?
Revise Express.js and REST APIs, MongoDB and Mongoose, React Fundamentals, Authentication and Security first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.