Courseiva

CCNA Application Administration Questions

27 questions · Application Administration · All types, answers revealed

1
MCQmedium

An application uses a compound index on `{ 'status': 1, 'priority': -1 }`. Which query will efficiently use this index?

A.db.tasks.find({ 'priority': 5 })
B.db.tasks.find({ 'status': 'open' })
C.db.tasks.find({ 'created': '2023-01-01' })
D.db.tasks.find({ 'status': 'open', 'type': 'urgent' })
AnswerB

Since the query filters by the leading field in the compound index ('status'), it can perform an index scan. This allows the database to quickly narrow down the result set without scanning every document in the collection, leading to significantly better performance for the application's read operations.

Why this answer

Compound indexes are ordered. A query will only use the index if the query filter matches the prefix of the indexed fields. Here, the index starts with 'status'.

Therefore, queries filtering on 'status' and optionally 'priority' will be efficient. Understanding index prefixing is crucial for DBAs to ensure that developers write efficient queries that fully leverage the index structures, avoiding unnecessary collection scans and keeping performance stable as the data grows.

Exam trap

Candidates often think an index on fields B and C can be used when querying only field C, ignoring the strict left-to-right prefix rule of compound indexes.

2
MCQhard

Refer to the exhibit. What is the primary cause of the performance issue seen in this query plan?

A.The query is hitting the primary index limit.
B.The query requires a full collection scan.
C.The query is being blocked by a write lock.
D.The database is out of memory.
AnswerB

The presence of 'COLLSCAN' in the execution statistics proves that the query engine is reading every document in the collection to find a match. This is the most expensive operation in MongoDB and confirms that the current query filters do not have an associated index to speed up retrieval.

Why this answer

The exhibit shows a 'COLLSCAN', which indicates the database is scanning every document in the collection to satisfy the query. With 500,000 scanned documents returned for a single result, the query is severely inefficient. This demonstrates a lack of a supporting index, leading to high CPU and I/O usage.

Identifying these inefficient queries is vital for DBAs to prevent application-wide slowdowns caused by resource exhaustion on the primary database node.

Exam trap

Candidates frequently misinterpret 'COLLSCAN' as a network latency issue rather than recognizing it as a fundamental lack of an appropriate index for the query filter.

3
MCQhard

Refer to the exhibit. An aggregation pipeline is failing with an error. How can you modify the pipeline to allow it to process the large dataset?

A.Set 'allowDiskUse' to true in the aggregation options.
B.Increase the RAM allocated to the mongod process configuration.
C.Remove the $group stage and perform the grouping in application code.
D.Reduce the batch size in the cursor options.
AnswerA

The allowDiskUse option explicitly authorizes the aggregation pipeline to write temporary data to the _tmp directory on the server disk when the memory limit is reached. This enables processing of datasets that exceed 100MB of RAM, effectively resolving the memory limit error.

Why this answer

The error indicates that the group operation is exceeding the 100MB RAM limit. By setting 'allowDiskUse: true', you permit the MongoDB server to use temporary files for the aggregation process. This is a common requirement for complex analytics where the data working set is larger than the available RAM, ensuring that long-running operations can complete successfully without crashing due to memory exhaustion.

Exam trap

Students often try to solve memory limit aggregation errors by scaling up server RAM instead of using the native pipeline configuration option meant for temporary storage.

4
MCQeasy

Which connection string parameter should be used to ensure an application driver automatically discovers all members of a replica set?

A.maxPoolSize
B.replicaSet
C.wtimeoutMS
D.readPreference
AnswerB

The replicaSet parameter instructs the MongoDB driver to monitor the state of the entire replica set cluster. By providing the replica set name, the driver can verify it is connecting to the correct cluster and discover all hidden, secondary, and primary nodes based on the initial seed list provided.

Why this answer

The replicaSet parameter is essential for drivers to identify the cluster name and initiate the discovery process. When this parameter is specified, the driver uses the provided seed list to perform a 'isMaster' command against the nodes, allowing it to map the entire topology. Understanding this mechanism is vital for ensuring high availability, as the driver needs to dynamically redirect operations to the new primary during automated failover events.

