Basic Advance

MERN Stack- Node-Express-Mongodb

This test include question of Node Express and MongoDB

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?

How do you define a route in Express.js?

Which HTTP method is used to retrieve data?

What will be the output of the following code snippet?

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

console.log(obj1);

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

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

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

Which function in Express is used to start the server?

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

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

Which method updates a document in MongoDB?

Which command installs MongoDB driver for Node.js?

Which function delays execution for specified milliseconds?

Which method removes the last element from an array?

Which command shows all collections in a MongoDB database?

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

Which statement creates a Promise?

Which method converts an object into JSON string?

Which method is used to insert a document in MongoDB?

Which module is used to create a router in Express?

Which command creates a package.json file?

Which keyword is used to handle errors?

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

MongoDB stores data in which format?

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 });
});

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

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

Which HTTP status indicates successful creation?

Which status code means “Not Found”?

In MongoDB, which command deletes an entire collection?

0%