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.

1.

Point out the wrong statement.(a) Client libraries provide a convenient, injection free, process to build these objects(b) MongoDB represents queries as BSON objects(c) Field names in MongoDB’s query language have semantic meaning(d) All of the mentioned

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

The explanation: If you need to use db.eval() with user supplied values, you can either use a CodeWScope or you can supply extra arguments to your function.
2.

Which of the collection in GridFS stores the binary chunks?(a) chunks(b) files(c) data(d) log

Answer» The correct choice is (a) chunks

To elaborate: GridFS places the collections in a common bucket by prefixing each with the bucket name.
3.

How many does collections GridFS use to store files?(a) 1(b) 2(c) 3(d) 4

Answer» Right answer is (b) 2

The explanation is: One collection stores the file chunks, and the other stores file metadata.
4.

Each document in the __________ collection represents a distinct chunk of a file as represented in the GridFS store.(a) chunks(b) files(c) bson(d) none of the mentioned

Answer» The correct answer is (a) chunks

To elaborate: Each chunk is identified by its unique ObjectId stored in its _id field.
5.

Which of the following document represents uncaught exception?(a) 45(b) 49(c) 47(d) 100

Answer» The correct answer is (d) 100

To explain: 49 is returned by mongod.exe or mongos.exe on Windows when either receives a shutdown message from the Windows Service Control Manager.
6.

__________ is a command-line utility to import content from a JSON, CSV, or TSV.(a) mongorestore(b) mongofiles(c) mongosupport(d) mongoimport

Answer» The correct choice is (d) mongoimport

Easiest explanation: Import content from a JSON, CSV, or TSV export is created by mongoexport.
7.

The ___________ collection stores custom roles that administrators create and assign to users to provide access to specific resources.(a) admin.system.role(b) admin.system.roles(c) admin.system.roleasign(d) all of the mentioned

Answer» Right answer is (b) admin.system.roles

Explanation: System collections include these collections stored in the admin database
8.

To generate pseudo-random data to use for a keyfile, issue the following __________ command.(a) openhss(b) openssd(c) openssl(d) all of the mentioned

Answer» Correct answer is (c) openssl

To explain I would say: Always ensure that the password stored in the key file is both long and contains a high amount of entropy. Using openssl in this manner helps generate such a key.
9.

_id is a ________ bytes hexadecimal number which assures the uniqueness of every document.(a) 13(b) 16(c) 12(d) 10

Answer» Correct choice is (c) 12

The best explanation: You can provide _id while inserting the document.
10.

Backup can also create snapshots of _________ that are run as single-member replica sets.(a) documents(b) standalones(c) backups(d) none of the mentioned

Answer» Right option is (b) standalones

For explanation: A lightweight Backup Agent runs within your infrastructure and backs up data from the MongoDB processes you have specified.
11.

By default, an application directs its ______ operations to the primary member in a replica set.(a) read(b) write(c) read and write(d) none of the mentioned

Answer» Correct answer is (a) read

The best I can explain: Read preference describes how MongoDB clients route read operations to the members of a replica set.
12.

MongoDB provides high ____________  with replica sets.(a) performance(b) availability(c) scalability(d) none of the mentioned

Answer» Correct option is (b) availability

The best I can explain: A replica set consists of two or more copies of the data.
13.

Ops Manager ______ provides scheduled snapshots and point-in-time recovery of your MongoDB replica sets and sharded clusters.(a) Automation(b) Performance(c) Monitoring(d) Backup

Answer» Correct choice is (d) Backup

To explain I would say: Backup can also create snapshots of standalones that are run as single-member replica sets.
14.

_________ stores a log of the operations in a replica set.(a) oplog.rs(b) log.rs(c) oplog(d) all of the mentioned

Answer» Correct choice is (a) oplog.rs

The explanation is: Built-in first-in-first-out property maintains the order of events while managing storage use.
15.

MongoDB stores tag sets in the replica set configuration object, which is the document returned by ____________(a) rs.config()(b) rs.conf()(c) rs.confstats()(d) all of the mentioned

Answer» Correct answer is (b) rs.conf()

Best explanation: Custom read preferences and write concerns evaluate tags sets in different ways.
16.

MongoDB stores tag sets in the replica set configuration object, which is the document returned by _____(a) rs.config()(b) rs.conf()(c) rs.confstats()(d) all of the mentioned

Answer» Right choice is (b) rs.conf()

Best explanation: Custom read preferences and write concerns evaluate tags sets in different ways.
17.

MongoDB stores user credentials in the protected admin.system._________(a) user(b) capped(c) cappeduser(d) users

Answer» Right choice is (d) users

The best I can explain: The admin.system.users collection stores the user’s authentication credentials as well as any roles assigned to the user.
18.

MongoDB stores user information in the _________ collection.(a) system.allusers(b) system.users(c) system.superusers(d) system.usersnone

