
























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The MongoDB DBA Associate exam is designed for professionals who manage and operate MongoDB systems. Topics covered include database configuration, monitoring, backup and recovery, replication, and sharding. Candidates will also be tested on database management best practices and troubleshooting in MongoDB.
Typology: Exams
1 / 96
This page cannot be seen from the preview
Don't miss anything!

























































































Question 1. Which component stores the metadata for a sharded cluster and must be deployed as a replica set for high availability? A) mongod instances on shards B) mongos routers C) Config servers D) Arbiter members Answer: C Explanation: Config servers hold the cluster’s metadata (shard list, chunk ranges, etc.) and are required to run as a replica set to avoid a single point of failure. Question 2. In a replica set, which member is eligible to become primary during an election? A) Any secondary with priority 0 B) Any member with votes > 0 and priority > 0 C) Only the member with the highest priority, regardless of votes D) Arbiter members only Answer: B Explanation: A member must have at least one vote and a priority greater than 0 to be considered for primary; priority influences election outcome but does not exclude members with votes. Question 3. What is the default authentication mechanism used by MongoDB 5.0 and later? A) MONGODB-CR B) SCRAM‑SHA‑ 1 C) SCRAM‑SHA‑ 256 D) LDAP
Answer: C Explanation: Starting with MongoDB 4.0, SCRAM‑SHA‑256 is the default; SCRAM‑SHA‑1 remains supported for compatibility. Question 4. Which storage engine provides in‑memory only data storage and does not persist data to disk? A) WiredTiger B) MMAPv C) inMemory D) RocksDB Answer: C Explanation: The inMemory storage engine keeps all data in RAM and does not write to disk, making it suitable for transient workloads. Question 5. When configuring a replica set, what does the “priority” setting control? A) The order in which members receive write operations B) The likelihood of a member becoming primary during elections C) The number of votes a member casts in an election D) The amount of cache allocated to the member Answer: B Explanation: Priority determines a member’s eligibility to become primary; higher priority members are preferred in elections. Question 6. Which command returns the current status of a sharded cluster, including shard distribution and balancer state? A) db.serverStatus()
Question 9. Which role provides the least privileges while still allowing a user to read any database’s data? A) readWriteAnyDatabase B) dbAdminAnyDatabase C) readAnyDatabase D) clusterMonitor Answer: C Explanation: The readAnyDatabase built‑in role grants read access to all databases without write or administrative privileges. Question 10. In a sharded cluster, which component routes client queries to the appropriate shard(s)? A) Config server B) mongod instance on a shard C) mongos router D) arbiter member Answer: C Explanation: mongos acts as the query router, consulting the config servers to determine which shard(s) hold the requested data. Question 11. Which of the following is NOT a valid reason to use an arbiter in a replica set? A) To provide an additional vote without storing data B) To increase read throughput by serving queries C) To maintain an odd number of votes for elections D) To reduce hardware costs for a voting member Answer: B
Explanation: Arbiter members do not store data and cannot serve read operations; they exist solely to provide voting capability. Question 12. Which command initiates an initial sync for a newly added secondary member? A) rs.add() B) rs.reconfig() C) rs.stepDown() D) rs.syncFrom() Answer: A Explanation: Adding a member with rs.add() triggers the initial sync process, where the new secondary copies data from an existing member. Question 13. What does the “balancer” do in a sharded cluster? A) Balances CPU usage across mongos routers B) Moves chunks between shards to achieve even data distribution C) Balances network traffic between config servers D) Balances write concern levels across replica sets Answer: B Explanation: The balancer monitors chunk distribution and migrates chunks between shards to keep data evenly distributed. Question 14. Which of the following is a required step before enabling TLS/SSL for inter‑node communication? A) Restart the config servers only B) Generate and distribute a CA certificate to all members
Question 17. When performing a logical backup with mongodump, which option ensures that the dump includes the oplog for point‑in‑time recovery? A) --archive B) --gzip C) --oplog D) --dbpath Answer: C Explanation: The --oplog flag captures the oplog during the dump, enabling point‑in‑time restores. Question 18. Which index type is required to support $geoNear queries on GeoJSON data? A) 2d index B) 2dsphere index C) text index D) hashed index Answer: B Explanation: 2dsphere indexes support spherical geometry queries, including $geoNear on GeoJSON coordinates. Question 19. Which of the following is a correct way to restrict a user to read only from the “sales” collection in the “analytics” database? A) db.createUser({user:"bob",pwd:"pwd",roles:[{role:"read",db:"analytics"}]}) B) db.createUser({user:"bob",pwd:"pwd",roles:[{role:"read",db:"analytics",collection:"sales"}]}) C) db.createUser({user:"bob",pwd:"pwd",roles:[{role:"read",db:"analytics",collection:"sales"}]}) D) db.createUser({user:"bob",pwd:"pwd",roles:[{role:"readAnyDatabase",db:"admin"}]}) Answer: C
Explanation: The role document can include a “collection” field to limit privileges to a specific collection. Question 20. Which of the following best describes the purpose of a “zone” in sharding? A) To group shards for load‑balancing only B) To assign specific ranges of shard keys to particular shards for data locality C) To define security boundaries between shards D) To enforce write concern levels per shard Answer: B Explanation: Zones (or tag ranges) map specific shard key ranges to designated shards, enabling data residency or latency optimization. Question 21. What is the default write concern for MongoDB when no writeConcern option is specified? A) w:0 (unacknowledged) B) w:1 (acknowledged by primary) C) w:"majority" D) w:2 (acknowledged by two nodes) Answer: B Explanation: By default, writes are acknowledged by the primary only (w:1), ensuring basic durability. Question 22. Which of the following operations can cause a rollback on a secondary node? A) A primary stepping down during an election while the secondary has uncommitted writes B) A secondary applying an oplog entry that conflicts with a later entry on the primary C) A secondary being added to the replica set for the first time
A) The member cannot become primary but can still replicate data B) The member can become primary but cannot vote in elections C) The member is excluded from the replica set configuration entirely D) The member will act as an arbiter automatically Answer: A Explanation: A member with votes:0 participates in replication but does not count toward election votes, preventing it from becoming primary. Question 26. Which of the following commands can be used to pause the balancer for a specific time window? A) sh.stopBalancer() B) sh.enableBalancing(false) C) sh.setBalancerState(false) D) sh.disableBalancing() Answer: C Explanation: sh.setBalancerState(false) disables the balancer; it can be re‑enabled later with sh.setBalancerState(true). Question 27. Which of the following is true about the “mongodump” utility? A) It creates a binary snapshot of the data files on disk B) It can only back up a single collection at a time C) It produces BSON files that can be restored with mongorestore D) It requires the server to be stopped during the dump Answer: C Explanation: mongodump exports data as BSON, which mongorestore can import; it does not require stopping the server.
Question 28. Which option should be used with mongorestore to restore data into a replica set secondary without affecting the primary? A) --host
A) Faster query execution B) Automatic index creation C) Data durability in the event of a crash D) Reduced memory usage Answer: C Explanation: Journaling writes data to a journal file before committing to data files, allowing recovery after an unexpected shutdown. Question 34. Which of the following is a correct way to increase the maximum number of connections a mongod instance can accept? A) Set net.maxIncomingConnections in the configuration file B) Use the --maxConns command‑line option C) Adjust the ulimit for open files on the host OS D) Increase the value of connections.max in serverStatus output Answer: C Explanation: The OS limit on open file descriptors (ulimit) controls how many sockets a process can open; increasing it allows more connections. Question 35. Which of the following is true about the “compact” command? A) It can be run on a primary without affecting reads B) It rewrites and defragments data files for a collection C) It automatically rebuilds all indexes on the collection D) It is only available for capped collections Answer: B Explanation: compact rewrites the collection’s data files to reclaim space and can improve storage efficiency, though it may block writes.
Question 36. Which of the following best describes the effect of setting writeConcern “w:majority” with wtimeout of 0? A) The write will wait indefinitely for majority acknowledgment B) The write will return immediately, not waiting for acknowledgment C) The write will fail if majority acknowledgment is not immediate D) The write will be retried until majority is achieved Answer: C Explanation: A wtimeout of 0 means the driver will not wait; if majority acknowledgment isn’t instantly available, the write fails with a timeout error. Question 37. Which of the following statements about “mongos” processes is false? A) They cache the cluster metadata locally to reduce config server queries B) They can be deployed in a replica set for high availability C) They route queries based on the shard key values D) They require TLS certificates when TLS is enabled for inter‑node traffic Answer: B Explanation: mongos is a stateless router; high availability is achieved by deploying multiple mongos instances, not by replicating them. Question 38. Which of the following is a recommended practice when creating a compound index? A) Place the most selective field first in the index key pattern B) Include all fields used in any query on the collection C) Use the same order of fields as they appear in the query predicate D) Always create the index in the background to avoid lock contention
B) Reads return data that has been committed to a majority of replica set members for each shard C) Reads are allowed from any secondary regardless of write acknowledgment D) Reads are blocked until all shards acknowledge the read request Answer: B Explanation: In a sharded cluster, “majority” ensures that each shard returns data that has been written to a majority of its replica set members. Question 42. Which of the following options is required to enable TLS for client‑to‑mongod connections? A) net.ssl.CAFile B) net.ssl.mode set to “requireSSL” C) net.ssl.PEMKeyFile D) All of the above Answer: D Explanation: Enabling TLS requires a CA file (or self‑signed cert), the mode set to requireSSL (or preferSSL), and a PEM key file containing the server’s certificate and private key. Question 43. Which of the following is a consequence of using a “hashed” shard key for a collection that frequently performs range queries on that field? A) Range queries will be efficient because hashed keys preserve order B) Range queries will be inefficient because data is distributed randomly C) The balancer will automatically convert the hashed key to a range key D) Sharding will be disabled for that collection Answer: B Explanation: Hashed keys randomize the distribution of values, making range queries costly because related documents may reside on different shards.
Question 44. Which command can be used to view the list of indexes on a collection, including hidden indexes? A) db.collection.getIndexes() B) db.collection.getIndexes({includeHidden:true}) C) db.collection.stats() D) db.collection.aggregate([{$indexStats:{}}]) Answer: D Explanation: The $indexStats aggregation stage reports statistics for all indexes, including hidden ones, whereas getIndexes() hides hidden indexes by default. Question 45. What does the “oplog” in a replica set contain? A) A log of all authentication events B) A capped collection of recent write operations for replication C) A history of schema changes made to the database D) A record of all client connections Answer: B Explanation: The oplog (operations log) is a capped collection that stores recent write operations, enabling secondaries to replicate changes. Question 46. In a replica set, which member will be selected to receive write operations after a primary steps down? A) The secondary with the highest priority that is up‑to‑date B) Any secondary with votes > 0 C) The arbiter, if present D) The node with the lowest latency to the client
B) dbAdminAnyDatabase C) userAdminAnyDatabase D) backupAllDatabases Answer: D Explanation: “backupAllDatabases” is not a built‑in role; backup privileges are granted via the “backup” role. Question 50. When using the “mongodump” utility with the “--gzip” option, what must be true when restoring with “mongorestore”? A) The --gzip option must also be specified on mongorestore B) The dump files must be placed in a directory named “gzip” C) mongorestore automatically detects and decompresses gzip files D) The dump must be performed with the --archive option Answer: A Explanation: To restore compressed dump files, mongorestore must be invoked with the same -- gzip flag to decompress the input. Question 51. Which of the following statements about the “ttl” index option is correct? A) It automatically removes documents after a specified number of updates B) It removes documents whose indexed field value is older than a set number of seconds C) It is only applicable to capped collections D) It requires a write concern of “majority” to function Answer: B Explanation: A TTL (time‑to‑live) index deletes documents when the value of the indexed field exceeds the defined expiration time.
Question 52. Which command can be used to check the health of the balancer and whether it is currently migrating chunks? A) sh.getBalancerState() B) sh.isBalancerRunning() C) db.adminCommand({balancerStatus:1}) D) db.printShardingStatus() Answer: C Explanation: The balancerStatus command returns whether the balancer is active and if any migrations are in progress. Question 53. Which of the following best explains why you might enable “auditLog” in a MongoDB deployment? A) To log all read and write operations for compliance and security monitoring B) To improve query performance by caching audit data C) To automatically replicate audit logs across shards D) To replace the regular mongod log file Answer: A Explanation: auditLog captures authentication events, CRUD operations, and administrative actions, aiding compliance and security audits. Question 54. Which of the following is a consequence of running the “compact” command on a collection that is heavily written to? A) It will immediately free up disk space without affecting performance B) It may block write operations for the duration of the compaction C) It will automatically create a new index on the collection D) It will convert the collection to a capped collection