Exam trap

Candidates often select authentication or timeout parameters like 'connectTimeoutMS', wrongly believing they control how a driver discovers cluster topology.

5
MCQmedium

What is the primary function of the 'wtimeout' setting in write concern?

A.It sets the maximum time a query can run before being killed.
B.It specifies the duration to wait for replica set acknowledgment.
C.It limits the number of write retries in the driver.
D.It defines the connection timeout for new sessions.
AnswerB

wtimeout specifies how long the primary should wait for the required number of replica set members to acknowledge the write operation. If the acknowledgment does not occur within this duration, the primary returns an error to the client, preventing the application from hanging indefinitely during cluster failures.

Why this answer

The 'wtimeout' parameter prevents a write operation from blocking indefinitely if the specified replica set members cannot acknowledge the write. This is a critical safety mechanism for application availability. If a network partition occurs or a node goes offline, the application will receive an error after the timeout, allowing it to handle the failure gracefully instead of hanging the application thread and exhausting the connection pool, which could lead to cascading service outages.

Exam trap

Candidates often believe 'wtimeout' is a performance setting to speed up queries, rather than a safety setting to prevent application threads from hanging indefinitely.

6
MCQmedium

Which mechanism ensures an application receives an error if a write is not persisted to the majority of nodes in a replica set?

A.Setting the read concern to 'majority'.
B.Setting the write concern to 'w: majority'.
C.Enabling the 'journal' option on all members.
D.Using the 'majority' read preference.
AnswerB

A write concern of 'w: majority' blocks the application thread until the write is acknowledged by the majority of the replica set members. If the write cannot reach this threshold, the database returns an error to the driver, allowing the application to implement appropriate retry or compensation logic to handle failures.

Why this answer

The 'majority' write concern provides a guarantee that the write operation has been committed to a majority of the replica set members. This is the industry standard for ensuring data durability in the event of a primary node failover. DBAs must enforce this setting for critical business data to prevent 'lost updates' where an application assumes a write is permanent when it actually exists only on the primary that is about to crash.

Exam trap

Students frequently select read preference or journaling parameters, confusing the mechanism for confirming writes across nodes with local disk journaling.

7
MCQmedium

A development team is building a Node.js application that connects to a MongoDB replica set. They want the driver to automatically retry certain write operations once if they fail due to a transient network error, without requiring custom retry logic in their code. Which connection string option should they enable?

A.w=majority
B.retryWrites=true
C.readPreference=primaryPreferred
D.connectTimeoutMS=30000
AnswerB

Setting retryWrites=true in the connection string enables the driver to automatically retry supported write operations exactly once if they encounter a retryable error, such as a network blip. This meets the team's requirement without custom code and is supported by MongoDB drivers for replica sets and sharded clusters.

Why this answer

The retryWrites=true connection string option instructs the MongoDB driver to automatically retry supported write operations once if they fail with a retryable error. This offloads retry logic from the application code and is the standard way to handle transient network issues in replica sets. Other options affect write concern, read routing, or connection timeouts, but none provide automatic write retries.

Exam trap

The trap here is confusing write concern settings like w=majority with automatic retry behavior; w=majority ensures durability but does not make the driver retry failed writes.

8
MCQeasy

A database administrator wants to configure a read preference that directs all read operations to the primary node of a replica set, ensuring the most up-to-date data. Which read preference mode should be used?

A.primaryPreferred
B.primary
C.nearest
D.secondary
AnswerB

The "primary" read preference directs all read operations to the primary node of the replica set. This ensures that the application always reads the most current data, as the primary is the only node that accepts writes. It is the default read preference and is suitable when strong consistency is required.

Why this answer

The requirement is to always read the most up-to-date data, which is only guaranteed when reading from the primary. The "primary" read preference ensures that all reads are directed to the primary node. Other read preferences may read from secondaries, which can have stale data, or may fall back to secondaries if the primary is unavailable, violating the requirement.

