250+ TOP MCQs on Sharded Cluster Data Management

MongoDB Multiple Choice Questions on “Shared Cluster Data Management”.

1. _______ runs a database command against the admin database of a mongos instance.
a) sh._checkFullName()
b) sh._adminCommand()
c) sh.getBalancerLockDetails()
d) all of the mentioned

Answer: b
Clarification: sh._adminCommand() runs a database command against the admin database, like db.runCommand(), but can confirm that it is issued against a mongos.

2. Point out the correct statement.
a) The unique constraint on indexes ensures that only one document can have a value for a field in a collection
b) MongoDB support creating new unique indexes in sharded collections
c) If you use a compound shard key, you cannot enforce uniqueness on the combination of component keys in the shard key
d) All of the mentioned

Answer: a
Clarification: For sharded collections these unique indexes cannot enforce uniqueness because insert and indexing operations are local to each shard.

3. ________ tests to see if the mongo shell is connected to a mongos instance.
a) sh._checkMongos()
b) sh.addShard()
c) sh._lastMigration()
d) all of the mentioned

Answer: a
Clarification: The sh._checkMongos() method throws an error message if the mongo shell is not connected to a mongos instance.

4. _______ reports on the active balancer lock, if it exists.
a) sh._checkFullName()
b) sh._adminCommand()
c) sh.getBalancerLockDetails()
d) all of the mentioned

Answer: c
Clarification: sh._checkFullName() tests a namespace to determine if its well formed.

5. Point out the wrong statement.
a) The best way to ensure a field has unique values is to generate universally unique identifiers (UUID,) such as MongoDB’s ‘ObjectId values
b) Most deployments will not need to shard the files collection
c) The files collection is typically small, and only contains metadata
d) None of the mentioned

  250+ TOP MCQs on Indexing Methods and Answers

Answer: d
Clarification: None of the required keys for GridFS lend themselves to an even distribution in a sharded situation.

6. _________ reports on the last chunk migration.
a) sh._checkMongos()
b) sh.addShard()
c) sh._lastMigration()
d) all of the mentioned

Answer: c
Clarification: The sh._lastMigration() method returns a document with details about the last migration performed on the database or collection.

7. _________ removes an association between a range shard keys and a shard tag.
a) sh.removeTagRange()
b) sh._checkMongos()
c) sh.disableBalancing()
d) none of the mentioned

Answer: a
Clarification: Use sh.removeShardTag() to ensure that unused or out of date ranges are removed and hence chunks are balanced as required.

8. _________ disable balancing on a single collection in a sharded database.
a) sh.removeTagRange()
b) sh._checkMongos()
c) sh.disableBalancing()
d) none of the mentioned

Answer: c
Clarification: sh.disableBalancing() does not affect balancing of other collections in a sharded cluster.

9. _______ activates the sharded collection balancer process if previously disabled using sh.disableBalancing().
a) sh.getBalancerHost()
b) sh.enableBalancing()
c) sh.enableSharding()
d) all of the mentioned

Answer: a
Clarification: sh.enableSharding() enables sharding on a specific database.

10. ________ returns a boolean to report if the balancer is currently enabled.
a) sh.getBalancerHost()
b) sh.enableBalancing()
c) sh.getBalancerState()
d) none of the mentioned

Answer: c
Clarification: sh.getBalancerState() returns true when the balancer is enabled and false if the balancer is disabled.

Leave a Comment

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

Scroll to Top