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