Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

MongoDB MCQ Set 1

1. The mongo program can evaluate JavaScript expressions using the command line ________ option.
a) –opt
b) –js
c) –eval
d) None of the mentioned

View Answer

Answer: c [Reason:] The mongo program can evaluate a JavaScript file (.js) passed directly to it (e.g. mongo someFile.js).

2. Point out the correct statement :
a) The mongostat diagnostic tool, when running with the –mode need to be able to reach all components of a cluster
b) All shards in a cluster need to be able to communicate with all other shards to facilitate chunk and balancing operations
c) Authorization does not control or affect access to this interface
d) None of the mentioned

View Answer

Answer: b [Reason:] You can also specify the shard server option with the shardsvr value for the clusterRole setting in the configuration file. Shard members are also often conventional replica sets using the default port.

3. If a .mongorc.js file exists, the mongo shell will evaluate a __________ file before starting.
a) .mongorc.js
b) .mongo.js
c) .mongorc.jscript
d) all of the mentioned

View Answer

Answer: a [Reason:] You can disable this behavior by passing the mongo –norc option.

4. On _________ mongo.exe reads the .mongorc.js file from %HOME%.mongorc.js
a) Windows
b) Linux
c) Mac
d) Solaris

View Answer

Answer: a [Reason:] On Linux and Unix systems, mongo reads the .mongorc.js file from $HOME/.mongorc.js.

5. Point out the wrong statement :
a) REST does provide administrative access, and its accessibility represents a vulnerability in a secure environment
b) REST API does provide any support for insert, update, or remove operations
c) The net.http.RESTInterfaceEnabled configuration makes the http status interface, which is read-only by default, fully interactive
d) None of the mentioned

View Answer

Answer: b [Reason:] REST API does not provide any support for insert, update, or remove operations.

6. 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

View Answer

Answer: a [Reason:] 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.

7. The _______ API to MongoDB provides additional information and write access on top of the HTTP status interface.
a) Web
b) REST
c) RestFul
d) All of the mentioned

View Answer

Answer: b [Reason:] The REST interface is disabled by default, and is not recommended for production use.

8. ________ instances provide query routing for sharded clusters.
a) mongod
b) mongos
c) netstats
d) selectindexes

View Answer

Answer: b [Reason:] Clients connect to mongos instances, which behave from the client’s perspective as mongod instances.

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

View Answer

Answer: c [Reason:] Each production cluster has three config servers, initiated using the mongod –configsvr option.

10. Config servers listen for connections on port :
a) 27011
b) 27019
c) 27107
d) None of the mentioned

View Answer

Answer: b [Reason:] You also can run a config server by using the configsvr value for the clusterRole setting in a configuration file.

MongoDB MCQ Set 2

1. Use __________ to encrypt communication between mongod and mongos components of a MongoDB client as well as between all applications and MongoDB.
a) SSD
b) TLS
c) MEAN
d) None of the mentioned

View Answer

Answer: b [Reason:] Create roles that define the exact access a set of users needs.

2. Point out the correct statement :
a) MongoDB Enterprise provides support for Kerberos authentication of MongoDB clients to mongod and mongos
b) Kerberos is an industry standard authentication protocol for large client/server systems
c) Kerberos allows MongoDB and applications to take advantage of existing authentication infrastructure and processes
d) All of the mentioned

View Answer

Answer: d [Reason:] In a Kerberos-based system, every participant in the authenticated communication is known as a “principal”, and every principal must have a unique name.

3. With ___________ enabled, MongoDB forces all clients to identify themselves before granting access to the server.
a) access
b) authentication
c) authorization
d) all of the mentioned

View Answer

Answer: b [Reason:] 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.

4. ___________ allows administrators to define and limit the resources and operations that a user can access.
a) Access
b) Authentication
c) Authorization
d) All of the mentioned

View Answer

Answer: c [Reason:] Using authentication and authorization is a key part of a complete security strategy.

5. Point out the wrong statement :
a) User principal names have the form: @
b) For MongoDB, the defaults to mongodb
c) Every MongoDB mongod and mongos instance must have an associated service principal
d) All of the mentioned

View Answer

Answer: b [Reason:] User principal names have the form: @.

6. Use the __________ option to ensure that MongoDB listens for connections from applications on configured addresses.
a) bind_ipadd
b) bind_ip
c) bind_service
d) none of the mentioned

View Answer

Answer: b [Reason:] For a geographically distributed replica sets, ensure that the majority of the set’s mongod instances reside in the primary site.

7. 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

View Answer

Answer: c [Reason:] 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.

8. _____________ is used to initiate relica member set.
a) rs.rep()
b) rs.init()
c) rs.initiate()
d) none of the mentioned

View Answer

Answer: c [Reason:] MongoDB initiates a set that consists of the current member and that uses the default replica set configuration.

