This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Sharding Concepts”.
1. A sharded cluster can contain __________ query router to divide the client request load.
a) 1
b) 0
c) more than 1
d) all of the mentioned
View Answer
Explanation: A client sends requests to one query router. Most sharded clusters have many query routers.
2. Point out the correct statement.
a) MongoDB distributes data, or shards, at the collection level
b) To shard a document, you need to select a shard key
c) MongoDB divides the shard key values into replica sets
d) All of the mentioned
View Answer
Explanation: Sharding partitions a collection’s data by the shard key.
3. ________ servers store the cluster’s metadata.
a) Local
b) Config
c) Master
d) All of the mentioned
View Answer
Explanation: This data contains a mapping of the cluster’s data set to the shards.
4. The query router uses __________ to target operations to specific shards.
a) metadata
b) cluster
c) replica
d) all of the mentioned
View Answer
Explanation: For development and testing purposes only, each shard can be a single mongod instead of a replica set.
5. Point out the wrong statement.
a) For hash-based sharding, MongoDB divides the data set into ranges determined by the shard key values to provide hash based partitioning
b) Cloud-based providers may only allow users to provision smaller instances
c) For hash based partitioning, MongoDB computes a hash of a field’s value, and then uses these hashes to create chunks
d) All of the mentioned
View Answer
Explanation: For range-based sharding, MongoDB divides the data set into ranges determined by the shard key values to provide range based partitioning.
6. Production sharded clusters have exactly ______ config servers.
a) 1
b) 2
c) 3
d) 4
View Answer
Explanation: Do not deploy production clusters without 3 config servers.
7. A _________ key is either an indexed field or an indexed compound field that exists in every document in the collection.
a) cluster
b) shard
c) partition
d) all of the mentioned
View Answer
Explanation: Sharding partitions a collection’s data by the shard key.
8. To divide the shard key values into chunks, MongoDB uses _____ based partitioning.
a) range
b) b tree
c) document
d) isMaster
View Answer
Explanation: Hash based partitioning can also be used.
9. With hash based partitioning, two documents with _____ shard key values are unlikely to be part of the same chunk.
a) close
b) open
c) partially close
d) all of the mentioned
View Answer
Explanation: This ensures a more random distribution of a collection in the cluster.
10. _______ based partitioning, by contrast, ensures an even distribution of data at the expense of efficient range queries.
a) Hash
b) Range
c) Table
d) None of the mentioned
View Answer
Explanation: Hashed key values results in random distribution of data across chunks and therefore shards.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Apply for Programming Internship
- Check MongoDB Books
- Practice Programming MCQs
- Check Information Technology Books