Answer» Correct option is (b) system.users

To explain I would say: MongoDB stores all user information, including name, password, and the user’s database, in the system.users collection in the admin database.
19.

MongoDB stores times in _____ by default, and will convert any local time representations into this form.(a) UTC(b) GMT(c) IST(d) None of the mentioned

Answer» Right answer is (a) UTC

Best explanation: Applications that must operate or report on some unmodified local time value may store the time zone alongside the UTC timestamp, and compute the original local time in their application logic.
20.

Config servers, host the _______ database that stores metadata for sharded clusters.(a) head(b) master(c) config(d) none of the mentioned

Answer» The correct option is (c) config

Easiest explanation: Each production cluster has three config servers, initiated using the mongod –configsvr option.
21.

The MongoDB instance stores its _________ files in /var/lib/mongo by default.(a) log(b) data(c) replica(d) all of the mentioned

Answer» Correct answer is (b) data

For explanation: You can specify alternate log and data file directories in /etc/mongod.conf.
22.

MongoDB stores additional instance-local metadata in the _______ database.(a) Master(b) Model(c) Local(d) All of the mentioned

Answer» The correct choice is (c) Local

To explain I would say: It is stored specifically for replication purposes.
23.

The enabled setting for mongod and mongos instances disables the __________ status page.(a) home(b) primary(c) secondary(d) none of the mentioned

Answer» Correct option is (a) home

The explanation is: The mongod and mongos instances run with the http interface disabled by default.
24.

Point out the wrong statement.(a) If you change the user that runs the MongoDB process, you must modify the access control rights(b) The MongoDB instance stores its data files in /var/log/mongodb by default(c) MongoDB uses memory mapped files for data management for efficiency(d) None of the mentioned

Answer» Right answer is (b) The MongoDB instance stores its data files in /var/log/mongodb by default

For explanation: The MongoDB instance stores its data files in /var/lib/mongo and its log files in /var/log/mongodb by default.
25.

mongostat tool is similar to the UNIX/Linux _________ utility.(a) stats(b) vim(c) vmstat(d) all of the mentioned

Answer» The correct option is (c) vmstat

The explanation is: vmstat is a computer system monitoring tool that collects and displays summary information about operating system memory, processes, interrupts, paging and block I/O.
26.

User account running mongod has _______ permissions for the directory.(a) write only(b) read only(c) read and write(d) none of the mentioned

Answer» Right answer is (c) read and write

The explanation: To run MongoDB, run the mongod process at the system prompt.
27.

___________ allows you to scale your cluster linearly by adding more machines.(a) Vertical sharding(b) Autosharding(c) Horizontal sharding(d) All of the mentioned

Answer» Right option is (b) Autosharding

The best explanation: It is possible to increase capacity without any downtime, which is very important on the web when load can increase suddenly and bringing down the website for extended maintenance can cost your business large amounts of revenue.
28.

____________ does not dump the content of the local database.(a) mongoshell(b) mongodump(c) mongolocaldump(d) none of the mentioned

Answer» Right option is (b) mongodump

For explanation: mongodump can read data from either mongod or mongos instances, in addition to reading directly from MongoDB data files without an active mongod.
29.

MongoDB is installed unattended on Windows from the command line using ____________(a) msi.exe(b) msiexec.exe(c) exec.exe(d) none of the mentioned

Answer» The correct option is (b) msiexec.exe

To explain I would say: MongoDB requires a data directory to store all data. MongoDB’s default data directory path is datadb.
30.

Which of the following command returns quickly and does not impact MongoDB performance?(a) dbStats(b) db.serverStatus()(c) db.stats()(d) none of the mentioned

Answer» Correct choice is (b) db.serverStatus()

For explanation: serverStatus outputs an account of the state of a MongoDB instance.
31.

Command to install the latest stable version of MongoDB Enterprise in Ubuntu is ______________(a) sudo apt-get install mongodb(b) sudo apt-get install mongodb-enterprise(c) sudo apt-get install mongodb-ent(d) all of the mentioned

Answer» The correct answer is (b) sudo apt-get install mongodb-enterprise

The best explanation: To install a specific release of MongoDB Enterprise, specify each component package individually and append the version number to the package name.
32.

___________ is a command-line tool that displays a summary list of status statistics for a currently running MongoDB instance.(a) mongostat(b) mongotop(c) mongooplog(d) mongofiles

Answer» Correct answer is (a) mongostat

Easy explanation: It describes how many inserts, updates, removes, queries, and commands were performed, as well as what percentage of the time the database was locked and how much memory it is using.
33.

What is the interactive shell for MongoDB called?(a) mongo(b) mongodb(c) dbmong(d) none of the mentioned

Answer» Correct answer is (a) mongo

Easiest explanation: Interactive shell lets developers view, insert, remove, and update data in their databases, as well as get replication information, set up sharding, shut down servers, execute JavaScript, and more.
34.