9. Which of the following is used to display the replica set configuration object ?
a) rs.config
b) rs.conf
c) rs.confrepl
d) none of the mentioned

View Answer

Answer: b [Reason:] rs.conf() returns a document that contains the current replica set configuration.

10. MongoDB supports the execution of JavaScript code for certain server-side operations like:
a) where
b) group
c) mapreduce
d) all of the mentioned

View Answer

Answer: d [Reason:] If you do not use these operations, disable server-side scripting by using the –noscripting option on the command line.

MongoDB MCQ Set 3

1. When a chunk grows beyond the chunk size, MongoDB attempts to split the chunk into smaller chunks, always based on ranges in the :
a) replica set
b) shard key
c) tag sets
d) all of the mentioned

View Answer

Answer: c [Reason:] Administrators create and associate tags with ranges of the shard key, and then assign those tags to the shards.

2. Point out the correct statement:
a) The shard key determines the distribution of the collection’s documents among the cluster’s shards
b) The shard key is either an indexed field or an indexed compound field that exists in every document in the collection
c) Each range, or chunk, defines a non-overlapping range of shard key values
d) All of the mentioned

View Answer

Answer: d [Reason:] MongoDB distributes the chunks, and their documents, among the shards in the cluster.

3. The index on the shard key cannot be a _________ index.
a) single
b) multkikey
c) unique
d) all of the mentioned

View Answer

Answer: b [Reason:] Shard keys are immutable and cannot be changed after insertion.

4. Hashed shard keys use a ________ index of a single field as the shard key to partition data across your sharded cluster.
a) hashed
b) unique
c) multkikey
d) all of the mentioned

View Answer

Answer: a [Reason:] The field you choose as your hashed shard key should have a good cardinality, or large number of different values.

5. Point out the correct statement :
a) Hashed keys do not work well with fields that increase monotonically like ObjectId values or timestamps
b) If you shard an empty collection using a hashed shard key, MongoDB will automatically create and migrate chunks so that each shard has two chunks
c) Hashed keys work well with ObjectId values only
d) All of the mentioned

View Answer

Answer: b [Reason:] Hashed keys work well with fields that increase monotonically like ObjectId values or timestamps.

6. You can control how many chunks MongoDB will create with the ___________ parameter.
a) numChunks
b) numInitialChunks
c) numberofchunks
d) all of the mentioned

View Answer

Answer: b [Reason:] Applications do not need to compute hashes.

7. MongoDB automatically computes the hashes when resolving queries using ______ indexes.
a) hashed
b) unique
c) muiltkey
d) all of the mentioned

View Answer

Answer: c [Reason:] During a chunk migration, the destination shard is sent all the current documents in the chunk from the origin shard.

8. MongoDB generates _______ values upon document creation to produce a unique identifier for the object.
a) ObjectId
b) CompId
c) DoctId
d) all of the mentioned

View Answer

Answer: a [Reason:] Some possible shard keys will allow your application to take advantage of the increased write capacity that the cluster can provide, while others do not.

9. A shard key that increases monotonically will not hinder performance if most of your write operations are ____ operations.
a) insert()
b) update()
c) delete()
d) all of the mentioned

View Answer

Answer: b [Reason:] Generally, choose shard keys that have both high cardinality and will distribute write operations across the entire cluster.

10. The mongos provides an interface for applications to interact with sharded clusters that hides the complexity of data ______
a) partitioning
b) replication
c) sharding
d) none of the mentioned

View Answer

Answer: a [Reason:] A mongos receives queries from applications, and uses metadata from the config server, to route queries to the mongod instances with the appropriate data.

MongoDB MCQ Set 4

1. _______ runs a database command against the admin database of a mongos instance.
a) sh._checkFullName()
b) sh._adminCommand()
c) sh.getBalancerLockDetails()
d) all of the mentioned

View Answer

Answer: b [Reason:] sh._adminCommand() runs a database command against the admin database, like db.runCommand(), but can confirm that it is issued against a mongos.

2. Point out the correct statement:
a) The unique constraint on indexes ensures that only one document can have a value for a field in a collection
b) MongoDB support creating new unique indexes in sharded collections
c) If you use a compound shard key, you cannot enforce uniqueness on the combination of component keys in the shard key
d) All of the mentioned

View Answer

Answer: a [Reason:] For sharded collections these unique indexes cannot enforce uniqueness because insert and indexing operations are local to each shard.

3. ________ tests to see if the mongo shell is connected to a mongos instance.
a) sh._checkMongos()
b) sh.addShard()
c) sh._lastMigration()
d) all of the mentioned

View Answer

Answer: a [Reason:] The sh._checkMongos() method throws an error message if the mongo shell is not connected to a mongos instance.

4. _______ reports on the active balancer lock, if it exists.
a) sh._checkFullName()
b) sh._adminCommand()
c) sh.getBalancerLockDetails()
d) all of the mentioned

