Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

MongoDB MCQ Set 1

1. Replica sets provide high availability using automatic ________
a) failover
b) replication
c) failure
d) all of the mentioned

View Answer

Answer: a [Reason:] Failover, in most situations does not require manual intervention.

2. Point out the wrong statement :
a) When the primary rejoins the set as a secondary, it reverts, or “rolls back,” its write operations to maintain database consistency with the other members
b) A rollback is necessary only if the primary had accepted write operations that the secondaries had not successfully replicated before the primary stepped down
c) MongoDB attempts for rollbacks, which should be rare
d) None of the mentioned

View Answer

Answer: c [Reason:] When a rollback does occur, it is often the result of a network partition.

3. Failover allows a ________ member to become primary if primary is unavailable.
a) Hidden
b) Primary
c) ViewState
d) Secondary

View Answer

Answer: d [Reason:] Replica set members keep the same data set but are otherwise independent.

4. Sometimes the failover process may require a ____________ during operation.
a) savepoint
b) rollback
c) commit
d) none of the mentioned

View Answer

Answer: b [Reason:] A rollback reverts write operations on a former primary when the member rejoins its replica set after a failover.

5. Point out the correct statement :
a) A rollback does not occur if the write operations replicate to another member of the replica set before the primary steps down
b) Secondaries that can not keep up with the throughput of operations on the former primary, decrease the size and impact of the rollback
c) Fault tolerance is an effect of replica set size, but the relationship is not direct
d) None of the mentioned

View Answer

Answer: a [Reason:] When a rollback does occur, administrators must decide whether to apply or ignore the rollback data.

6. MongoDB writes the rollback data to BSON files in the rollback/ folder under the database’s ________ directory.
a) dbPath
b) logPath
c) dataPath
d) all of the mentioned

View Answer

Answer: a [Reason:] The storage.dbPath setting is available only for mongod.

7. The names of rollback files have the following form:

a) <database>.<collection>.<timestamp>.bson.
b) <database>.<collection>.<tp>.bson.
c) <database>.<collection>.<timestamp>.json.
d) None of the mentioned

View Answer

Answer: a [Reason:] Administrators must apply rollback data manually after the member completes the rollback and returns to secondary status.

8. _________ is used to read the contents of the rollback files.
a) bsondumpdata
b) bsondp
c) bsondump
d) none of the mentioned

View Answer

Answer: c [Reason:] The bsondump converts BSON files into human-readable formats, including JSON.

9. Use ______ to apply the changes to the new primary after rollback.
a) mongostore
b) mongorestore
c) restore
d) none of the mentioned

View Answer

Answer: b [Reason:] The mongorestore program writes data from a binary database dump created by mongodump to a MongoDB instance.

10. mongorestore recreates indexes recorded by :
a) bsondump
b) mongodump
c) mongostore
d) all of the mentioned

View Answer

Answer: b [Reason:] The data format used by mongodump from version 2.2 or later is incompatible with earlier versions of mongod.

MongoDB MCQ Set 2

1. How many types of members exist in replica set ?
a) 1
b) 2
c) 3
d) 4

View Answer

Answer: b [Reason:] There are two members in replica set-primary and secondary.

2. Point out the wrong statement :
a) Replication provides scalability and increases data redundancy
b) A replica set in MongoDB is a group of mongod processes that provide redundancy and high availability
c) You can also maintain an arbiter as part of a replica set
d) None of the mentioned

View Answer

Answer: a [Reason:] Data redundancy is reduced by replicating the copies of data.

3. Which of the member receives all write operations ?
a) center
b) secondary
c) primary
d) none of the mentioned

View Answer

Answer: c [Reason:] The primary accepts all write operations from clients.

4. _________ replicate operations from the primary to maintain an identical data set.
a) center
b) secondary
c) primary
d) none of the mentioned

View Answer

Answer: b [Reason:] Secondaries may have additional configurations for special usage profiles.

