Loading

Quipoin Menu

Learn • Practice • Grow

node-js / Connecting to MongoDB
mcq
Direction: Choose the correct option

Q1.

Which package is commonly used to connect Node.js to MongoDB?
A. mongoose
B. mongodb
C. Both A and B
D. mongo-client
Direction: Choose the correct option

Q2.

How do you connect to MongoDB using the official driver?
A. mongodb.connect()
B. MongoDB.connect()
C. mongoose.connect()
D. MongoClient.connect()
Direction: Choose the correct option

Q3.

What is Mongoose?
A. A query language
B. A testing tool
C. A database
D. An ODM (Object Document Mapper) for MongoDB
Direction: Choose the correct option

Q4.

What does `mongoose.connect('mongodb://localhost/mydb')` do?
A. Connects to MongoDB and returns a promise
B. Creates a new database
C. Drops the database
D. Returns a schema
Direction: Choose the correct option

Q5.

Why should connection strings be stored in environment variables?
A. To make code longer
B. To slow down the app
C. To keep credentials secure and configurable
D. To avoid using variables