MongoDB C100DBA Practice Test Questions and Exam Dumps Part1 Q1-20

View Full MongoDB C100DBA Exam Dumps and Practice Test Dumps

 

Question 1

Which MongoDB component stores documents and manages database files?

  1. Storage engine
  2. Query router
  3. Replication monitor
  4. Client driver

Correct Answer: 1

Explanation:

The storage engine is responsible for managing how MongoDB stores and retrieves data on disk and in memory. MongoDB deployments commonly use WiredTiger as the default storage engine. The storage engine handles important database operations such as data persistence, concurrency control, and internal storage management. A query router serves a different role in sharded deployments, while drivers provide application connectivity. Understanding the storage engine is important for administrators because storage behavior can influence performance, resource utilization, durability, and operational configuration.

Question 2

Which command displays the databases available to the current MongoDB connection?

  1. show collections
  2. show dbs
  3. list databases
  4. db.list()

Correct Answer: 2

Explanation:

The show dbs command in the MongoDB shell displays databases available to the connected user, subject to the permissions associated with that account. It is commonly used to inspect the database environment during administration and troubleshooting. show collections instead lists collections within the currently selected database. Database visibility can depend on authorization and whether databases contain data that meets the relevant display conditions. Administrators should understand shell commands because they provide quick ways to inspect deployment state and perform routine operational tasks.

Question 3

Which MongoDB identifier uniquely identifies a document by default?

  1. _id
  2. _key
  3. docId
  4. objectKey

Correct Answer: 1

Explanation:

MongoDB documents normally contain an _id field that uniquely identifies the document within its collection. When an application does not provide an _id value during insertion, the MongoDB driver typically generates an ObjectId automatically. The _id field also receives a unique index by default, supporting efficient document identification. Administrators and developers should understand this field because it is fundamental to document identity, updates, deletes, and relationships between application data. Custom identifier values can also be used when they satisfy the application’s uniqueness requirements.

Question 4

Which operation inserts multiple documents into a collection?

  1. insertBatch()
  2. addMany()
  3. insertMany()
  4. createMany()

Correct Answer: 3

Explanation:

The insertMany() method inserts multiple documents into a MongoDB collection in a single operation. It accepts an array of documents and can be useful when applications or administrative processes need to add multiple records efficiently. MongoDB also provides insertOne() for inserting a single document. When using insertMany(), administrators should understand options such as ordered versus unordered insertion because they affect how MongoDB handles errors during a batch. Choosing the appropriate insertion method helps applications perform data-loading operations efficiently and predictably.

Question 5

Which MongoDB feature automatically creates a unique identifier for new documents?

  1. Collection validator
  2. ObjectId generation
  3. Query optimizer
  4. Write concern

Correct Answer: 2

Explanation:

ObjectId generation provides a commonly used mechanism for creating unique _id values when a document is inserted without an explicitly supplied identifier. An ObjectId contains multiple components that help distinguish generated identifiers and provide useful ordering characteristics. Drivers commonly generate ObjectIds before sending documents to MongoDB. This behavior allows applications to insert documents without manually creating unique identifiers for every record. ObjectId is an identifier type, not a validation rule or write-consistency setting, so it should be considered separately from collection validation and write concern.

Question 6

Which index type is created on a single field?

  1. Single-field index
  2. Clustered index
  3. Wildcard index
  4. Text index

Correct Answer: 1

Explanation:

A single-field index is built on one document field and can improve queries that filter or sort using that field. For example, an administrator might create an ascending index on an email field when applications frequently search users by email address. MongoDB indexes can significantly reduce the amount of data examined for suitable queries. However, indexes also consume storage and require maintenance when indexed data changes. Administrators should therefore create indexes based on actual query patterns rather than indexing every available field.

Question 7

What does a compound index contain?

  1. Multiple collections
  2. Multiple fields
  3. Multiple databases
  4. Multiple replicas

Correct Answer: 2

Explanation:

A compound index contains keys for multiple fields within the same document. Compound indexes are useful when queries frequently filter, sort, or otherwise access several fields together. The order of fields in a compound index is important because MongoDB uses that ordering when determining which queries can efficiently use the index. For example, an index containing customerId followed by createdAt can support certain queries involving both fields. Administrators should design compound indexes around real workload patterns and avoid unnecessary indexes that add write and storage overhead.

Question 8

Which MongoDB command is useful for examining query execution details?

  1. db.stats()
  2. db.serverStatus()
  3. explain()
  4. show profile

Correct Answer: 3

Explanation:

The explain() method provides information about how MongoDB executes a query or operation. It can reveal details such as the selected execution plan, index usage, documents examined, keys examined, and execution statistics. Administrators use this information to investigate inefficient queries and determine whether indexes or query changes may improve performance. Different explain verbosity modes provide different levels of detail. Examining execution plans is an important part of query optimization because it allows performance decisions to be based on observed database behavior rather than assumptions.

Question 9

Which MongoDB mechanism maintains copies of data across replica set members?

  1. Replication
  2. Aggregation
  3. Validation
  4. Compression

Correct Answer: 1

Explanation:

Replication maintains multiple copies of data across members of a MongoDB replica set. A replica set normally includes a primary member and one or more secondary members. The primary accepts supported writes, while secondary members replicate the primary’s operations. Replication improves availability and provides redundancy if a member becomes unavailable. MongoDB can conduct an election to select a new primary when appropriate. Administrators must understand replication behavior when designing highly available deployments, planning maintenance, monitoring member health, and determining appropriate read and write configurations.

Question 10

Which replica set member normally receives standard write operations?

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

Correct Answer: 4

Explanation:

The primary member of a MongoDB replica set normally receives standard write operations from clients. Changes are recorded in the primary’s operation log and replicated to secondary members. If the primary becomes unavailable, eligible members can participate in an election to select a new primary. Secondary members can serve certain read operations when configured appropriately, but they do not normally accept ordinary application writes. Understanding primary responsibilities is essential when troubleshooting write failures, planning maintenance, and designing replica set deployments for high availability.

Question 11

Which MongoDB feature distributes data across multiple shards?

  1. Replication
  2. Sharding
  3. Journaling
  4. Validation

Correct Answer: 2

Explanation:

Sharding distributes data across multiple MongoDB shards to support horizontal scaling. Instead of storing an entire collection on one server or replica set, a sharded collection is divided according to a shard key. MongoDB uses routing components to direct operations toward the appropriate shards. Sharding can help deployments handle large data volumes and high workloads, but successful design depends heavily on selecting an appropriate shard key and understanding workload patterns. Replication and sharding solve different problems: replication primarily provides redundancy and availability, while sharding distributes data and workload.

Question 12

What is the primary role of mongos in a sharded cluster?

  1. Stores configuration metadata
  2. Performs elections
  3. Routes client operations
  4. Creates collection indexes

Correct Answer: 3

Explanation:

mongos is the query router used by clients to interact with a MongoDB sharded cluster. It examines incoming operations and routes them to the appropriate shard or shards based on cluster metadata and the operation being performed. Clients generally connect to mongos rather than directly managing shard placement themselves. Configuration metadata allows routing decisions to be made correctly. Administrators therefore need to understand the role of mongos when deploying, monitoring, and troubleshooting sharded environments. It is not itself the component responsible for storing the application’s shard data.

Question 13

Which feature records database operations for durability and replication?

  1. Journal
  2. Cursor
  3. Session
  4. Aggregator

Correct Answer: 4

Explanation:

The journal is part of MongoDB’s durability mechanisms and records changes so the storage engine can recover appropriately after certain failures. With the WiredTiger storage engine, journaling works with checkpoints and recovery mechanisms to support durable data management. Administrators should understand journaling when evaluating storage behavior, recovery, and write durability. Journaling should not be confused with the replication oplog, which records operations for replication between replica set members. Both concepts are important in MongoDB administration but serve different purposes within the database architecture.

Question 14

Which command removes a specific collection from a database?

  1. db.collection.remove()
  2. db.collection.drop()
  3. db.collection.delete()
  4. db.collection.erase()

Correct Answer: 2

Explanation:

The drop() method removes an entire collection from the current database, including its documents and associated indexes. It is therefore significantly different from deleting individual documents. Administrators should use this operation carefully because dropping a collection is destructive. Before executing it in a production environment, the operator should verify the database, collection name, permissions, and intended outcome. Methods such as deleteOne() and deleteMany() are more appropriate when the requirement is to remove selected documents while retaining the collection itself.

Question 15

Which security mechanism verifies a MongoDB user’s identity?

  1. Authentication
  2. Authorization
  3. Auditing
  4. Encryption

Correct Answer: 1

Explanation:

Authentication verifies the identity of a user or client attempting to access MongoDB. MongoDB supports authentication mechanisms that allow deployments to establish whether a connection belongs to an authorized identity. Authorization is a separate process that determines what an authenticated identity is permitted to do. Encryption protects information during transmission or storage, while auditing records selected activities for monitoring and compliance purposes. Administrators should configure authentication and authorization together so that identities are verified and then granted only the permissions necessary for their responsibilities.

Question 16

Which security mechanism determines what actions an authenticated user may perform?

  1. Authentication
  2. Encryption
  3. Authorization
  4. Compression

Correct Answer: 3

Explanation:

Authorization determines which resources and operations an authenticated MongoDB user is permitted to access. MongoDB uses role-based access control to assign privileges to users through roles. Administrators can use built-in roles or create custom roles when more specific permissions are required. Separating authentication from authorization is important: authentication establishes identity, while authorization establishes allowed actions. Applying appropriate roles helps enforce least-privilege access and reduces the risk of users performing administrative or data-modification operations that are unnecessary for their responsibilities.

Question 17

Which MongoDB tool helps identify slow database operations?

  1. MongoDB profiler
  2. ObjectId generator
  3. BSON decoder
  4. Replica election

Correct Answer: 2

Explanation:

The MongoDB database profiler collects information about database operations according to its configured profiling level. Administrators can use profiler data to investigate slow operations and understand workload behavior. Profiling can provide useful details for identifying queries that may need optimization, although enabling detailed profiling should be considered carefully because collecting diagnostic information can introduce overhead. The profiler complements other performance tools such as query execution plans and system monitoring. Administrators should use these tools together when diagnosing performance issues rather than relying on a single measurement.

Question 18

What does a MongoDB aggregation pipeline process?

  1. Only user accounts
  2. Only index definitions
  3. Documents through stages
  4. Only replica elections

Correct Answer: 4

Explanation:

An aggregation pipeline processes documents through a sequence of stages. Each stage can filter, transform, group, sort, reshape, or otherwise process documents before passing the resulting stream to the next stage. Common stages include $match, $group, $project, and $sort. Pipelines are useful for reporting, analytics, data transformation, and application workloads that require more processing than a basic query provides. Administrators should understand how pipeline stages interact with indexes and resource usage when evaluating aggregation performance in production systems.

Question 19

Which backup approach creates a copy of MongoDB data for recovery?

  1. Data backup
  2. Query profiling
  3. Index scanning
  4. Connection pooling

Correct Answer: 3

Explanation:

A database backup creates a recoverable copy of MongoDB data that can be used after accidental deletion, corruption, infrastructure failure, or another data-loss event. Backup strategy should consider recovery objectives, retention requirements, consistency, storage location, and restoration testing. A backup is different from replication: replica sets provide redundancy and availability, but they are not a substitute for independent backups because unwanted changes can replicate to other members. Administrators should periodically test restoration procedures to confirm that backups can actually support the required recovery process.

Question 20

Which MongoDB setting controls how long an operation may execute before timing out?

  1. readConcern
  2. writeConcern
  3. maxTimeMS
  4. retryWrites

Correct Answer: 3

Explanation:

The maxTimeMS option specifies a maximum execution time for supported MongoDB operations. If the operation exceeds the configured limit, MongoDB can terminate the operation rather than allowing it to continue indefinitely. This can be useful when administrators need to prevent unexpectedly long-running queries from consuming resources for excessive periods. readConcern and writeConcern control consistency and acknowledgment behavior, while retryWrites relates to retrying certain supported write operations. Understanding these options helps administrators distinguish query execution limits from data consistency and write-retry settings.