Exam trap

The trap here is confusing "primaryPreferred" with "primary". "primaryPreferred" only reads from the primary when it is available; if the primary is down, it reads from secondaries, which may not have the latest data.

9
MCQeasy

An application needs to perform a series of reads and writes across multiple documents in two collections atomically. The deployment is a replica set running MongoDB 4.2. Which feature should the application use?

A.Multi-document transactions
B.Change streams with resume tokens
C.Capped collections with tailable cursors
D.GridFS for storing large documents
AnswerA

Multi-document transactions allow atomic reads and writes across multiple documents, collections, and databases in a replica set. They provide ACID guarantees for the entire transaction. Since the deployment is a replica set running MongoDB 4.2, multi-document transactions are supported and are the correct feature to achieve atomicity across multiple documents in two collections.

Why this answer

Multi-document transactions in MongoDB 4.2 on replica sets provide ACID guarantees across multiple documents and collections. They are the only feature listed that ensures a series of reads and writes across two collections are applied atomically. The other options are storage or streaming features that do not offer transactional atomicity.

Exam trap

The trap here is assuming that change streams or capped collections can provide atomicity, when they are designed for streaming or fixed-size storage, not for multi-document transactions.

10
MCQmedium

A financial application requires that read operations never return data that could later be rolled back, even if it means reading from a secondary. The application connects to a replica set with readPreference=secondary. Which read concern level should be used to guarantee that the data read has been acknowledged by a majority of replica set members and cannot be rolled back?

A.readConcern: { level: "local" }
B.readConcern: { level: "available" }
C.readConcern: { level: "majority" }
D.readConcern: { level: "linearizable" }
AnswerC

majority read concern ensures that the data returned has been acknowledged by a majority of replica set members and is therefore durable and cannot be rolled back. When combined with readPreference=secondary, it allows reading from a secondary while still providing the guarantee that the data is majority-committed. This matches the requirement to avoid rollback.

Why this answer

majority read concern guarantees that the data read has been acknowledged by a majority of replica set members, making it durable and not subject to rollback. It can be used with readPreference=secondary, allowing the application to read from secondaries while still ensuring that the data is majority-committed. linearizable is stronger but only works with primary reads.

Exam trap

The trap here is assuming that linearizable read concern can be used with secondary reads, when in fact it is restricted to primary reads only.

11
MCQmedium

An application is using a capped collection for logging. What happens when the collection reaches its configured size limit?

A.The collection automatically expands to accommodate new data.
B.The database throws a 'CollectionFull' error for new inserts.
C.The oldest documents are overwritten by new inserts.
D.All existing documents are deleted to free up space.
AnswerC

Capped collections maintain a circular buffer structure. Once the defined size limit or maximum document count is reached, the database automatically removes the oldest documents to make space for incoming data. This process is seamless and allows the application to maintain a constant, manageable storage footprint for its data.

Why this answer

Capped collections follow a 'first-in, first-out' pattern where the oldest documents are automatically overwritten to maintain the specified size. This fixed-size behavior ensures that logging collections do not consume infinite disk space, which is critical for system stability. Application administrators must account for this behavior when designing log management, as it prevents the need for manual cleanup scripts while ensuring the database only retains the most recent relevant operational data for the application.

Exam trap

Candidates frequently mistake capped collections for fixed-size files that stop accepting writes once full. They fail to realize the database automatically overwrites the oldest data to maintain the limit.

12
MCQeasy

An application needs to update a user's balance. Which method ensures the operation is atomic for a single document?

A.Read the document, update the value in application code, and save the document.
B.Use the $inc operator with the updateOne method.
C.Wrap the operation in a multi-document transaction every time.
D.Use a global application-level mutex lock before updating.
AnswerB

The $inc operator performs an atomic increment on the server side. Because it is an atomic operation on a single document, it guarantees consistency even under high concurrency, making it the standard and safest method for updating numeric fields like balances in an application.

