MongoDB MCQs – Introduction to MongoDB

21.) Which of the following is used to represent a collection of data in MongoDB?

A) Tables
B) Files
C) Collections
D) Arrays

Answer: Option C

Explanation: MongoDB stores data in collections, which are equivalent to tables in relational databases.

22.) What does the db.collection.find() operation do in MongoDB?

A) Deletes data
B) Inserts data
C) Updates data
D) Queries data

Answer: Option D

Explanation: The find() method is used to query documents from a collection.

23.) Which of the following is NOT a key advantage of MongoDB?

A) Horizontal scaling
B) Fixed schema
C) High availability
D) Schema flexibility

Answer: Option B

Explanation: MongoDB is known for its schema flexibility, which allows different structures within the same collection. Fixed schema is a characteristic of relational databases, not MongoDB.

24.) Which of the following operations is used to insert a document into a MongoDB collection?

A) db.collection.find()
B) db.collection.insert()
C) db.collection.update()
D) db.collection.delete()

Answer: Option B

Explanation: The insert() operation is used to insert documents into a collection in MongoDB.

25.) Which feature of MongoDB is responsible for distributing data across multiple servers?

A) Indexing
B) Aggregation
C) Sharding
D) Transactions

Answer: Option C

Explanation: Sharding in MongoDB allows data to be distributed across multiple servers, ensuring scalability and efficient handling of large datasets.

Leave a Reply

Your email address will not be published. Required fields are marked *