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
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
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
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
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.
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
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
Explanation: If the primary is unavailable, the replica set will elect a secondary to be primary.
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
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
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.
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
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
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.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Practice Programming MCQs
- Check Information Technology Books
- Check MongoDB Books
- Apply for Programming Internship