Why this answer

Atomic updates are a cornerstone of MongoDB's document model. Using update operators like $inc ensures that the update is performed in a single, atomic step at the document level. This prevents race conditions where two threads might attempt to update the same balance simultaneously, ensuring that data integrity is maintained without the need for manual locking mechanisms in the application layer.

Exam trap

Many candidates incorrectly choose findAndModify or multi-document transactions when asked for the simplest atomic operation on a single document, missing the efficiency of updateOne with operators.

13
MCQhard

An application uses a MongoDB driver that supports retryable writes. A write operation is sent to the primary, which applies the write but crashes before sending the acknowledgment. The driver receives a network error. What will the driver do by default?

A.Retry the write indefinitely until it succeeds.
B.Retry the write but with write concern 0 to avoid another failure.
C.Return the error to the application without retrying.
D.Retry the write once, and the server will deduplicate it using the transaction number.
AnswerD

Retryable writes allow the driver to automatically retry a write operation once if it encounters a retryable error, such as a network error. The driver includes a transaction number and session ID, so the server can detect that the retry is the same operation and will not apply it twice. This ensures exactly-once semantics for the write. The driver will retry the write once by default.

Why this answer

Retryable writes automatically retry a write operation once on retryable errors. The driver uses a transaction number and session ID so the server can deduplicate the retry, ensuring the write is applied exactly once. The driver does not retry indefinitely, does not skip retrying, and does not alter the write concern.

The correct behavior is a single retry with deduplication.

Exam trap

The trap here is thinking that retryable writes retry indefinitely or not at all, when in fact they retry exactly once by default using a transaction number for deduplication.

14
MCQmedium

Which MongoDB feature allows an application to receive real-time updates when data changes in a collection?

A.Capped collections
B.Database Profiler
C.Change Streams
D.GridFS
AnswerC

Change Streams allow applications to subscribe to a collection or database and receive notifications whenever a change occurs. This feature is built on top of the oplog and provides a robust, scalable way to implement event-driven architectures, ensuring that the application can react to data changes as they happen.

Why this answer

Change Streams provide an event-driven way for applications to react to data modifications in real time without polling the database. By using the aggregation framework, applications can filter for specific events like inserts, updates, or deletes. This is vital for modern microservices architectures, as it allows downstream systems to keep their caches or search indexes synchronized with the primary data store immediately after a write occurs.

Exam trap

Test-takers frequently confuse Change Streams with regular polling mechanisms or database triggers, failing to realize Change Streams use the aggregation framework for real-time reactive updates.

15
MCQhard

A MongoDB application requires that reads never see data that could be rolled back, even in the event of a replica set failover. The application also needs to read from secondary nodes to distribute load. Which read concern should be used with a secondary read preference?

A."majority"
B."linearizable"
C."available"
D."local"
AnswerA

"majority" read concern ensures that the data returned has been acknowledged by a majority of replica set members. When used with a secondary read preference, it guarantees that the data read from the secondary is durable and cannot be rolled back during failover. This meets the application's requirement of never seeing rollback-able data.

Why this answer

The application needs to read from secondaries while ensuring that the data returned is not subject to rollback. "majority" read concern guarantees that the data has been acknowledged by a majority of replica set members, making it durable across failover. It is compatible with secondary read preferences, unlike "linearizable", which requires primary reads. Therefore, "majority" is the correct choice.

Exam trap

The trap here is thinking that "linearizable" is the only read concern that prevents rollback, but it cannot be used with secondary reads. "majority" read concern also prevents rollback and works with secondaries.

16
MCQmedium

An application uses a time-series collection. What is the benefit of using the TTL (Time-To-Live) index feature?

A.It automatically creates a new collection for every time period.
B.It ensures data is compressed automatically to save disk space.
C.It allows the database to remove documents based on a timestamp field.
D.It prevents duplicate documents from being inserted into the collection.
AnswerC

