Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

______ returns basic help text for replica set functions.(a) rs.printSlaveReplicationInfo()(b) rs.printReplication()(c) rs.help()(d) all of the mentionedI got this question in my homework.My doubt is from Member Configuration topic in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Correct option is (C) rs.help()

BEST explanation: rs.help() returns a BASIC help TEXT for all of the replication related shell functions.

2.

_________ members allow you to add additional members for read distribution beyond the maximum seven voting members.(a) Voting(b) Non-voting(c) Priority(d) all of the mentionedI got this question during an internship interview.I'm obligated to ask this question of Member Configuration in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The CORRECT CHOICE is (b) Non-voting

For EXPLANATION I would SAY: To configure a member as non-voting, SET its votes value to 0.

3.

Remove the secondary from the replica set by calling___________ method.(a) rs.removeRepli()(b) rs.remove()(c) rs.removeset()(d) isMasterI have been asked this question during a job interview.My question is taken from Member Configuration topic in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right OPTION is (b) rs.remove()

To EXPLAIN I would SAY: rs.remove() REMOVES the member DESCRIBED by the hostname parameter from the current replica set.

4.

If the oplog is shorter than the slaveDelay window, the _______ member cannot successfully replicate operations.(a) hidden(b) delayed(c) priority(d) all of the mentionedThis question was posed to me during an online interview.Origin of the question is Member Configuration topic in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT answer is (B) delayed

The BEST I can explain: The length of the secondary slaveDelay must fit WITHIN the window of the oplog.
5.

The _________ shell method can force the current primary to step down, which causes an election.(a) rs.repliconfig()(b) rs.config()(c) rs.reconfig()(d) all of the mentionedThis question was posed to me in an interview.My query is from Member Configuration topic in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right option is (c) rs.reconfig()

The BEST explanation: When the PRIMARY steps down, the mongod closes all CLIENT CONNECTIONS.

6.

Point out the wrong statement.(a) Before an election the primary opens all open client connections(b) To block a member from seeking election as primary, assign it a priority of 0(c) Hidden members, delayed members, and arbiters all have priority set to 0(d) All of the mentionedI have been asked this question by my college director while I was bunking the class.This intriguing question originated from Member Configuration in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right option is (a) Before an ELECTION the PRIMARY opens all open CLIENT connections

The BEST I can EXPLAIN: Reconfiguring priority can force the current primary to step down, leading to an election.

7.

To modify priorities, you update the members _________ in the replica configuration object.(a) array(b) tag(c) mdimarray(d) all of the mentionedThe question was asked during an interview for a job.The query is from Member Configuration in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right OPTION is (a) array

The BEST I can EXPLAIN: The array index begins with 0. Do not confuse this index value with the value of the replica set MEMBER’s _id field in the array.

8.

The ________ settings of replica set members affect the outcomes of elections for primary.(a) priority(b) replication(c) Initiate(d) all of the mentionedThis question was addressed to me during an internship interview.My question is based upon Member Configuration in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» RIGHT ANSWER is (a) priority

The BEST I can explain: Use this setting to ensure that some members are more likely to BECOME primary and that others can never become primary.
9.

Point out the correct statement.(a) The value of the member’s priority setting determines the member’s priority in elections(b) The default value for the priority field is 3(c) The value of priority can be any floating point (i.e. decimal) number between 0 and 500(d) None of the mentionedThis question was posed to me during an online exam.Query is from Member Configuration topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT option is (a) The value of the MEMBER’s PRIORITY setting DETERMINES the member’s priority in elections

The explanation is: The higher the number, the higher the priority.
10.

_______ is an internal command that applies oplog entries to the current data set.(a) replSetSyncFrom(b) resync(c) applyOps(d) isMasterThis question was addressed to me in an international level competition.Origin of the question is Troubleshooting in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct ANSWER is (c) applyOps

Explanation: The applyOps COMMAND is primarily an INTERNAL command.

11.

Which of the command is for master-slave replication only?(a) replSetSyncFrom(b) resync(c) applyOps(d) isMasterThe question was asked in quiz.Asked question is from Troubleshooting in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right ANSWER is (b) RESYNC

