Backend (Node, Express, Mongodb) - Honors IV Sem Full Stack-I Backend (Node, Express, Mongodb) - Honors IV Sem Full Stack-I NameEmailPhone Number 1 / 31 How do you define a route in Express.js? app.get("/route", callback); app.route("/route").get(callback); router.get("/route", callback); All of the above 2 / 31 How do you export a function in Node.js? module.export = functionName; exports.functionName = functionName; export functionName; None of the above 3 / 31 How do you check the version of Node.js installed? node --version node -v Both A & B npm version 4 / 31 How does Node.js handle multiple requests simultaneously? It creates multiple threads It handles them asynchronously with a single-threaded event loop It queues them until they are completed It creates a new instance for each request 5 / 31 How do you define middleware in Express.js? app.middleware(function(req, res, next) {}) app.use((req, res, next) => { next(); }) app.runMiddleware(fn) middleware(fn) 6 / 31 Which MongoDB function counts documents? db.collection.countDocuments() db.collection.size() db.collection.totalDocs() db.collection.countAll() 7 / 31 What is the default port for MongoDB? 3306 27017 8080 5432 8 / 31 What format does MongoDB store data in? XML JSON Object CSV 9 / 31 Which of the following is a core module in Node.js? express mongoose events body-parser 10 / 31 What is a functional component in React? A JavaScript function that returns JSX A class that extends React.Component A function with lifecycle methods A function that modifies the DOM directly 11 / 31 How do you read environment variables in Node.js? env.get('VAR_NAME'); process.env.VAR_NAME getEnv('VAR_NAME'); read.env('VAR_NAME'); 12 / 31 MongoDB is a... Relational database Document-oriented NoSQL database Key-Value store Graph database 13 / 31 What is Node.js built on? Ruby Chrome V8 JavaScript Engine Python Java 14 / 31 What is Express.js used for? Database management Server-side framework for Node.js Frontend development Handling CSS 15 / 31 What is express.Router() used for? To create modular route handlers To configure middleware To serve static files To manage databases 16 / 31 What is the purpose of package.json in a Node.js project? Defines app routes Manages project dependencies Executes scripts Compiles JavaScript code 17 / 31 How do you install Express.js? npm install express npm create express node install express install express 18 / 31 What is the default HTTP method in Express.js routes? GET POST PUT DELETE 19 / 31 Which command is used to create a new Node.js project with default settings? npm init npm create npm init -y node new 20 / 31 What is the default port for an HTTP server in Node.js? 3000 8000 80 5000 21 / 31 Which statement about Node.js event-driven architecture is true? It uses a multi-threaded approach It blocks execution until an operation is complete It is based on the observer pattern It executes code synchronously 22 / 31 What method updates documents in MongoDB? db.collection.modify() db.collection.updateOne() db.collection.changeOne() db.collection.editOne() 23 / 31 What does db.collection.findOne() return? An array A single document An object with multiple documents A cursor 24 / 31 What is the difference between require() and import in Node.js? require() is synchronous import is synchronous Both are the same None of the above 25 / 31 Which of these is NOT a valid Node.js stream type? Readable Writable Duplex Reversible 26 / 31 How do you enable CORS in an Express.js app? app.use(cors()) app.enableCORS() app.configureCORS() express.cors() 27 / 31 How do you remove a document in MongoDB? db.collection.deleteOne() db.collection.removeOne() db.collection.eraseOne() db.collection.dropOne() 28 / 31 What does npm start do in a Node.js project? Runs node index.js Runs the script defined under "start" in package.json Installs dependencies Starts a new Node.js process 29 / 31 How do you handle exceptions in Node.js? Using throw Using try...catch Using catch only None of the above 30 / 31 How do you install a package using npm? npm start package-name npm install package-name node install package-name install package-name 31 / 31 What is the method to insert multiple documents in MongoDB? db.collection.insertMany() db.collection.insertAll() db.collection.insert() db.collection.add() Your score isThe average score is 93% 0% Restart quiz