A TTL index enables the background removal of documents after a specified number of seconds. This automates data lifecycle management by deleting expired records based on a date-typed field, keeping the collection size manageable without requiring custom application code or manual deletion scripts.

Why this answer

TTL indexes provide an automated mechanism for cleaning up expired data. By setting a TTL index on a date field, MongoDB periodically removes documents that exceed the defined age, which is essential for managing storage and keeping the database size under control in time-series workloads. This reduces administrative manual cleanup tasks and ensures the system maintains a consistent performance level by pruning old, irrelevant data automatically.

Exam trap

Candidates often think TTL indexes are used for query performance optimization, when their primary purpose is strictly data lifecycle management and automated record deletion.

17
MCQmedium

A developer is using the MongoDB Node.js driver and wants to ensure that a write operation is acknowledged by a majority of replica set members and is also written to the on-disk journal before returning success. Which write concern should be specified?

A.{ w: 2, j: true }
B.{ w: 1, j: true }
C.{ w: "majority", j: true }
D.{ w: "majority", j: false }
AnswerC

This write concern combines majority acknowledgment with journaling. The w: "majority" ensures that a majority of replica set members have applied the write, and j: true ensures that the write is committed to the on-disk journal on those members. This provides the highest level of durability and meets the developer's requirement.

Why this answer

The developer needs both majority acknowledgment and journaling. The write concern { w: "majority", j: true } ensures that a majority of replica set members have applied the write and that it has been written to the on-disk journal on those members. This provides the strongest durability guarantee, preventing data loss even if the primary crashes.

Other options either lack majority acknowledgment or journaling.

Exam trap

The trap here is assuming that w:2 is always equivalent to majority, but in replica sets with more than three voting members, w:2 is not a majority. Only w:"majority" dynamically calculates the majority based on the number of voting members.

18
MCQmedium

A MongoDB DBA is configuring a new application to connect to a sharded cluster. The application requires that reads are distributed across shards and that the driver automatically routes queries to the appropriate shard based on the shard key. Which component must be included in the connection string to enable this routing?

A.The config server replica set hostnames and ports.
B.The replica set name of the shards.
C.The mongos router hostname and port.
D.The shard replica set hostnames and ports.
AnswerC

In a sharded cluster, mongos routers are responsible for routing queries to the appropriate shards based on the shard key. The application must connect to mongos instances; the driver does not perform shard routing itself. Including the mongos hostname and port in the connection string ensures queries are correctly routed.

Why this answer

In a sharded cluster, applications must connect to mongos routers, which are responsible for routing queries to the appropriate shards based on the shard key. The connection string should include the hostnames and ports of mongos instances. Connecting directly to config servers or shards bypasses the routing layer and is not supported for application traffic.

Exam trap

The trap here is thinking that connecting directly to shards or config servers will enable automatic routing; only mongos provides that functionality.

19
MCQmedium

An application is performing many updates to a document. Which strategy is most effective to avoid fragmentation in the data files?

A.Use the 'compact' command during peak traffic hours.
B.Add padding to the documents to accommodate future growth.
C.Disable the WiredTiger cache periodically.
D.Perform a collection scan after every update.
AnswerB

Adding padding (extra space) to a document ensures that it has room to grow without needing to be relocated on disk. This significantly reduces fragmentation in the data files caused by document moves, which is a key requirement for maintaining high update performance in MongoDB collections.

Why this answer

Document growth is a primary cause of fragmentation in MongoDB collections. When a document grows and no longer fits in its current location on disk, it must be moved to a new location. By pre-allocating space or using an embedding strategy that keeps documents within a predictable size range, administrators can reduce the frequency of document moves, thereby minimizing disk fragmentation and maintaining long-term database performance.

Exam trap

Candidates frequently suggest defragmentation utilities similar to traditional relational databases, ignoring that MongoDB requires document padding or schema redesign to prevent movement overhead.

20
MCQhard

A database administrator is configuring a MongoDB replica set. The application requires that writes are acknowledged by a majority of voting members before being considered successful, and that the write is also written to the on-disk journal before acknowledgment. Which write concern specification achieves this?