The best EXPLANATION: resync forces a MONGOD to re-synchronize from the master.

12.

________ applies a new configuration to an existing replica set.(a) replSetReconfig(b) replSetMaintenance(c) replSetStepDown(d) all of the mentionedThe question was posed to me by my school teacher while I was bunking the class.My doubt stems from Troubleshooting topic in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT CHOICE is (a) replSetReconfig

The EXPLANATION: The replSetReconfig command MODIFIES the configuration of an EXISTING replica set.
13.

When enabled replSetMaintenance: true, the member enters the ________ state.(a) REPLICATING(b) RECOVERING(c) STALE(d) All of the mentionedThe question was asked in quiz.Asked question is from Troubleshooting in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right CHOICE is (b) RECOVERING

Explanation: The MEMBER is not ACCESSIBLE for READ operations.

14.

Point out the correct statement.(a) To affect the sync target for the initial sync, run rs.syn() operation before initial sync(b) If you run rs.syncFrom() during initial sync, MongoDB produces no error messages(c) replSetSyncFrom and rs.syncFrom() provide a permanent override of default behavior(d) All of the mentionedThe question was asked in my homework.Query is from Troubleshooting in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Correct option is (b) If you run rs.syncFrom() during initial sync, MongoDB produces no ERROR messages

The best I can explain: The sync TARGET falls more than 30 seconds behind ANOTHER member of the replica set; the mongod will REVERT to the default sync target.

15.

__________ enables or disables a maintenance mode, which puts a secondary node in a RECOVERING state.(a) replSetReconfig(b) replSetMaintenance(c) replSetStepDown(d) all of the mentionedThe question was asked in an interview for internship.My query is from Troubleshooting topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT answer is (b) replSetMaintenance

The explanation: The replSetMaintenance admin COMMAND ENABLES or disables the maintenance mode for a secondary member of a REPLICA SET.
16.

________ returns a document that reports on the status of the replica set.(a) replSetGetStatus(b) replSetFreeze(c) replSetInitiate(d) all of the mentionedThe question was posed to me in an international level competition.The doubt is from Troubleshooting topic in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct option is (a) replSetGetStatus

The best EXPLANATION: The replSetGetStatus command returns the status of the REPLICA set from the point of view of the CURRENT SERVER.

17.

_________ prevents the current member from seeking election as primary for a period of time.(a) replSetGetStatus(b) replSetFreeze(c) replSetInitiate(d) all of the mentionedThe question was asked in an interview.Query is from Troubleshooting in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Correct option is (B) replSetFreeze

Easiest explanation: The replSetFreeze COMMAND prevents a replica SET MEMBER from SEEKING election for the specified number of seconds.

18.

Point out the wrong statement.(a) Primary capture data from the primary member to maintain an up to date copy of the sets’ data(b) For some deployments, implementing a custom replication sync topology may be more effective than the default sync target selection logic(c) MongoDB provides the ability to specify a host to use as a sync target(d) None of the mentionedI have been asked this question in examination.This is a very interesting question from Troubleshooting in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right OPTION is (d) NONE of the mentioned

The explanation is: HOWEVER, by default SECONDARIES may automatically change their sync targets to secondary members based on changes in the ping time between members and the state of other members’ replication.

19.

You can use the ________ setting in Replica Set Configuration to disable chained replication for situations where chained replication is causing lag.(a) chainingAllowed(b) chainingDisAllowed(c) chainingAllow(d) none of the mentionedI got this question in an online quiz.I'd like to ask this question from Replication Maintenance in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct OPTION is (a) chainingAllowed

Easy EXPLANATION: MongoDB enables CHAINED replication by DEFAULT.

20.

You cannot use a _________backup for the data files, only a snapshot backup.(a) mongorestore(b) mongodump(c) bsondump(d) rs.syncFrom()The question was posed to me during an online interview.I need to ask this question from Replication Maintenance topic in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct option is (B) mongodump

Easiest explanation: If COPYING DATA files, you must COPY the content of the local database.

