MongoDB Questions and Answers – Write operations

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Write operations”.

1. ___________ concern describes the guarantee that MongoDB provides when reporting on the success of a write operation.
a) Write
b) Read
c) Update
d) None of the mentioned
View Answer

Answer: a
Explanation: The strength of the write concerns determine the level of guarantee.

2. Point out the correct statement.
a) Read operations on sharded clusters are most efficient when directed to a specific shard
b) Sharded clusters allow you to partition a data set among a cluster of mongod instances in a way that is nearly transparent to the application
c) For a sharded cluster, applications issue operations to one of the mongos instances associated with the cluster
d) All of the mentioned
View Answer

Answer: d
Explanation: Queries to sharded collections should include the collection’s shard key.

3. When inserts, updates and deletes have a _________ write concern, write operations return quickly.
a) strong
b) weak
c) average
d) very strong
View Answer

Answer: b
Explanation: With stronger write concerns, clients wait after sending a write operation for MongoDB to confirm the write operations.

4. The mongo shell and the MongoDB drivers use __________ as the default write concern.
a) Nacknowledged
b) Acknowledgement
c) Acknowledged
d) All of the mentioned
View Answer

Answer: c
Explanation: MongoDB allows clients to read documents inserted or modified before it commits these modifications to disk, regardless of write concern level or journaling configuration.

advertisement
advertisement

5. Point out the wrong statement.
a) When a query does not include a shard key, the mongos can use cluster metadata from the config database to route the queries to shards
b) On larger clusters, scatter gather queries are unfeasible for routine operations
c) Replica sets use read preferences to determine where and how to route read operations to members of the replica set
d) None of the mwntioned
View Answer

Answer: a
Explanation: If a query does not include the shard key, the mongos must direct the query to all shards in the cluster.

6. _____________ is used to control mongod commits in the journal.
a) commitIntervMs
b) commitInterval
c) commitIntervalMs
d) all of the mentioned
View Answer

Answer: c
Explanation: For replica sets, write operations are durable only after a write replicates and commits to the journal on a majority of the voting members of the set.

7. Clients can set a __________ value as part of a replica acknowledged write concern.
a) timeout
b) wtimeout
c) waittimeout
d) none of the mentioned
View Answer

Answer: b
Explanation: If the write concern is not satisfied in the specified interval, the operation returns an error, even if the write concern will eventually succeed.

8. MongoDB does not ___________ modifications made before the wtimeout interval expired.
a) commit
b) rollback
c) save
d) all of the mentioned
View Answer

Answer: b
Explanation: The driver’s ability to detect network errors depends on the system’s networking configuration.

advertisement

9. With an __________ write concern, MongoDB does not acknowledge the receipt of write operations.
a) Nacknowledged
b) Acknowledgement
c) Acknowledged
d) Unacknowledged
View Answer

Answer: d
Explanation: Unacknowledged is similar to errors ignored.

10. With a receipt acknowledged write concern, the _________confirms that it received the write operation and applied the change to the in-memory view of data.
a) mongod
b) mongos
c) mongo
d) mongoc
View Answer

Answer: a
Explanation: Acknowledged write concern allows clients to catch network, duplicate key, and other errors.

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.