5. Point out the wrong statement :
a) The minimum requirements for a replica set are: A primary, a secondary, and an arbiter
b) The primary is the only member in the replica set that receives write operations
c) Most deployments, however, will keep three members that store data: A primary and two secondary members
d) None of the mentioned

View Answer

Answer: d [Reason:] Secondary members replicate this oplog and apply the operations to their data sets.

6. _________ play a role in the elections that select a primary if the current primary is unavailable
a) Arbiters
b) Replicators
c) Loggers
d) None of the mentioned

View Answer

Answer: a [Reason:] Arbiters do not keep a copy of the data.

7. A replica set can have up to ______ members but only 7 voting members
a) 10
b) 30
c) 50
d) 70

View Answer

Answer: d [Reason:] In previous versions, replica sets can have up to 12 members.

8. Which of the following may be non-voting or priority 0 ?
a) center
b) secondary
c) primary
d) none of the mentioned

View Answer

Answer: b [Reason:] All members of the replica set can accept read operations.

9. If the current primary becomes unavailable, the replica set holds an ______ to choose which of the secondaries becomes the new primary.
a) election
b) replication
c) clasification
d) none of the mentioned

View Answer

Answer: a [Reason:] A secondary can become a primary.

10. By default, an application directs its ____ operations to the primary member.
a) read
b) write
c) read write
d) all of the mentioned

View Answer

Answer: a [Reason:] A replica set can have one or more secondaries.

MongoDB MCQ Set 3

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 [Reason:] 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 [Reason:] 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 [Reason:] 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 [Reason:] 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

Answer: a [Reason:] 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 [Reason:] 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

Answer: a [Reason:] 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 [Reason:] 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

Answer: a [Reason:] 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 [Reason:] 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.

MongoDB MCQ Set 4

1. _________ 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 mentioned

View Answer

Answer: b [Reason:] Restart this mongod as a standalone instance running on a different port and without the –replSet parameter.

2. 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 mentioned

View Answer

Answer: d [Reason:] In most cases the default oplog size is an acceptable size; however, in some situations you may need a larger or smaller oplog.

3. To finish the rolling maintenance operation, step down the primary with the _________ method
a) rs.syncFrom()
b) rs.stepDown()
c) rs.synchrepl()
d) secondary

View Answer

Answer: b [Reason:] The replica set member will recover and “catch up” before it is eligible for election to primary.

4. You also can force a member never to become primary by setting its priority value to :
a) 1
b) 2
c) 3
d) 0

View Answer

Answer: d [Reason:] You can force a replica set member to become primary by giving it a higher priority value than any other member in the set.

5. 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 mentioned

View Answer

Answer: d [Reason:] 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.

6. 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) secondary

View Answer

Answer: a [Reason:] When this occurs, you must completely resynchronize the member by removing its data and performing an initial sync.

7. During initial sync, mongod will remove the content of the _______.
a) dbPathSync
b) Path
c) dbPath
d) none of the mentioned

View Answer

Answer: c [Reason:] You can also force a mongod that is already a member of the set to to perform an initial sync by restarting the instance without the content of the dbPath.

8. You cannot use a _________backup for the data files, only a snapshot backup.
a) mongorestore
b) mongodump
c) bsondump
d) rs.syncFrom()

View Answer

Answer: b [Reason:] If copying data files, you must copy the content of the local database.

9. 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 mentioned

View Answer

Answer: a [Reason:] MongoDB enables chained replication by default.

10. For most replica sets, the hostnames in the _________ field never change.
a) tag
b) host
c) rs
d) none of the mentioned

View Answer

Answer: b [Reason:] Always use resolvable hostnames for the value of the host field in the replica set configuration to avoid confusion and complexity.

MongoDB MCQ Set 5

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

Answer: a [Reason:] 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

Answer: c [Reason:] 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

Answer: a [Reason:] 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

Answer: b [Reason:] 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

Answer: b [Reason:] 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

Answer: c [Reason:] 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

Answer: a [Reason:] 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

Answer: d [Reason:] 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

Answer: b [Reason:] 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

Answer: b [Reason:] Use readPref() and Mongo.setReadPref() to set read preference.