21.

A replica set member becomes _________ when its replication process falls so far behind that the primary overwrites oplog entries the member has not yet replicated.(a) stale(b) state(c) dead(d) secondaryI have been asked this question in quiz.My question is from Replication Maintenance in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct CHOICE is (a) stale

Best explanation: When this OCCURS, you MUST completely resynchronize the member by removing its data and performing an INITIAL sync.

22.

During initial sync, mongod will remove the content of the _______(a) dbPathSync(b) Path(c) dbPath(d) none of the mentionedThis question was addressed to me in an internship interview.My query is from Replication Maintenance topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct CHOICE is (C) dbPath

To EXPLAIN: You can also force a mongod that is already a member of the set to perform INITIAL sync by restarting the instance WITHOUT the content of the dbPath.

23.

Point out the correct statement.(a) Replica sets allow a MongoDB deployment to remain available during the majority of a maintenance window(b) Always start mongod with the same user, even when restarting a replica set member as a standalone instance(c) The secondary takes time to catch up to the primary(d) All of the mentionedI had been asked this question by my college director while I was bunking the class.I need to ask this question from Replication Maintenance topic in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right choice is (d) All of the mentioned

Easy explanation: From the MONGO shell, use the rs.status() command to verify that the MEMBER has caught up from the RECOVERING STATE to the SECONDARY state.

24.

You also can force a member never to become primary by setting its priority value to ___________(a) 1(b) 2(c) 3(d) 0The question was asked by my school teacher while I was bunking the class.My question comes from Replication Maintenance topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct option is (d) 0

To explain I would say: You can FORCE a REPLICA SET member to BECOME primary by giving it a higher priority VALUE than any other member in the set.

25.

To finish the rolling maintenance operation, step down the primary with the _________ method.(a) rs.syncFrom()(b) rs.stepDown()(c) rs.synchrepl()(d) secondaryThis question was posed to me in an international level competition.My enquiry is from Replication Maintenance topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT option is (b) rs.stepDown()

EASY explanation: The REPLICA set member will recover and “catch up” before it is eligible for election to primary.
26.

Replication _______ is a delay between operation on the primary and the application of that operation from the oplog to the secondary.(a) lag(b) delay(c) latency(d) none of the mentionedI had been asked this question in my homework.My doubt stems from Replication Processes topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The CORRECT choice is (a) lag

Best EXPLANATION: Replication lag can be a SIGNIFICANT ISSUE and can seriously affect MongoDB replica SET deployments.

27.

Point out the wrong statement.(a) To change the size of the oplog, you must perform maintenance on each member of the replica set in turn(b) Always start rolling replica set maintenance with the secondaries, and finish with the maintenance on primary member(c) The oplog exists internally as a capped collection(d) None of the mentionedI have been asked this question in an interview for internship.Question is from Replication Maintenance topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right CHOICE is (d) None of the mentioned

For explanation I would say: In most CASES the default OPLOG size is an acceptable size; however, in some situations you may NEED a larger or smaller oplog.

28.

_________ shut down the mongod instance for one of the non-primary members of your replica set.(a) db.shutdown()(b) db.shutdownServer()(c) db.shutServer()(d) all of the mentionedI got this question during an interview.I want to ask this question from Replication Maintenance topic in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct answer is (b) db.shutdownServer()

For explanation I WOULD say: Restart this MONGOD as a standalone INSTANCE running on a DIFFERENT port and without the –replSet PARAMETER.

29.

When ______________ is true, the mongod instance saves all documents migrated from the shard to the moveChunk directory of the storage.dbPath.(a) sharding.archiveChunks(b) sharding.archiveMovedChunks(c) shards.archiveMovedChunks(d) rs.syncFrom()This question was addressed to me during an internship interview.This key question is from Replication Processes in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The CORRECT choice is (B) sharding.archiveMovedChunks

Easiest EXPLANATION: MONGODB does not delete data stored in MOVECHUNK.

30.