Which of the following are the simplest NoSQL databases?(a) Key-value(b) Wide-column(c) Document(d) All of the mentioned

Answer» The correct choice is (a) Key-value

For explanation: Every single item in the database is stored as an attribute name (or “key”), together with its value in Key-value stores.
35.

The ________ command returns information regarding the number of open connections.(a) connPoolStats(b) connStats(c) serverstats(d) none of the mentioned

Answer» Right option is (a) connPoolStats

Easy explanation: To avoid overloading the connection resources of a single mongod or mongos instance, ensure that clients maintain reasonable connection pool sizes.
36.

________ stores are used to store information about networks, such as social connections.(a) Key-value(b) Wide-column(c) Document(d) Graph

Answer» The correct answer is (d) Graph

Explanation: Graph stores include Neo4J and HyperGraphDB.
37.

When inserts, updates and deletes have a _________ write concern, write operations return quickly.(a) strong(b) weak(c) average(d) very strong

Answer» Right choice is (b) weak

For explanation I would say: With stronger write concerns, clients wait after sending a write operation for MongoDB to confirm the write operations.
38.

Point out the correct statement.(a) MongoDB is classified as a NoSQL database(b) MongoDB favours XML format more than JSON(c) MongoDB is column oriented database store(d) All of the mentioned

Answer» Right option is (a) MongoDB is classified as a NoSQL database

Explanation: MongoDB supports JSON format compared to XML.
39.

Point out the wrong statement.(a) If you shut down a secondary to capture data with mongodump ensure that the operation can complete before its oplog becomes too stale to continue replicating(b) MongoDB Cloud Manager continually backs up MongoDB replica sets(c) Sharded cluster snapshots are easy to achieve with other MongoDB backup methods(d) None of the mentioned

Answer» The correct answer is (c) Sharded cluster snapshots are easy to achieve with other MongoDB backup methods

Easy explanation: Sharded cluster snapshots are difficult to achieve with other MongoDB backup methods.
40.

Which of the following format is supported by MongoDB?(a) SQL(b) XML(c) BSON(d) All of the mentioned

Answer» The correct answer is (c) BSON

The explanation: MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas.
41.

mongod process is stopped by issuing which of the following command?(a) sudo service mongod start(b) sudo service mongod stop(c) sudo service mongod restart(d) none of the mentioned

Answer» The correct choice is (b) sudo service mongod stop

Best explanation: To stop MongoDB, press Control+C in the terminal where the mongod instance is running.
42.

________ an on-premise solution, has similar functionality to the cloud version.(a) Opscore Manager(b) Ops Manager(c) Mongod(d) None of the mentioned

Answer» The correct choice is (b) Ops Manager

For explanation: This tool is available with Enterprise Advanced subscriptions.
43.

To install the latest stable version of MongoDB on SUSE, issue ______________(a) sudo zypper install mongodb-enterprise(b) sudo zypper update mongodb-enterprise(c) sudo zyp install mongodb-enterprise(d) none of the mentioned

Answer» The correct option is (a) sudo zypper install mongodb-enterprise

Easy explanation: When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.
44.

MongoDB Queries can return specific fields of documents which also include user-defined __________ functions.(a) Javascript(b) C(c) C++(d) All of the mentioned

Answer» Correct option is (a) Javascript

Explanation: MongoDB supports search by field, range queries, regular expression searches.
45.

Updates that include _________ of field names may result in the reordering of fields in the document.(a) Renaming(b) Joining(c) Nesting(d) None of the mentioned

Answer» Right answer is (a) Renaming

To explain: The $rename operator updates the name of a field.
46.

A query may include a ___________ that specifies the fields from the matching documents to return.(a) selection(b) projection(c) union(d) none of the mentioned

Answer» The correct option is (b) projection

The best explanation: Queries specify criteria, or conditions, that identify the documents that MongoDB returns to the clients.
47.

If your driver has a version number of 2.9.1, What is the major version?(a) 1(b) 2(c) 9(d) None of the mentioned

Answer» Correct choice is (b) 2

The best I can explain: Driver version numbers use semantic versioning or “major.minor.patch” versioning system.
48.

Which of the following data type is depreciated?(a) Double(b) String(c) Object(d) Undefined

Answer» Correct option is (d) Undefined

The best I can explain: MongoDB treats some types as an equivalent for comparison purposes.
49.

There is _________ byte counter in BSON, starting with a random value.(a) 2(b) 3(c) 4(d) None of the mentioned

Answer» Right choice is (b) 3

Easy explanation: ObjectId is a 12-byte BSON type
50.

Each data type has a corresponding number that can be used with the _______ operator to query documents by BSON type.(a) $type(b) $server(c) $agent(d) None of the mentioned

Answer» Correct answer is (a) $type

The best I can explain: $type selects the documents where the value of the field is an instance of the specified numeric BSON type.