MongoDB MCQs – Replication

11.) What is a hidden node in a replica set?

A) A node that is not visible to the application
B) A node that stores encrypted data
C) A node that handles only write operations
D) A node that does not participate in replication

Answer: Option A

Explanation: A hidden node is not visible to the application and is typically used for reporting or backup purposes.

12.) Which command is used to check the status of a replica set?

A) rs.info()
B) rs.check()
C) rs.status()
D) rs.health()

Answer: Option C

Explanation: The rs.status() command provides detailed information about the replica set, including the state of each member, replication lag, and other important metrics.

13.) What is the default priority of a secondary node in a replica set?

A) 0
B) 1
C) 2
D) 10

Answer: Option B

Explanation: The default priority of a secondary node is 1, which means it can be elected as primary.

14.) What is the role of a delayed secondary node?

A) To speed up replication
B) To act as an arbiter
C) To handle write operations
D) To delay replication for disaster recovery purposes

Answer: Option D

Explanation: A delayed secondary node intentionally lags behind the primary to provide a recovery window in case of errors.

15.) Which of the following is true about the votes property in a replica set?

A) It determines the storage capacity of a node
B) It determines whether a node can vote in elections
C) It determines the read preference of a node
D) It determines the write concern of a node

Answer: Option B

Explanation: The votes property determines whether a node can participate in elections.

16.) What is the purpose of the priority property in a replica set?

A) To determine the likelihood of a node becoming primary
B) To determine the storage capacity of a node
C) To determine the read preference of a node
D) To determine the write concern of a node

Answer: Option A

Explanation: The priority property determines the likelihood of a node being elected as primary.

17.) What is the default write concern in a replica set?

A) {w: 1}
B) {w: 2}
C) {w: “majority”}
D) {w: “all”}

Answer: Option A

Explanation: The default write concern is {w: 1}, which means the write is acknowledged by the primary node.

18.) What is the purpose of the rs.slaveOk() command?

A) To enable writes on secondary nodes
B) To allow reads from secondary nodes
C) To initiate a replica set
D) To configure an arbiter

Answer: Option B

Explanation: The rs.slaveOk() command allows reads from secondary nodes.

19.) What is the maximum replication lag allowed for a secondary node to participate in elections?

A) 10 seconds
B) 30 seconds
C) 60 seconds
D) 120 seconds

Answer: Option C

Explanation: A secondary node must not lag behind the primary by more than 60 seconds to participate in elections.

20.) Which of the following is true about read preferences in a replica set?

A) They determine the write concern
B) They determine where reads are directed (primary or secondary)
C) They determine the storage engine
D) They determine the election process

Answer: Option B

Explanation: Read preferences determine whether reads are directed to the primary or secondary nodes.

Leave a Reply

Your email address will not be published. Required fields are marked *