Secondaries apply operations from the primary asynchronously to provide __________ consistency.(a) strict(b) strong(c) eventual(d) none of the mentionedThis question was posed to me in unit test.Asked question is from Replication Processes in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right OPTION is (C) eventual

To explain: In a replica set, the set can have at most one primary and only the primary can ACCEPT WRITE OPERATIONS.

31.

For a member to sync from another, both members must have the same value for the _________ setting.(a) buildIndexes(b) getIndexes(c) buildpriIndexes(d) secondaryThis question was addressed to me in my homework.I want to ask this question from Replication Processes in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right ANSWER is (a) buildIndexes

Explanation: Beginning in VERSION 2.2, secondaries AVOID syncing from delayed members and HIDDEN members.

32.

Use _________ from a secondary member and the replication status output to assess the current state of replication.(a) db.getReplInfo()(b) db.getReplicationInfo()(c) rs.printReplicationInfo()(d) none of the mentionedThis question was addressed to me by my college professor while I was bunking the class.Asked question is from Replication Processes in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» RIGHT option is (b) db.getReplicationInfo()

For explanation I WOULD SAY: This will determine if there is any UNINTENDED replication DELAY.
33.

Point out the correct statement.(a) To facilitate replication, all replica set members send heartbeats (pings) to all other members(b) For proper replication operations, entries in the oplog must be idempotent(c) Any member can import oplog entries from any other member(d) All of the mentionedThe question was asked in an interview.My enquiry is from Replication Processes topic in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct answer is (b) For proper REPLICATION operations, entries in the oplog MUST be idempotent

The EXPLANATION is: When you start a replica set member for the FIRST time, MongoDB creates an oplog of a default size.

34.

The oplog must translate multi-updates into individual operations in order to maintain ____________(a) availability(b) idempotency(c) scalability(d) secondaryI got this question during an internship interview.The question is from Replication Processes topic in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right option is (B) idempotency

Easiest explanation: This can use a great deal of OPLOG SPACE without a corresponding INCREASE in data size or disk use.

35.

Before mongod creates an oplog, you can specify its size with the __________ option.(a) oplogSizeMB(b) oplogSizeGB(c) opSizeMB(d) all of the mentionedThis question was posed to me in exam.This interesting question is from Replication Processes topic in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right choice is (a) oplogSizeMB

Best EXPLANATION: HOWEVER, after you have started a replica SET member for the first time, you can only change the size of the OPLOG using the Change the Size of the Oplog procedure.

36.

Point out the wrong statement.(a) The oplog is a special capped collection that keeps a rolling record of all operations that modify the data stored in your databases(b) MongoDB applies database operations on the primary and then records the operations on the primary’s oplog(c) The primary members then copy and apply these operations in an asynchronous process(d) None of the mentionedThe question was posed to me during an interview.I need to ask this question from Replication Processes topic in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Correct option is (c) The primary members then copy and apply these OPERATIONS in an asynchronous process

To explain I would SAY: All replica set members contain a copy of the OPLOG, in the local.oplog.rs COLLECTION, which ALLOWS them to maintain the current state of the database.

37.

rs.reconfig() provides a wrapper around the ___________ command.(a) replSetfinalReconfig(b) replSetReconfig(c) replSetReconfiguration(d) none of the mentionedThe question was posed to me during an interview for a job.This question is from Replication Processes topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The correct answer is (b) replSetReconfig

Easy explanation: The FORCE PARAMETER in reconfig method allows a reconfiguration command to be ISSUED to a non-primary NODE.

38.

__________ 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()I had been asked this question by my school teacher while I was bunking the class.I want to ask this question from Replication Processes in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right CHOICE is (d) rs.syncFrom()

The EXPLANATION is: 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.

39.

_________ 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 mentionedI had been asked this question in a job interview.Question is taken from Replication Processes topic in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT option is (a) rs.reconfig()

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().
40.

________ 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) secondaryI had been asked this question during an internship interview.Query is from Replication Processes in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT OPTION is (c) rs.printReplicationInfo()