View Answer

Answer: c [Reason:] sh._checkFullName() tests a namespace to determine if its well formed.

5. Point out the wrong statement :
a) The best way to ensure a field has unique values is to generate universally unique identifiers (UUID,) such as MongoDB’s ‘ObjectId values
b) Most deployments will not need to shard the files collection
c) The files collection is typically small, and only contains metadata
d) None of the mentioned

View Answer

Answer: d [Reason:] None of the required keys for GridFS lend themselves to an even distribution in a sharded situation.

6. _________ reports on the last chunk migration.
a) sh._checkMongos()
b) sh.addShard()
c) sh._lastMigration()
d) all of the mentioned

View Answer

Answer: c [Reason:] The sh._lastMigration() method returns a document with details about the last migration performed on the database or collection.

7. _________ removes an association between a range shard keys and a shard tag.
a) sh.removeTagRange()
b) sh._checkMongos()
c) sh.disableBalancing()
d) none of the mentioned

View Answer

Answer: a [Reason:] Use sh.removeShardTag() to ensure that unused or out of date ranges are removed and hence chunks are balanced as required.

8. _________ disable balancing on a single collection in a sharded database.
a) sh.removeTagRange()
b) sh._checkMongos()
c) sh.disableBalancing()
d) none of the mentioned

View Answer

Answer: c [Reason:] sh.disableBalancing() does not affect balancing of other collections in a sharded cluster.

9. _______ activates the sharded collection balancer process if previously disabled using sh.disableBalancing().
a) sh.getBalancerHost()
b) sh.enableBalancing()
c) sh.enableSharding()
d) all of the mentioned

View Answer

Answer: a [Reason:] sh.enableSharding() enables sharding on a specific database.

10. ________ returns a boolean to report if the balancer is currently enabled.
a) sh.getBalancerHost()
b) sh.enableBalancing()
c) sh.getBalancerState()
d) none of the mentioned

View Answer

Answer: c [Reason:] sh.getBalancerState() returns true when the balancer is enabled and false if the balancer is disabled.

MongoDB MCQ Set 5

1. The ________ collection stores a document for each change to the metadata of a sharded collection.
a) version
b) changelog
c) settings
d) all of the mentioned

View Answer

Answer: b [Reason:] The config database is internal: applications and administrators should not modify or depend upon its content in the course of normal operation.

2. Point out the correct statement:
a) The local database supports sharded cluster operation
b) The config database is a dependable API, and users should not write data to the config database in the course of normal operation or maintenance
c) Modification of the config database on a functioning system may lead to instability or inconsistent data sets
d) All of the mentioned

View Answer

Answer: c [Reason:] If you must modify the config database, use mongodump to create a full backup of the config database.

3. The _________ collection stores a document for each sharded collection in the cluster.
a) help
b) shards
c) collections
d) all of the mentioned

View Answer

Answer: c [Reason:] Shard keys are immutable and cannot be changed after insertion.

4. You can return a list of the collections, with the following helper:
a) show collects
b) show collection
c) show collections
d) all of the mentioned

View Answer

Answer: c [Reason:] To access the config database, connect to a mongos instance in a sharded cluster, and use the following helper: use config.

5. Point out the wrong statement :
a) Database servers store the metadata for a sharded cluster
b) Always back up the config database before doing any maintenance on the config server
c) The mongos instances cache metadata and use it to route read and write operations to shards
d) None of the mentioned

View Answer

Answer: a [Reason:] The metadata reflects state and organization of the sharded data sets and system.

6. ________ is a string that holds the address of the client, a mongos instance that initiates this change.
a) config.changelog.serverAddr
b) config.changelog.clientAddr
c) config.changelog.time
d) all of the mentioned

View Answer

Answer: b [Reason:] config.changelog.time is ISODate timestamp that reflects when the change occurred.

7. The _______ collection keeps track of the active components in the sharded cluster.
a) deploys
b) lockpings
c) locks
d) all of the mentioned

View Answer

Answer: b [Reason:] The locks collection stores a distributed lock.

8. If the collection is empty then MongoDB will create the index as part of the ________
a) shardCollectionkey()
b) shardCollection()
c) keyCollection()
d) all of the mentioned

View Answer

Answer: b [Reason:] MongoDB provides no method to deactivate sharding for a collection after calling shardCollection.

9. Changing the _______ option will change the port that mongod listens for incoming connections on.
a) –shardsrvkey
b) –shardsrv
c) –shard
d) All of the mentioned

View Answer

Answer: b [Reason:] The single-shard cluster is now a non-sharded replica set that will accept read and write operations on the data set.

10. The _____________ collection holds documents for each tagged shard key range in the cluster.
a) tags
b) databases
c) version
d) none of the mentioned

View Answer

Answer: a [Reason:] The version collection holds the current metadata version number.