Mock Interviews
๐Ÿ’ผ MOCK INTERVIEW ยท MERN STACK

MERN Stack Interview

15 real questions. No hints. No Google. Answer them all honestly โ€” then see exactly where you stand.

โ“ 15 Questionsโ˜‘๏ธ Multiple choice๐Ÿ“– Explanations includedโšก Instant score
Question 1 of 150 answered
01Start simple. Every interview does.

What does MERN stand for?

These questions reflect real MERN stack interviews at mid-size and large tech companies. If you scored below 80%, focus on the explanations โ€” not just the correct letters.

More mock interviews โ†’

Complete Guide

MERN Stack Mock Interview: 15 Real Questions, Honest Answers

A

Anwer

March 25, 2026 ยท TechClario

A MERN stack interview tests your knowledge across four interconnected technologies: MongoDB, Express.js, React, and Node.js. Interviewers don't just check whether you've used these tools โ€” they probe your conceptual understanding, your ability to explain trade-offs, and your familiarity with real-world patterns. Here's a comprehensive guide to the questions you should expect and what strong answers look like.

MongoDB: Document Database Fundamentals

"What is MongoDB and how does it differ from a relational database?" MongoDB is a document-oriented NoSQL database that stores data as BSON (Binary JSON) documents in collections, rather than rows in tables. Unlike relational databases, MongoDB doesn't enforce a fixed schema โ€” each document in a collection can have different fields. This flexibility makes it suitable for rapidly changing data models and hierarchical data. The trade-off is that MongoDB historically lacked multi-document ACID transactions (now supported) and doesn't support complex SQL-style joins natively.

"What are Mongoose and when would you use it?" Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js. It provides schema definitions, validation, type casting, query building, and hooks (middleware). In a pure MongoDB environment you can insert any document shape; Mongoose enforces a schema at the application layer, catching data quality issues before they reach the database. Use Mongoose when you want structure and validation; use the native MongoDB driver when you need maximum performance and flexibility.

"How does MongoDB handle relationships between data?" MongoDB handles relationships through two approaches: embedding documents (nesting related data within a single document) and referencing (storing a reference to another document's ID). Embedding is efficient for data that's always read together (a blog post and its author's name) but causes data duplication. Referencing normalizes data but requires multiple queries or $lookup aggregation pipeline stages to join. The right choice depends on access patterns and data size.

Express.js: Backend Routing and Middleware

"What is middleware in Express, and how does it work?" Middleware are functions that execute during the request-response cycle. They have access to the request object, the response object, and the next function that passes control to the next middleware. Middleware can execute code, modify request/response objects, end the request-response cycle, or call the next middleware. Express apps are essentially a series of middleware function calls. Common middleware: express.json() (parse JSON bodies), cors() (handle CORS headers), authentication middleware (verify JWT tokens), and error-handling middleware (four-argument functions: (err, req, res, next)).

"How do you handle errors in an Express application?" Define error-handling middleware with four parameters: (err, req, res, next). When an error is thrown or passed to next(err), Express skips regular middleware and routes and passes control to error-handling middleware. Structure error responses consistently (status code, error message, optional details). Distinguish operational errors (expected: invalid input, not found) from programmer errors (unexpected: null references) โ€” operational errors should be reported to the client; programmer errors should be logged and may warrant a process restart.

React: Frontend Component Architecture

"What are React hooks, and why were they introduced?" Hooks are functions that let functional components use React state and lifecycle features that previously required class components. They were introduced in React 16.8 to solve problems with class components: complex lifecycle methods that were hard to split across related logic, difficult reuse of stateful logic between components, and the conceptual overhead of this binding. Core hooks: useState for local state, useEffect for side effects (data fetching, subscriptions, DOM manipulation), useContext for consuming context, useRef for mutable references and DOM access, useMemo and useCallback for performance optimization.

"What is the virtual DOM and how does React use it for performance?" The virtual DOM is an in-memory representation of the actual DOM. When state changes, React creates a new virtual DOM tree, diffs it against the previous virtual DOM tree (using a reconciliation algorithm), and calculates the minimal set of changes needed to update the real DOM. Direct DOM manipulation is slow; React batches and minimizes DOM operations, applying only the necessary changes. React 18 introduced concurrent features (automatic batching, Suspense, transitions) that further improve performance by allowing React to pause, interrupt, and resume rendering work.

Node.js: Server-Side JavaScript Runtime

"How does Node.js handle concurrency without multiple threads?" Node.js uses an event-driven, non-blocking I/O model based on the event loop. When Node.js encounters an asynchronous operation (database query, file read, network request), it initiates the operation via the underlying OS (which handles it using system threads) and immediately continues executing JavaScript. When the operation completes, a callback or Promise resolution is placed in the event queue; the event loop processes it when the call stack is empty. This allows Node.js to handle many concurrent connections efficiently without the memory overhead of one thread per connection โ€” ideal for I/O-bound applications like API servers.

"What is the difference between require (CommonJS) and import (ES Modules) in Node.js?" CommonJS (require/module.exports) is the original Node.js module system โ€” synchronous loading, dynamic (you can call require inside conditionals), and the default in Node.js for years. ES Modules (import/export) is the JavaScript standard module system โ€” loaded asynchronously, static (imports must be at the top level), and enabling tree shaking in bundlers. Modern Node.js (12+) supports both, but they can't be freely mixed. New projects should prefer ES Modules; much existing Node.js ecosystem code still uses CommonJS.

Full-Stack Integration

"How do you connect a React frontend to a Node.js/Express backend?" The frontend makes HTTP requests (using fetch or axios) to the Express API endpoints. During development, a proxy in the frontend's development server routes API requests to avoid CORS issues. In production, configure CORS middleware in Express to allow the frontend's origin. JWT (JSON Web Tokens) are the standard authentication mechanism: the backend issues a JWT on login; the frontend stores it (in memory or httpOnly cookies) and sends it in the Authorization header with subsequent requests; the backend validates the JWT on protected routes.

This complete understanding of data flow from MongoDB through Express through Node through React โ€” and back โ€” is what a MERN stack developer needs in production.