Explanation: Typically you will use db.fsyncUnlock() FOLLOWING a database backup OPERATION.
41.

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 mentionedI got this question in homework.My question is based upon Replication Processes in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Right choice is (B) The output of rs.printReplicationInfo() is IDENTICAL to that of db.printReplicationInfo()

Explanation: The rs.printReplicationInfo() in the MONGO shell does not RETURN JSON.

42.

_________ prevents the current member from seeking election as primary for a period of time.(a) rs.freeze()(b) rs.conf()(c) rs.printReplicationInfo()(d) secondaryThe question was asked in an online interview.I need to ask this question from Replication Processes in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Correct CHOICE is (a) rs.freeze()

The best I can EXPLAIN: rs.freeze() makes the CURRENT replica set MEMBER ineligible to become primary for the period SPECIFIED.

43.

_________ returns the replica set configuration document.(a) rs.freeze()(b) rs.conf()(c) rs.printReplicationInfo()(d) none of the mentionedI have been asked this question during an interview.This interesting question is from Replication Processes in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The CORRECT answer is (b) rs.conf()

Easiest explanation: rs.conf() RETURNS a document that contains the current replica SET CONFIGURATION.

44.

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 mentionedThis question was posed to me in exam.My question is from Replication Processes topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The CORRECT choice is (C) rs.init() initializes a NEW REPLICA set

The explanation: rs.init() initializes a new replica set.

45.

Which of the following ddds an arbiter to a replica set?(a) rs.addArb()(b) rs.addArbiter()(c) rs.addtoArb()(d) all of the mentionedI had been asked this question during a job interview.My doubt stems from Replication Processes in section Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT answer is (a) rs.addArb()

To elaborate: rs.addArb() ADDS a NEW arbiter to an existing replica set.
46.

In sharded clusters, delayed members have limited utility when the __________ is enabled.(a) Balancer(b) Collector(c) Emitter(d) None of the mentionedI have been asked this question in an online quiz.The question is from Master Slave Replication in chapter Replication Concepts, Processes and Replication Set of MongoDB

Answer»

Correct choice is (a) Balancer

To EXPLAIN I WOULD say: Delayed members replicate chunk MIGRATIONS with a DELAY.

47.

Delayed members are a ________ or a running “historical” snapshot of the data set.(a) “rolling backup”(b) “roll backup”(c) “rolling commit”(d) none of the mentionedThis question was addressed to me in exam.My question comes from Master Slave Replication in portion Replication Concepts, Processes and Replication Set of MongoDB

Answer» RIGHT CHOICE is (a) “rolling backup”

BEST explanation: They MAY help you recover from various kinds of human error.
48.

Delayed members apply operations from the _______ on a delay.(a) oplog(b) log(c) mlog(d) none of the mentionedI had been asked this question at a job interview.My query is from Master Slave Replication in section Replication Concepts, Processes and Replication Set of MongoDB

Answer»

The CORRECT ANSWER is (a) oplog

Explanation: Always prevent APPLICATIONS from seeing and querying DELAYED members.

49.

________ unlocks a mongod instance to allow writes and reverses the operation of a db.fsyncLock() operation.(a) db.fsyncUnlock()(b) db.fsynclock()(c) db.syncUnlock()(d) secondaryI had been asked this question during an internship interview.I'd like to ask this question from Master Slave Replication topic in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT option is (a) db.fsyncUnlock()

For explanation I WOULD SAY: TYPICALLY you will use db.fsyncUnlock() following a database backup operation.
50.

Point out the correct statement.(a) In MongoDB, clients cannot see the results of writes before they are made durable(b) Users may configure read preference on a per-connection basis to prefer that the read operations return results from the secondary members(c) Clients cannot read data which may be subsequently rolled back(d) None of the mentionedThe question was asked in semester exam.My doubt stems from Master Slave Replication in division Replication Concepts, Processes and Replication Set of MongoDB

Answer» CORRECT ANSWER is (b) Users may configure read preference on a per-connection basis to prefer that the read operations RETURN results from the secondary members

The explanation is: If clients configure the read preference to permit secondary reads, read operations can return data from secondary members that have not replicated more RECENT write operations.