MongoDB C100DBA Practice Test Questions and Exam Dumps Part2 Q21-40

View Full MongoDB C100DBA Exam Dumps and Practice Test Dumps

 

Question 21

Which MongoDB feature controls acknowledgment of write operations?

  1. Read preference
  2. Read concern
  3. Retryable reads
  4. Write concern

Correct Answer: 4

Explanation:

Write concern controls the level of acknowledgment MongoDB provides for write operations. It can specify whether a write must be acknowledged by the receiving server, by a required number of replica set members, or according to a journal-related requirement. Choosing an appropriate write concern involves balancing durability, availability, and performance requirements. Stronger acknowledgment requirements can increase write latency, while weaker settings may allow faster operations with different durability characteristics. Database administrators should select write concern according to application requirements rather than applying the same setting to every workload.

Question 22

Which setting controls where MongoDB reads are directed in a replica set?

  1. Read preference
  2. Write concern
  3. Journaling
  4. Authentication

Correct Answer: 1

Explanation:

Read preference determines which replica set members a client may use for read operations. Depending on the configured mode, reads can be directed primarily to the primary, to secondary members, or according to specific availability rules. This setting can help applications balance workload or use secondary members for particular read patterns. However, reading from secondaries can introduce replication lag and therefore potentially return data that is not as current as data on the primary. Administrators should select read preference based on application consistency and latency requirements.

Question 23

Which concept describes delayed updates on a secondary member?

  1. Query starvation
  2. Replication lag
  3. Index fragmentation
  4. Connection drift

Correct Answer: 2

Explanation:

Replication lag occurs when a secondary member falls behind the primary in applying replicated operations. A small amount of lag can be normal, but sustained or increasing lag may indicate resource constraints, network problems, workload pressure, or other operational issues. Significant lag can affect applications that read from secondary members and can also reduce the amount of recent data available on that member if a failure occurs. Monitoring replication lag is therefore an important administrative task when operating MongoDB replica sets.

Question 24

Which replica set member cannot become primary by design?

  1. Hidden member
  2. Delayed member
  3. Arbiter
  4. Secondary member

Correct Answer: 3

Explanation:

An arbiter participates in replica set elections by voting but does not store a copy of the replicated data and cannot become primary. Arbiters can be used in certain deployment configurations to provide an additional voting member when maintaining an odd number of votes is important. However, they do not provide data redundancy because they contain no replicated dataset. Administrators should carefully evaluate whether an arbiter is appropriate for the deployment because a data-bearing secondary often provides more useful redundancy and operational capability.

Question 25

What does replica set priority influence?

  1. Election preference
  2. Query projection
  3. Index ordering
  4. Collection validation

Correct Answer: 1

Explanation:

Replica set member priority influences which eligible members are preferred during elections. A member with higher priority can be preferred as a primary when election conditions permit. Administrators can use priority to influence which data-bearing member normally becomes primary, considering factors such as hardware capability, geographic placement, and operational requirements. Priority does not directly determine query filtering or index behavior. Changes to replica configuration should be planned carefully because elections can temporarily affect application connectivity and write availability.

Question 26

Which MongoDB feature prevents invalid document structures from being accepted?

  1. Query planner
  2. Schema validation
  3. Read preference
  4. Connection pooling

Correct Answer: 2

Explanation:

Schema validation allows administrators to define rules that documents must satisfy when they are inserted or modified. MongoDB remains flexible about document structure, but validation can enforce application-specific requirements such as required fields, data types, ranges, or other conditions. Validation is useful when an organization wants document flexibility while still maintaining important data-quality rules. Administrators should design validation rules carefully so legitimate application changes are not accidentally rejected. Validation complements application-level checks but provides an additional database-side control.

Question 27

Which BSON type is designed to store binary data?

  1. Decimal128
  2. Regular expression
  3. Binary data
  4. Timestamp

Correct Answer: 3

Explanation:

The BSON binary data type stores arbitrary binary information inside a MongoDB document. It can be used for application-specific binary content when storing such information directly in documents is appropriate. BSON supports several specialized data types beyond ordinary strings and numbers, allowing applications to represent different forms of structured information. Administrators should consider document size, access patterns, and storage requirements when deciding whether binary content belongs directly in MongoDB or should instead be stored using a dedicated file-storage approach.

Question 28

Which BSON type provides high-precision decimal arithmetic?

  1. Double
  2. Int32
  3. Decimal128
  4. Boolean

Correct Answer: 3

Explanation:

Decimal128 is a BSON numeric type designed for decimal floating-point values with high precision. It is particularly useful for applications where exact decimal representation is important, such as financial calculations. Standard binary floating-point types can introduce representation differences for some decimal values, making Decimal128 preferable when decimal precision is a key requirement. Administrators and developers should choose numeric types based on application semantics rather than simply using the smallest available representation. Correct data-type selection can prevent precision-related problems in stored and calculated values.

Question 29

Which operation changes an existing document while retaining the collection?

  1. updateOne()
  2. drop()
  3. dropDatabase()
  4. renameCollection()

Correct Answer: 1

Explanation:

The updateOne() method modifies a single document that matches the specified filter while leaving the collection itself intact. Update operations can use operators such as $set, $unset, $inc, and others to modify selected fields. The filter determines which document is targeted, so administrators should verify the filter carefully before executing an update against production data. Other operations such as drop() remove an entire collection. Understanding the distinction between document updates and destructive collection operations is essential for safe database administration.

Question 30

Which operator increments a numeric document field?

  1. $push
  2. $unset
  3. $inc
  4. $rename

Correct Answer: 3

Explanation:

The $inc update operator increases or decreases a numeric field by a specified amount. It is commonly used for counters, quantities, scores, and other values that change incrementally. For example, an application can use $inc to increase a login counter without first retrieving the document and calculating the new value in application code. Using the appropriate update operator can simplify operations and reduce unnecessary round trips. Administrators should ensure that the target field contains a compatible numeric value when applying $inc.

Question 31

Which operator removes a field from a document?

  1. $unset
  2. $push
  3. $addToSet
  4. $currentDate

Correct Answer: 1

Explanation:

The $unset operator removes a specified field from a document. It is useful when an application needs to eliminate obsolete, sensitive, or no-longer-required fields without replacing the entire document. MongoDB update operators allow administrators and applications to modify specific portions of documents efficiently. $push and $addToSet are used for array operations, while $currentDate updates a field with a date or timestamp value. Understanding these operators helps administrators perform targeted data modifications while minimizing unnecessary changes.

Question 32

Which command returns information about server-wide MongoDB status?

  1. db.stats()
  2. serverStatus()
  3. collection.stats()
  4. indexStats()

Correct Answer: 2

Explanation:

The serverStatus() command provides a broad set of statistics about the MongoDB server. Depending on the version and permissions, information can include connections, memory usage, network activity, operation counters, storage-related statistics, and other server metrics. Administrators can use this information to understand current system behavior and investigate resource or workload issues. db.stats() focuses on database-level statistics, while collection and index statistics provide more specific information. Server-wide monitoring should normally combine this information with operating-system and deployment-level metrics.

Question 33

Which metric indicates how many client connections MongoDB currently maintains?

  1. opcounters
  2. mem
  3. connections
  4. network

Correct Answer: 3

Explanation:

The connections section of MongoDB server statistics provides information about client connections maintained by the server. Monitoring connection counts can help administrators identify unusual increases, connection leaks, capacity concerns, or application behavior changes. Connection usage should be evaluated alongside configured connection limits, workload patterns, and application connection-pooling behavior. A high connection count does not automatically indicate a problem, because expected values vary by deployment. Administrators should establish normal operating baselines and investigate significant deviations rather than relying on an isolated metric.

Question 34

Which MongoDB feature stores large files using chunks and metadata?

  1. GridFS
  2. Change streams
  3. Time series
  4. Views

Correct Answer: 4

Explanation:

GridFS is a MongoDB specification for storing and retrieving files that exceed the BSON document size limit or that are better managed as separate file objects. GridFS divides files into chunks and stores metadata separately so applications can efficiently access portions of the file. It is commonly used when MongoDB itself needs to manage file content and associated metadata. Administrators should still evaluate whether GridFS fits the workload because external object or file storage may be more appropriate for some architectures.

Question 35

What does a MongoDB view provide?

  1. Stored query result interface
  2. Physical duplicate collection
  3. Independent replica member
  4. Separate storage engine

Correct Answer: 2

Explanation:

A MongoDB view provides a read-only interface based on an aggregation pipeline over existing collections. It does not normally store a separate physical copy of the underlying documents. Views can present selected fields, filtered records, or transformed data to users and applications while keeping the underlying collections unchanged. Because the view is based on an aggregation definition, its performance depends partly on the underlying pipeline and source data. Views can therefore provide a useful abstraction layer when different users require controlled representations of stored information.

Question 36

Which feature provides notifications when documents change in supported collections?

  1. Database profiler
  2. Change streams
  3. Query planner
  4. Storage compression

Correct Answer: 2

Explanation:

Change streams allow applications to subscribe to changes occurring in supported MongoDB deployments. Instead of repeatedly polling a collection to discover modifications, an application can receive change events as operations occur. This can support use cases such as event-driven processing, synchronization, notifications, and downstream data workflows. Change streams rely on MongoDB’s replication infrastructure and have deployment requirements that must be satisfied. Administrators should consider event volume, consumer behavior, and resume handling when operating applications that depend on change-stream notifications.

Question 37

Which MongoDB collection type is optimized for time-ordered measurements?

  1. Capped collection
  2. Time series collection
  3. System collection
  4. Temporary collection

Correct Answer: 4

Explanation:

Time series collections are designed for data consisting of measurements recorded over time. They are useful for workloads such as monitoring metrics, sensor readings, financial observations, and other timestamped information. MongoDB can apply storage and query optimizations suited to time-series workloads, including internal organization of measurements. Administrators should define an appropriate time field and consider metadata and granularity requirements when creating such collections. Time-series collections are different from capped collections, which provide fixed-size storage behavior and serve different operational purposes.

Question 38

What is a key characteristic of a capped collection?

  1. Fixed maximum size
  2. Automatic sharding
  3. Mandatory encryption
  4. Unlimited growth

Correct Answer: 4

Explanation:

A capped collection has a fixed maximum size and maintains documents according to its configured capacity. As the collection reaches its limit, older data can be overwritten as new documents are added, subject to the collection’s behavior and configuration. Capped collections can be useful for workloads that require bounded storage and predictable insertion characteristics. They are not designed as a general replacement for ordinary collections because their restrictions affect update and deletion behavior. Administrators should select them only when their bounded-storage characteristics match the application’s requirements.

Question 39

Which feature can automatically expire documents after a defined time period?

  1. Partial index
  2. TTL index
  3. Hashed index
  4. Wildcard index

Correct Answer: 2

Explanation:

A Time-To-Live (TTL) index allows MongoDB to automatically remove documents after a configured period or at a specified expiration time, depending on the index design. TTL indexes are commonly useful for temporary records, session information, logs, caches, and other data that should not be retained indefinitely. Expiration is performed by MongoDB’s background processing rather than occurring exactly at the instant the configured time is reached. Administrators should account for this behavior when designing retention policies and should verify that automatic deletion matches the application’s data-management requirements.

Question 40

Which index can support searches across arbitrary fields in documents?

  1. Hashed index
  2. Partial index
  3. Wildcard index
  4. TTL index

Correct Answer: 3

Explanation:

A wildcard index can support queries across fields that may vary between documents or whose names are not known in advance. This can be useful for flexible document structures where applications need indexed access to many possible fields. Wildcard indexes should still be designed carefully because indexing a broad set of fields can increase storage requirements and write overhead. They are different from targeted single-field or compound indexes, which are generally more precise for predictable query patterns. Administrators should evaluate actual workload behavior before choosing a wildcard strategy.