MongoDB Questions and Answers – Sharding Concepts

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

Answer: c
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

Answer: a
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

Answer: a
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

Answer: a
Explanation: For development and testing purposes only, each shard can be a single mongod instead of a replica set.

advertisement
advertisement

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

Answer: a
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

Answer: c
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

Answer: b
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

Answer: a
Explanation: Hash based partitioning can also be used.

advertisement

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

Answer: a
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

Answer: b
Explanation: Hashed key values results in random distribution of data across chunks and therefore shards.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.