A.{ w: 1, j: true }
B.{ w: "majority", j: false, wtimeout: 5000 }
C.{ w: "majority", j: true }
D.{ w: "majority", j: false }
AnswerC

This write concern requires acknowledgment from a majority of voting members (w: "majority") and also requires that the write be written to the on-disk journal (j: true) before returning success. This matches the requirement exactly: majority acknowledgment plus journaling. It provides strong durability and is suitable for critical data.

Why this answer

The write concern { w: "majority", j: true } ensures that the write is acknowledged by a majority of voting members and that it is written to the on-disk journal before acknowledgment. This provides both durability and high availability. The other options either lack journaling or lack majority acknowledgment, or both.

Exam trap

The trap here is assuming that w: "majority" alone guarantees journaling, when in fact journaling must be explicitly enabled with j: true.

21
MCQmedium

A financial application must ensure that once a transaction is committed, the data will never be rolled back, even if the primary node crashes immediately after the write is acknowledged. Which write concern should be used?

A.{ w: 0 }
B.{ w: "majority" }
C.{ w: 2 }
D.{ w: 1 }
AnswerB

A write concern of { w: "majority" } ensures that the write is acknowledged by a majority of voting members in the replica set. This means the write is durable across failover because any new primary must be one of the members that acknowledged the write. Therefore, the write cannot be rolled back, satisfying the application's requirement.

Why this answer

The requirement is that committed data must never be rolled back, even if the primary crashes immediately after acknowledgment. Majority write concern guarantees that the write is acknowledged by a majority of voting members, so any newly elected primary will have the write. This prevents rollback during failover.

Other write concerns either provide weaker guarantees or no acknowledgment at all.

Exam trap

The trap here is assuming that any acknowledgment from a secondary (such as w:2) is enough to prevent rollback, but only majority write concern ensures that a majority of voting members have the write, which is necessary to prevent rollback during failover.

22
Multi-Selecthard

Which TWO of the following are essential for maintaining performance in a sharded cluster?

Select 2 answers
A.Selecting a shard key with high cardinality.
B.Hardcoding the shard primary in the application connection string.
C.Regularly monitoring and managing chunk splits.
D.Disabling the balancer during all business hours.
E.Using the same shard key for every collection in the database.
AnswersA, C

High cardinality ensures that data is evenly distributed across shards. A low cardinality key leads to large chunks that cannot be split, causing hotspots where specific shards receive a disproportionate amount of traffic, leading to performance degradation and uneven resource utilization across the cluster.

Why this answer

A well-chosen shard key is the most critical factor for even data distribution, while monitoring chunks ensures that data remains balanced across the cluster. If the shard key is poorly chosen, some shards may become bottlenecks (hotspots), while others remain underutilized. Proper chunk management prevents excessive migration and ensures that query routers (mongos) efficiently route requests to the appropriate shards, maintaining overall system stability and throughput.

Exam trap

Test-takers frequently select low cardinality fields like boolean status flags as good shard keys, completely misunderstanding how poor distribution creates severe cluster bottlenecks.

23
MCQeasy

When designing an application, what is the best practice for handling connection pools?

A.Create a new connection for every query.
B.Maintain a long-lived, singleton instance of the MongoClient.
C.Close the connection after every single write operation.
D.Set the connection pool size to zero.
AnswerB

A single MongoClient instance in an application acts as a connection pool. Sharing this instance across the application enables efficient reuse of existing connections, which reduces latency and database load. This is the recommended practice for all production applications to ensure stability and high performance when interacting with MongoDB.

Why this answer

Maintaining a single, long-lived connection pool instance in the application is the most efficient way to manage database connections. Repeatedly creating and destroying connections is extremely expensive, introducing unnecessary latency and resource overhead on both the application server and the database. Proper pool management is a core application administration task that ensures the database handles traffic gracefully without exhausting its maximum configured connection limit due to unnecessary connection churn from the client side.

