Uncategorized Mern Technology Screening Test Feb 7, 2025 Collab Team Contributor 0 Comment MERN Technology Screening Test 1 / 20 In MongoDB, which aggregation stage is used to reshape documents, adding or removing fields? $sort $match $project $group 2 / 20 What is the purpose of the cluster module in Node.js? To create and manage child processes for concurrency To manage database transactions To run multiple instances of Express.js To handle event-driven communication 3 / 20 How do you update state based on the previous state in React? setState({ ...prevState, newValue }) this.state = newValue setState((prevState) => newValue) setState(newValue) 4 / 20 Which hook is used to handle side effects in functional components? useState() useEffect() useContext() useReducer() 5 / 20 Which MongoDB index type is best suited for queries involving text search? Text index Geospatial index Compound index Single-field index 6 / 20 What does process.nextTick() do in Node.js? Runs a function immediately Pauses the event loop Executes a function in the next event loop iteration Delays function execution indefinitely 7 / 20 Which of the following is a recommended way to perform transactions in MongoDB? Using findAndModify() Using updateMany() Using a replica set and startSession() Using bulkWrite() 8 / 20 Which middleware is commonly used to parse JSON request bodies in Express.js? multer body-parser express-validator cookie-parser 9 / 20 What will happen if a function component in React returns null? It will render nothing It will crash the application It will throw an error It will default to rendering an empty <div> 10 / 20 Which built-in Node.js module is used to create an HTTP server? http events net fs 11 / 20 What does req.params contain in an Express route handler? Route parameters from the URL HTTP headers Request body Query string parameters 12 / 20 Which command provides a detailed execution plan of a MongoDB query? queryPlanner() profile() explain("executionStats") find().stats() 13 / 20 In React, why should we use keys in lists? To store additional metadata To style list elements dynamically To improve performance by helping React identify changes To manage event handlers efficiently 14 / 20 Which of the following methods in Mongoose is used to populate referenced documents? populate() mapReduce() lean() aggregate() 15 / 20 What is the purpose of useMemo() in React? To perform side effects in functional components To memoize expensive calculations between renders To handle lifecycle methods To manage component state 16 / 20 Which of the following statements is true about Express.js routing? Middleware runs after route handlers by default Routes can be defined using app.use() Routes support HTTP methods like GET, POST, PUT, DELETE Routes must always be defined in separate files 17 / 20 Which Node.js module is used to work with file systems? stream path fs http 18 / 20 How do you handle errors globally in an Express.js application? Using throw new Error() Using process.exit() Using res.send(error.message) Using a middleware with (err, req, res, next) signature 19 / 20 What is the primary purpose of using express.static()? To handle dynamic data rendering To serve static files such as images and CSS To define middleware for error handling To define API routes 20 / 20 In Express.js, middleware functions have access to which of the following objects? req and next only req, res, and next req and res only res and next only Your score isThe average score is 46% 0%