MERN Stack- Node-Express-Mongodb

This test include question of Node Express and MongoDB

How can you access query parameters in a URL using Express.js?

Which command creates a package.json file?

What is the purpose of the next() function in Express.js middleware?

What will be the output of the following code snippet when a request is made to the /calculate endpoint with the query parameters num1=5 and num2=10?

app.get('/calculate', (req, res) => {
  const num1 = parseInt(req.query.num1);
  const num2 = parseInt(req.query.num2);
  const sum = num1 + num2;
  res.send({ sum: sum });
});

Which HTTP method is used to retrieve data?

Which statement creates a Promise?

What is the purpose of the app.use() method in Express.js?

Which method converts an object into JSON string?

Which package is commonly used to connect MongoDB with Node.js?

Which HTTP status indicates successful creation?

Which keyword is used to handle errors?

Which status code means “Not Found”?

In MongoDB, which command deletes an entire collection?

In Express.js, which object is used to send a response to the client?

How can you set a custom port for your Express.js application?

Which command installs MongoDB driver for Node.js?

Which command shows all collections in a MongoDB database?

Which method removes the last element from an array?

MongoDB stores data in which format?

Which function in Express is used to start the server?

Which method updates a document in MongoDB?

How do you define a route in Express.js?

What will be the output of the following code snippet?
print(typeof(NaN));

How can you access form data in a POST request using Express.js?

Which method is used to insert a document in MongoDB?

What is the main purpose of package.json in a Node.js project?

How can you create a route in Express.js to handle a DELETE request to the /delete-user/:userId endpoint and delete the user with the specified ID?

What will be the output of the following code snippet?

const obj1 = {first: 20, second: 30, first: 50};

console.log(obj1);

Which function delays execution for specified milliseconds?

Which module is used to create a router in Express?

0%