Exam trap

Candidates often suggest creating a new connection for every request to ensure freshness. This ignores the massive performance overhead of repeated TCP handshakes and authentication on the database server.

24
MCQeasy

Which connection string parameter should be used to ensure that an application only reads data from nodes that are considered current and consistent?

A.readPreference=secondary
B.readPreference=primary
C.readPreference=nearest
D.readPreference=secondaryPreferred
AnswerB

Primary read preference forces all operations to go to the primary node, which is the source of truth for all writes. This guarantees the application reads the most recent, consistent data, preventing the issues associated with replication lag that occur when reading from secondary members.

Why this answer

Read preference settings dictate where the application directs its read operations. Using 'primary' ensures that the application always reads the most recent data, avoiding the latency issues inherent in replication lag. This is critical for applications that require strong consistency and cannot tolerate reading stale data, such as financial transactions or inventory management systems, where data accuracy is paramount.

Exam trap

Candidates often confuse 'primary' read preference with 'nearest' or 'primaryPreferred', failing to realize that 'primary' is the only setting that guarantees reading the most current data.

25
MCQeasy

What is the purpose of the 'write concern' in MongoDB?

A.To specify which primary node the write should be directed to.
B.To define the durability and replication requirements for a write.
C.To encrypt the data being written to the database.
D.To automatically compress the data before it reaches the disk.
AnswerB

Write concern allows developers to configure how many replica set members must acknowledge a write before it is considered successful. This provides fine-grained control over durability and consistency, enabling developers to trade off between write performance and the level of data safety they require.

Why this answer

Write concern determines the level of acknowledgement requested from the database for write operations. It is a critical setting for balancing performance against data durability. By choosing the right write concern, developers can ensure that their application meets its specific data safety requirements, whether that means waiting for confirmation from a single node or guaranteeing that the write has been replicated across a majority of the cluster nodes.

Exam trap

Candidates often confuse write concern with read concern, mistakenly believing it dictates how data is retrieved from secondaries rather than acknowledging how the primary confirms the write operation.

26
MCQeasy

Which read concern provides the strongest consistency guarantee by ensuring the data returned has been acknowledged by a majority of the replica set?

A.local
B.available
C.majority
D.snapshot
AnswerC

The 'majority' read concern ensures that the returned data is committed to a majority of the replica set, preventing reads of data that could be rolled back. It is the best choice for ensuring strong consistency in a distributed system, even if it introduces slightly more latency than lower-consistency levels.

Why this answer

The 'majority' read concern guarantees that the data read has been committed to a majority of the replica set members, ensuring that the read will not be rolled back after a failover. This is essential for applications requiring strong consistency, such as financial systems. DBAs must guide developers on when to trade off performance for this level of consistency to ensure the application behaves correctly under all possible cluster failure scenarios.

Exam trap

Test-takers often confuse read concern 'majority' with write concern 'majority', or assume it guarantees absolute real-time synchronization across all globally distributed nodes.

27
MCQeasy

Which read preference allows the application to read from the closest member of the replica set to minimize network latency?

A.primaryPreferred
B.secondary
C.nearest
D.secondaryPreferred
AnswerC

The nearest read preference selects the replica set member with the lowest network latency. This is the ideal setting for applications that prioritize low response times above data consistency, especially in multi-region deployments where connecting to the primary node might introduce significant network delay for the end-user application.

Why this answer

The 'nearest' read preference is specifically designed to reduce latency by targeting the node with the lowest network round-trip time. This is highly effective for global deployments where applications are distributed across regions. Understanding read preferences is fundamental for application administration, as it allows developers to influence traffic distribution and resource utilization across the replica set, ensuring the application remains responsive even when the primary node is geographically distant from the client.

Exam trap

Many confuse 'nearest' with 'primaryPreferred', mistakenly believing nearest prioritizes data freshness over network latency, or vice versa.

Ready to test yourself?

Try a timed practice session using only Application Administration questions.