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

MERN Stack Interview Questions

The document provides a comprehensive overview of the MERN stack, which consists of MongoDB, Express.js, React.js, and Node.js, detailing their roles in full-stack JavaScript development. It includes key concepts such as creating APIs in Express, using hooks in React, and handling asynchronous operations in Node.js. Additionally, it covers database interactions with MongoDB and the importance of CORS in web applications.

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)
17 views2 pages

MERN Stack Interview Questions

The document provides a comprehensive overview of the MERN stack, which consists of MongoDB, Express.js, React.js, and Node.js, detailing their roles in full-stack JavaScript development. It includes key concepts such as creating APIs in Express, using hooks in React, and handling asynchronous operations in Node.js. Additionally, it covers database interactions with MongoDB and the importance of CORS in web applications.

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
You are on page 1/ 2

MERN Stack Interview Questions and Answers

Q: What is the MERN stack?

A: MERN stands for MongoDB, Express.js, React.js, and Node.js. It's a full-stack JavaScript

solution.

Q: How does the MERN stack work together?

A: React handles the frontend, Express.js and Node.js manage the backend, MongoDB is used for

the database.

Q: What is MongoDB and why is it used in MERN?

A: MongoDB is a NoSQL, document-oriented database. It stores data in BSON (JSON-like) format.

Q: How do you create and retrieve data in MongoDB?

A: Use insertOne(), insertMany(), find(), and findOne() methods.

Q: What are indexes in MongoDB?

A: Indexes improve query performance. Created using createIndex().

Q: What is Express.js?

A: Express is a minimal Node.js web framework used to build APIs and web applications.

Q: How do you create an API in Express?

A: Use app.get() or app.post() methods to define routes.

Q: What is middleware in Express?

A: Functions that handle requests before reaching the route handler.

Q: What is React and why is it used in MERN?

A: React is a library for building user interfaces using reusable components.

Q: What are hooks in React?

A: Functions like useState and useEffect used in functional components.

Q: Explain the virtual DOM.


A: A lightweight representation of the real DOM used by React for efficient updates.

Q: What is Node.js?

A: Node.js is a JavaScript runtime that executes code outside the browser.

Q: What is the event loop in Node.js?

A: It handles async operations like I/O without blocking the main thread.

Q: How do you handle async code in Node.js?

A: Using callbacks, promises, or async/await.

Q: How do you connect React with Express?

A: Use fetch or axios in React to make HTTP requests to Express routes.

Q: How do you connect Express with MongoDB?

A: Use Mongoose or MongoDB native driver to connect.

Q: What is CORS and how do you handle it?

A: CORS allows cross-origin requests, handled with the cors package in Express.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy