Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

101.

Which of the following will display complete list of available cursor flags?(a) cursor.Option()(b) cursor.addOption()(c) cursor.addOptions()(d) all of the mentioned

Answer» Right choice is (b) cursor.addOption()

The explanation: You should either close the cursor manually or exhaust the cursor.
102.

Which of the following operator is not very selective?(a) $nine(b) $nin(c) $ain(d) None of the mentioned

Answer» The correct answer is (b) $nin

Best explanation: The inequality operators $nin and $ne are not very selective since they often match a large portion of the index.
103.

____________ is a client or database-generated identifier that uniquely identifies this message.(a) messageLength(b) responseTo(c) requestID(d) all of the mentioned

Answer» Right choice is (c) requestID

Explanation: For the case of client-generated messages, it will be returned in the responseTo field of the OP_REPLY message.
104.

In MongoDB, write operations are atomic at the __________ level.(a) collection(b) document(c) row(d) all of the mentioned

Answer» Right choice is (b) document

To explain I would say: No single write operation can atomically affect more than one document or more than one collection.
105.

To describe the message structure, a ________ like struct is used.(a) Pascal(b) C++(c) C(d) Java

Answer» Right option is (c) C

Easy explanation: The standard message header is typed as MsgHeader. Integer constants are in capitals (e.g. ZERO for the integer value of 0).
106.

Point out the correct statement.(a) Update definitions define what fields to modify during an update(b) Query specifications, which define what fields to index(c) Index selectors, which define what records to select for read, update, and delete operations(d) All of the mentioned

Answer» Correct answer is (a) Update definitions define what fields to modify during an update

To explain: MongoDB stores all data in documents, which are JSON-style data structures composed of field-and-value pairs.
107.

The __________ method returns a document that includes a metrics field.(a) db.serverStats()(b) db.serverStatus()(c) db.status()(d) all of the mentioned

Answer» Right answer is (b) db.serverStatus()

Explanation: The metrics field contains a cursor with number of timed out cursors since the last server restart.
108.

______________ specifies the number of documents to return in each batch of the response from the MongoDB instance.(a) cursor.batchSize(size)(b) cursor.Size(size)(c) cursor.batch(size)(d) all of the mentioned

Answer» Correct option is (a) cursor.batchSize(size)

To elaborate: Specifying 1 or a negative number is analogous to using the limit() method.
109.

Which of the following data structures are documents in MongoDB?(a) All database records(b) Query selectors(c) Update definitions(d) All of the mentioned

Answer» Correct choice is (d) All of the mentioned

To explain I would say: Most user-accessible data structures in MongoDB are documents.
110.

Point out the wrong statement.(a) The MongoDB Wire Protocol is a simple socket-based, request-response style protocol(b) For queries that include a sort operation without an index, the server must load all the documents in memory to perform the sort before returning any results(c) Clients communicate with the database server through a regular TCP/IP socket(d) All of the mentioned

Answer» The correct answer is (d) All of the mentioned

Easiest explanation: As you iterate through the cursor and reach the end of the returned batch, if there are more results, cursor.next() will perform a getmore operation to retrieve the next batch.
111.

MongoDB Enterprise supports proxy authentication through ___________(a) SCRAM-SHA-1(b) LDAP(c) MONGODB-CR(d) None of the mentioned

Answer» Correct choice is (b) LDAP

To explain I would say: MongoDB does not support LDAP authentication in mixed sharded cluster deployments that contain both version 2.4 and version 2.6 shards.
112.

Setting _______ enables authentication and specifies a key file for the replica set member use to when authenticating to each other.(a) mongostat(b) mongod(c) keyFile(d) all of the mentioned

Answer» Right choice is (c) keyFile

To explain I would say: The content of the key file is arbitrary, but must be the same on all members of the replica set and mongos instances that connect to the set.
113.

Point out the wrong statement.(a) When a query does not include a shard key, the mongos can use cluster metadata from the config database to route the queries to shards(b) On larger clusters, scatter gather queries are unfeasible for routine operations(c) Replica sets use read preferences to determine where and how to route read operations to members of the replica set(d) None of the mwntioned

Answer» The correct answer is (a) When a query does not include a shard key, the mongos can use cluster metadata from the config database to route the queries to shards

The explanation is: If a query does not include the shard key, the mongos must direct the query to all shards in the cluster.
114.

Which of the following tool can be used to reload a database dump?(a) mongorestore(b) mongofiles(c) mongosupport(d) none of the mentioned

Answer» Right choice is (a) mongorestore

To elaborate: The mongorestore program writes data from a binary database dump created by mongodump to a MongoDB instance.
115.

__________ is a part of the standard MongoDB distribution and provides a full JavaScript environment.(a) mongod(b) mongodb(c) mongo(d) none of the mentioned

Answer» Right option is (c) mongo

Easy explanation: mongo provides complete access to the JavaScript language and all standard functions as well as a full database interface for MongoDB.
116.

The _____________ option accepts either full path name or relative path name.(a) –auditPathLog(b) –logPath(c) –auditPath(d) None of the mentioned

Answer» Right choice is (c) –auditPath

The explanation: To enable auditing and print audit events to a file in BSON binary format, specify file for the –auditDestination setting, BSON for the –auditFormat setting, and the output filename for the –auditPath.
117.

The ________ message is used to update a document in a collection.(a) UPDATE(b) OP_UPDATE(c) OP_UPDATES(d) All of the mentioned

Answer» Correct option is (b) OP_UPDATE

The best explanation: Only the OP_QUERY and OP_GET_MORE messages result in a response from the database.
118.

Which of the following is a metapackage for enterprise?(a) mongodb-enterprise(b) mongodb-enterprise-server(c) mongodb-enterprise-mongos(d) none of the mentioned

Answer» Correct answer is (a) mongodb-enterprise

To elaborate: mongodb-enterprise is a metapackage that will automatically install the four component packages.
119.

Which of the following code is returned by mongod if a moveChunk operation fails to confirm a commit?(a) 5(b) 6(c) 7(d) 3

Answer» Correct answer is (a) 5

Explanation: Exit codes 6 and 7 does not exist.
120.

Which of the following code represents exit cleanly following a large clock skew (32768 milliseconds) event?(a) 45(b) 20(c) 47(d) 100

Answer» Correct option is (c) 47

For explanation I would say: 100 is returned by mongod when the process throws an uncaught exception.
121.

49 code is returned by mongod from _________ Service control Manager.(a) Linux(b) Windows(c) Ubuntu(d) All of the mentioned

Answer» The correct option is (a) Linux

The best I can explain: Custom read preferences and write concerns evaluate tags sets in different ways.
122.

The HTTP interface is always available on the port numbered _________ greater than the primary mongod port.(a) 1000(b) 2000(c) 3000(d) None of the mentioned

Answer» Correct answer is (a) 1000

Easiest explanation: By default, the HTTP interface port is 28017, but is indirectly set using the port option which allows you to configure the primary mongod port.
123.

Point out the correct statement.(a) With the MMAPv1 storage engine, MongoDB preallocates its database files before using them and often creates large files(b) zlib provides better compression rate but has a higher performance cost(c) MongoDB includes support for many storage engines(d) All of the mentioned

Answer» The correct choice is (b) zlib provides better compression rate but has a higher performance cost

Easy explanation: WiredTiger uses prefix compression on all indexes by default.
124.

Point out the correct statement.(a) MongoDB provides packages of the officially supported MongoDB Enterprise builds in it’s own repository(b) mongodb-enterprise-tool package contains the mongo shell(c) mongodb-enterprise-shell package contains the mongo tools(d) All of the mentioned

Answer» The correct option is (a) MongoDB provides packages of the officially supported MongoDB Enterprise builds in it’s own repository

The explanation: This repository provides the MongoDB Enterprise distribution in many packages.
125.

Which of the following is not a part of mongodb-enterprise-tools?(a) mongodump(b) mongotop(c) mongodown(d) none of the mentioned

Answer» The correct choice is (c) mongodown

Best explanation: mongodb-enterprise-tools package contains the following MongoDB tools: mongoimport bsondump, mongodump, mongoexport, mongofiles, mongoimport, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.
126.

Which of the following should be avoided with MongoDB Deployments?(a) RAID-5(b) RAID-10(c) RAID-7(d) RAID-0

Answer» The correct option is (d) RAID-0

For explanation I would say: While RAID-0 provides good write performance, it also provides limited availability and can lead to reduced performance on read operations, particularly when using Amazon’s EBS volumes.
127.

MongoDB requires a filesystem that supports ______ on directories.(a) fsynconce()(b) fsync()(c) sync()(d) all of the mentioned

Answer» Right choice is (b) fsync()

To explain I would say: HGFS and Virtual Box’s shared folders do not support this operation.
128.

Point out the correct statement.(a) Journal must reside on the same logical volume as the other MongoDB data files(b) To get a consistent snapshot of a sharded system, you must disable the balancer(c) Backups produced by copying the underlying data do not support point in time recovery(d) All of the mentioned

Answer» Correct option is (d) All of the mentioned

To elaborate: They are difficult to manage for larger sharded clusters.
129.

The $rename operator logically performs a _______ of both the old name and the new name.(a) $unset(b) $set(c) $Nested(d) None of the mentioned

Answer» Correct option is (a) $unset

Best explanation: If the field to rename does not exist in a document, $rename does nothing.
130.

Which of the following information is captured by database profiler?(a) Read operations(b) Write operations(c) Cursor Operations(d) All of the mentioned

Answer» The correct choice is (d) All of the mentioned

For explanation I would say: The database profiler captures data information about read and write operations, cursor operations, and database commands.
131.

Which of the following provides low-level tracing/sniffing view into database activity?(a) mongosniff(b) mongotop(c) mongooplog(d) mongofiles

Answer» The correct answer is (a) mongosniff

To explain: mongosniff is a command-line tool providing a sniffing view into database activity by monitoring network traffic going to and from MongoDB.
132.

Point out the correct statement.(a) Replica set configuration is complex(b) MongoDB includes support for two storage engines(c) MongoDB includes support for more than three storage engines(d) All of the mentioned

Answer» Correct choice is (b) MongoDB includes support for two storage engines

Explanation: MMAPv1 provides collection-level locking.
133.

Which of the following sets the database profiler level?(a) systemLog.verbosity(b) operationProfiling.mode(c) operationProfiling.slowOpThresholdMs(d) none of the mentioned

Answer» The correct choice is (b) operationProfiling.mode

The best explanation: The profiler is not active by default because of the possible impact on the profiler itself on performance.
134.

________ contains a counter of the total number of clients with active operations in progress or queued.(a) globalLock.active(b) localLock.activeClients(c) globalLock.activeClients(d) all of the mentioned

Answer» The correct answer is (c) globalLock.activeClients

The best explanation: The activeClients data structure provides more granular information about the number of connected clients and the operation types (e.g. read or write) performed by these clients.
135.

Which of the following storage engine is supported by default?(a) MMAPv1(b) WiredTiger(c) WirelessTiger(d) All of the mentioned

Answer» Right option is (a) MMAPv1

Easy explanation: MongoDB includes support for two storage engines: MMAPv1, the storage engine available in previous versions of MongoDB, and WiredTiger.
136.

Which of the following document configures the threshold which determines whether a query is “slow” for the purpose of the logging system?(a) systemLog.verbosity(b) operationProfiling.mode(c) operationProfiling.slowOpThresholdMs(d) none of the mentioned

Answer» Correct answer is (c) operationProfiling.slowOpThresholdMs

Explanation: systemLog.verbosity controls the amount of logging output that mongod write to the log.
137.

__________  sends all diagnostic logging information to a log file instead of to standard output or to the host’s syslog system.(a) syspath(b) syslog(c) logpath(d) syspathlog

Answer» Right choice is (c) logpath

For explanation I would say: By default, MongoDB overwrites the log file when the process restarts.
138.

Enabling _____________ degrades performance more than logging only the authorization failures.(a) auditAuthorizationFailure(b) auditAuthorizationSuccess(c) auditAuthorizationlog(d) none of the mentioned

Answer» Correct choice is (b) auditAuthorizationSuccess

To explain: System Event Audit Message is available only in MongoDB Enterprise.
139.

For replica sets, mongodump also supports a point in time feature with the ________ option.(a) –oplog(b) –log(c) –op(d) None of the mentioned

Answer» The correct choice is (a) –oplog

The explanation is: To restore a point in time backup created with –oplog, use mongorestore with the –oplogReplay option.
140.

mongodump and mongorestore can operate against a running _______ process.(a) mongostore(b) mongorestore(c) mongod(d) none of the mentioned

Answer» Correct answer is (c) mongod

The explanation: By default, mongodump does not capture the contents of the local database.
141.

Point out the correct statement.(a) The data format used by mongodump from version 2.2 or later is incompatible with earlier versions of mongod(b) The replica role confers no additional access, in keeping with the policy of least privilege(c) To backup a given database’s users, you must have the replace action on the admin database’s admin.system.users collection(d) All of the mentioned

Answer» The correct answer is (a) The data format used by mongodump from version 2.2 or later is incompatible with earlier versions of mongod

Explanation: Do not use recent versions of mongodump to back up older data stores.
142.

Point out the wrong statement.(a) When running MongoDB in production on Linux, it is recommended that you use Linux kernel version 2.6.36 or later(b) The MongoDB distribution for Solaris include support for the WiredTiger storage engine(c) By default, WiredTiger uses zip compression library(d) None of the mentioned

Answer» Correct choice is (c) By default, WiredTiger uses zip compression library

To explain: By default, WiredTiger uses snappy compression library.
143.

Point out the correct statement.(a) Replica set configuration is straightforward(b) Keyfile must be less than one kilobyte in size(c) Keyfile may only contain characters in the base64 set and the file must not have group or “world” permissions on UNIX systems(d) All of the mentioned

Answer» The correct option is (d) All of the mentioned

To explain: To enable authentication for the replica set, add the keyFile option.
144.

Point out the correct statement.(a) Shard key range tags are distinct from replica set member tags(b) Balancer does not obey tagged range associations(c) Hash-based sharding only supports tag-aware sharding on an entire collection(d) All of the mentioned

Answer» Right answer is (c) Hash-based sharding only supports tag-aware sharding on an entire collection

The explanation: Tag sets let you customize write concern and read preferences for a replica set.
145.

WiredTiger can compress collection data using either snappy or zlib compression library.(a) snappy(b) zip(c) lib(d) Kit

Answer» The correct option is (a) snappy

Easiest explanation: snappy provides a lower compression rate but has little performance cos
146.

To backup all the databases in a cluster via mongodump, you should have the ___________ role.(a) restore(b) backup(c) replication(d) all of the mentioned

Answer» Correct answer is (b) backup

To elaborate: The backup role provides the required privileges for backing up all databases.
147.

___________ is a routing service for MongoDB shard configurations that processes queries from the application layer.(a) mongod(b) mongos(c) mongocon(d) none of the mentioned

Answer» Correct option is (b) mongos

Easiest explanation: From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.
148.

Which of the following is especially important in Sharded Clusters?(a) NSS(b) STP(c) NTP(d) SSD

Answer» The correct option is (a) NSS

The best explanation: Use the Network Time Protocol (NTP) to synchronize time among your hosts.
149.

Point out the correct statement.(a) Database commands cannot return statistics regarding the current database state with greater fidelity(b) Monitoring is a critical component of all database administration(c) The MongoDB distribution does not include utilities that quickly return statistics about instances’ performance and activity(d) All of the mentioned

Answer» Correct choice is (a) Database commands cannot return statistics regarding the current database state with greater fidelity

To explain: This is useful for diagnosing issues and assessing normal operation.
150.

For a client-server authentication, the client requests from the KDC a ________ for access to a specific asset.(a) ticket(b) local(c) token(d) user

Answer» The correct answer is (a) ticket

Best explanation: KDC uses the client’s secret and the server’s secret to construct the ticket which allows the client and server to mutually authenticate each other, while keeping the secrets hidden.