MongoDB Questions and Answers – Read and Write Semantics

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Read and Write Semantics”.

1. The __________ of a replica set affects the outcome of failover situations.
a) deployment
b) architecture
c) structure
d) all of the mentioned
View Answer

Answer: a
Explanation: To support effective failover, ensure that one facility can elect a primary if needed.

2. Point out the wrong statement.
a) Administrators must apply or discard rollback data manually
b) Network partitions could not prevent the set from being able to form a majority
c) Replica sets remove “rollback” data when needed without intervention
d) None of the mentioned
View Answer

Answer: b
Explanation: When a rollback does occur, it is often the result of a network partition.

3. A rollback reverts _______ operations on a former primary when the member rejoins the replica set after a failover.
a) read
b) write
c) view
d) secondary
View Answer

Answer: b
Explanation: The replica set recovers from the loss of a primary by holding an election.

4. A priority __ member is a secondary that cannot become primary.
a) 0
b) 1
c) 2
d) None of the mentioned
View Answer

Answer: a
Explanation: Priority 0 members cannot trigger elections.

advertisement
advertisement

5. Point out the correct statement.
a) Elections does not occur when the primary becomes unavailable and the replica set members autonomously select a new primary
b) A priority 1 member maintains a copy of the data set, accepts read operations, and votes in elections
c) In a two-member replica set, in one data center hosts the primary and a secondary.
d) None of the mentioned
View Answer

Answer: a
Explanation: Configure a priority 0 member to prevent secondaries from becoming primary, which is particularly useful in multi-data center deployments.

6. A second data center hosts one priority 0 member that cannot become ___________
a) primary
b) write
c) view
d) Secondary
View Answer

Answer: a
Explanation: A priority 0 member can function as a standby.

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

7. A ______ member maintains a copy of the primary’s data set but is invisible to client applications.
a) primary
b) delayed
c) hidden
d) none of the mentioned
View Answer

Answer: c
Explanation: Hidden members are good for workloads with different usage patterns from the other members in the replica set.

8. The db.________ method does not display hidden members.
a) isPrima ry()
b) isMaster()
c) Master()
d) none of the mentioned
View Answer

Answer: b
Explanation: Hidden members, however, may vote in elections.

advertisement

9. In a sharded cluster _______ do not interact with hidden members.
a) mongod
b) mongos
c) mongostore
d) all of the mentioned
View Answer

Answer: b
Explanation: Clients will not distribute reads with the appropriate read preference to hidden members.

Sanfoundry Global Education & Learning Series – MongoDB.

advertisement

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.