This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Replication Processes – 1”.
1. Which of the following ddds an arbiter to a replica set?
a) rs.addArb()
b) rs.addArbiter()
c) rs.addtoArb()
d) all of the mentioned
View Answer
Explanation: rs.addArb() adds a new arbiter to an existing replica set.
2. Point out the wrong statement.
a) The rs.status() method is a wrapper that runs the replSetGetStatus database command
b) rs.freeze() provides a wrapper around the database command replSetFreeze
c) rs.init() initializes a new replica set
d) None of the mentioned
View Answer
Explanation: rs.init() initializes a new replica set.
3. _________ prevents the current member from seeking election as primary for a period of time.
a) rs.freeze()
b) rs.conf()
c) rs.printReplicationInfo()
d) secondary
View Answer
Explanation: rs.freeze() makes the current replica set member ineligible to become primary for the period specified.
4. _________ returns the replica set configuration document.
a) rs.freeze()
b) rs.conf()
c) rs.printReplicationInfo()
d) none of the mentioned
View Answer
Explanation: rs.conf() returns a document that contains the current replica set configuration.
5. Point out the correct statement.
a) rs.printinfo() prints a formatted report of the replica set member’s oplog
b) The output of rs.printReplicationInfo() is identical to that of db.printReplicationInfo()
c) rs.printReplicationInfo() formats and prints the data returned by db.allReplicationInfo()
d) none of the mentioned
View Answer
Explanation: The rs.printReplicationInfo() in the mongo shell does not return JSON.
6. ________ prints a report of the status of the replica set from the perspective of the primary.
a) rs.freeze()
b) rs.printconf()
c) rs.printReplicationInfo()
d) secondary
View Answer
Explanation: Typically you will use db.fsyncUnlock() following a database backup operation.
7. _________ re-configures a replica set by applying a new replica set configuration object.
a) rs.reconfig()
b) rs.remove()
c) rs.stepDown()
d) none of the mentioned
View Answer
Explanation: To reconfigure an existing replica set, first retrieve the current configuration with rs.conf(), modify the configuration document as needed, and then pass the modified document to rs.reconfig().
8. __________ sets the member that this replica set member will sync from, overriding the default sync target selection logic.
a) rs.reconfig()
b) rs.remove()
c) rs.stepDown()
d) rs.syncFrom()
View Answer
Explanation: rs.syncFrom() provides a wrapper around the replSetSyncFrom, which allows administrators to configure the member of a replica set that the current member will pull data from.
9. rs.reconfig() provides a wrapper around the ___________ command.
a) replSetfinalReconfig
b) replSetReconfig
c) replSetReconfiguration
d) none of the mentioned
View Answer
Explanation: The force parameter in reconfig method allows a reconfiguration command to be issued to a non-primary node.
10. ________ sets the slaveOk property for the current connection.
a) rs.reconfig()
b) rs.slaveOk()
c) rs.stepDown()
d) rs.slave()
View Answer
Explanation: Use readPref() and Mongo.setReadPref() to set read preference.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Check Information Technology Books
- Practice Programming MCQs
- Apply for Programming Internship
- Check MongoDB Books