MongoDB Questions and Answers – Replication in MongoDB

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

1. A _______ set is a group of mongod instances that host the same data set.
a) copy
b) sorted
c) radii
d) replica
View Answer

Answer: d
Explanation: One mongod, the primary, receives all write operations.

2. Point out the wrong statement.
a) Replication provides redundancy and increases data availability
b) Replication allows you to recover from hardware failure and service interruptions
c) With multiple copies of data on different database servers, replication protects a database from the loss of a single server
d) None of the mentioned
View Answer

Answer: d
Explanation: With additional copies of the data, you can dedicate one to disaster recovery, reporting, or backup.

3. All other instances, secondaries, apply operations from the _________ so that they have the same data set.
a) center
b) secondary
c) primary
d) none of the mentioned
View Answer

Answer: c
Explanation: The primary accepts all write operations from clients.

4. A replica set can have only ________ primary.
a) One
b) Two
c) Three
d) All of the mentioned
View Answer

Answer: a
Explanation: The secondaries replicate the primary’s oplog and apply the operations to their data sets such that the secondaries’ data sets reflect the primary’s data set.

advertisement
advertisement

5. Point out the wrong statement.
a) In all cases, you can use replication to increase read capacity
b) Clients have the ability to send read and write operations to different servers
c) You can also maintain copies in different data centers to increase the locality and availability of data for distributed applications
d) None of the mentioned
View Answer

Answer: a
Explanation: In some cases, you can use replication to increase read capacity.

6. To support replication, the primary records all changes to its data sets in its _______
a) oplog
b) adlog
c) log
d) none of the mentioned
View Answer

Answer: a
Explanation: If the primary is unavailable, the replica set will elect a secondary to be primary.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

7. You may add an extra mongod instance to a replica set as an __________
a) arbiter
b) replicator
c) additor
d) all of the mentioned
View Answer

Answer: a
Explanation: Arbiters do not maintain a data set.

8. An arbiter will always be an arbiter whereas a primary may step down and become a secondary and a _________ may become the primary during an election.
a) center
b) secondary
c) primary
d) none of the mentioned
View Answer

Answer: b
Explanation: If your replica set has an even number of members, add an arbiter to obtain a majority of votes in an election for primary.

advertisement

9. When a primary does not communicate with the other members of the set for more than ____ seconds, the replica set will attempt to select another member to become the new primary.
a) 10
b) 20
c) 30
d) None of the mentioned
View Answer

Answer: a
Explanation: The first secondary that receives a majority of the votes becomes primary.

10. When a replica set has one and only one primary, reads from that primary provide ______ consistency.
a) strict
b) partial
c) weak
d) all of the mentioned
View Answer

Answer: a
Explanation: Arbiters can be a good way to provide replica set quorum functionality with a cheaper resource cost than a fully functional replica set member with a data set.

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.