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. Before version _______ capped collections did not have an _id field.
a) 2.1
b) 2.4
c) 3.0
d) 2.2

View Answer

Answer: d [Reason:] In version 2.2 and newer, capped collections do have an _id field, except those in the local database.

2. Point out the wrong statement :
a) You can create indexes on fields within embedded documents
b) Indexes on embedded fields is similar to indexes on embedded documents
c) Indexes on embedded fields allow you to use a “dot notation,” to introspect into embedded documents
d) None of the mentioned

View Answer

Answer: c [Reason:] Indexes on embedded fields differ from indexes on embedded documents, which include the full content up to the maximum index size of the embedded document in the index.

3. For a _____ multikey index, each indexed document can have at most one indexed field whose value is an array.
a) Hashed
b) Unique
c) Multikey
d) compound

View Answer

Answer: d [Reason:] As such, you cannot create a compound multikey index if more than one to-be-indexed field of a document is an array.

4. Which of the following indexes cannot be multikey ?
a) Hashed
b) Unique
c) Multikey
d) compound

View Answer

Answer: a [Reason:] You cannot specify a multikey index as the shard key index.

5. Point out the wrong statement :
a) You may not create compound indexes that have hashed index fields
b) The order of the fields in a compound index is very important
c) You will receive a warning if you attempt to create a compound index that includes a hashed index
d) None of the mentioned

View Answer

Answer: c [Reason:] You will receive an error if you attempt to create a compound index that includes a hashed index.

6. To calculate geometry over an Earth-like sphere, store your location data on a spherical surface and use _____ index.
a) 2dsphere
b) 2d
c) geoHaystack
d) all of the mentioned

View Answer

Answer: a [Reason:] Secondary members replicate deletion operations from the primary.

7. ______ indexes can be constructed over arrays that hold both scalar values (e.g. strings, numbers) and nested documents.
a) Hashed
b) Unique
c) Multikey
d) Compound

View Answer

Answer: c [Reason:] Store your location data as GeoJSON objects with this coordinate-axis order: longitude, latitude.

8. The coordinate reference system for GeoJSON uses the _____ datum.
a) WGS88
b) WGS84
c) JGS88
d) None of the mentioned

View Answer

Answer: b [Reason:] Before storing your location data and writing queries, you must decide the type of surface to use to perform calculations.

9. Which of the following is used to calculate distances on a Euclidean plane ?
a) 2dsph
b) 2d
c) geoHaystack
d) all of the mentioned

View Answer

Answer: b [Reason:] Store your location data as legacy coordinate pairs

10. Queries on ________ objects always calculate on a sphere.
a) GeoBSON
b) GeoJSON
c) geoJSONB
d) All of the mentioned

View Answer

Answer: b [Reason:] Support for GeoJSON storage and queries is new in version 2.4.

MongoDB MCQ Set 2

1. Which of the following collections work in a way similar to circular buffers ?
a) Capped
b) Secondary
c) Sharded
d) All of the mentioned

View Answer

Answer: a [Reason:] Once a collection fills its allocated space, it makes room for new documents by overwriting the oldest documents in the collection.

2. Point out the correct statement :
a) Capped collections automatically remove the oldest documents in the collection without requiring scripts or explicit remove operations
b) Capped collections do not guarantee that insertion order is identical to the order on disk
c) Capped collections does not allow updates that fit the original document size
d) All of the mentioned

View Answer

Answer: a [Reason:] Document does not change its location on disk.

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

View Answer

Answer: a [Reason:] Built-in first-in-first-out property maintains the order of events, while managing storage use.

4. ___________ is also used to pre-allocate space for an ordinary collection.
a) db.createCollection.
b) db.create
c) db.createColl
d) all of the mentioned

View Answer

Answer: a [Reason:] MongoDB creates a collection implicitly when the collection is first referenced in a command.

5. Point out the wrong statement :
a) Queries need an index to return documents in insertion order
b) The options document creates a capped collection or preallocates space in a new ordinary collection
c) Capped collections have maximum size or document counts that prevent them from growing beyond maximum thresholds
d) None of the mentioned

View Answer

Answer: a [Reason:] Capped collections guarantee preservation of the insertion order.

6. If you perform a ________ on a capped collection with no ordering specified, MongoDB guarantees that the ordering of results is the same as the insertion order.
a) find()
b) write()
c) modify()
d) none of the mentioned

View Answer

Answer: a [Reason:] To retrieve documents in reverse insertion order, issue find() along with the sort() method with the $natural parameter set to -1

7. Which of the following should is used to check whether collection is capped or not ?
a) isCAP()
b) isCapped()
c) isColl()
d) none of the mentioned

View Answer

Answer: b [Reason:] Use the isCapped() method to determine if a collection is capped, as: db.collection.isCapped().

8. ___________ convert a non-capped collection to a capped collection .
a) ToCapped
b) convertToCap
c) convertToCapped
d) none of the mentioned

View Answer

Answer: c [Reason:] convertToCapped takes an existing collection ( ) and transforms it into a capped collection with a maximum size in bytes, specified by the size argument ().

9. _________ command creates the capped collection and imports the data.
a) CollectionAsCapped
b) cloneCollection
c) cloneCollectionAsCapped
d) None of the mentioned

View Answer

Answer: c [Reason:] MongoDB does not support the convertToCapped command in a sharded cluster.

10. Which of the following command obtains a global write lock and will block other operations until it has completed ?
a) ToCapped
b) isCapped
c) convertToCapped
d) None of the mentioned

View Answer

Answer: b [Reason:] If the capped size specified for the capped collection is smaller than the size of the original uncapped collection, then MongoDB will overwrite documents in the capped collection based on insertion order, or first in, first out order.

MongoDB MCQ Set 3

1. MongoDB allows administrators to direct the balancing policy using ______ aware sharding.
a) tag
b) replica
c) rack
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) Use sharded clusters if your data set approaches or exceeds the storage capacity of a single MongoDB instance
b) Use sharded clusters if a single MongoDB instance can meet the demands of your write operations, and all other approaches have not reduced contention
c) Use sharded clusters if the size of your system’s active working set will soon exceed the capacity of your system’s minimum RAM
d) All of the mentioned

View Answer

Answer: a [Reason:] The balancer is a background process that manages chunk migrations.

3. Tags are the primary mechanism to control the behavior of the _______ and the distribution of chunks in a cluster.
a) Balancer
b) Collector
c) Compactor
d) All of the mentioned

View Answer

Answer: a [Reason:] Tag aware sharding serves to improve the locality of data for sharded clusters that span multiple data centers

4. How many background process runs behind balanced cluster ?
a) 1
b) 2
c) 3
d) All of the mentioned

View Answer

Answer: b [Reason:] MongoDB ensures a balanced cluster using two background process: splitting and the balancer.

5. Point out the wrong statement :
a) To create splits, MongoDB does migrate any data or affect the shards
b) The addition of new data or the addition of new servers can result in data distribution imbalances within the cluster
c) The balancer can run from any of the query routers in a cluster
d) All of the mentioned

View Answer

Answer: a [Reason:] The balancer is a background process that manages chunk migrations.

6. _________ is a background process that keeps chunks from growing too large.
a) Splitting
b) Balancing
c) Chunking
d) All of the mentioned

View Answer

Answer: a [Reason:] When a chunk grows beyond a specified chunk size, MongoDB splits the chunk in half. Inserts and updates triggers splits.

7. The shards manage _______ migrations as a background operation between an origin shard and a destination shard.
a) cluster
b) shard
c) chunk
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. For most deployments, the default value of chunk is _____ megabytes is ideal.
a) 16
b) 32
c) 64
d) 72

View Answer

Answer: c [Reason:] Chunk size is user configurable.

9. The ______ instances are the routers for the cluster.
a) mongod
b) mongos
c) collection
d) all of the mentioned

View Answer

Answer: b [Reason:] Typically, deployments have one mongos instance on each application server.

10. A single sharded cluster must have exclusive use of its _______ servers.
a) local
b) global
c) config
d) none of the mentioned

View Answer

Answer: c [Reason:] If you have multiple sharded clusters, you will need to have a group of config servers for each cluster.

MongoDB MCQ Set 4

1. Administrators can implement collection-level access control through user-defined :
a) roles
b) replica sets
c) shards
d) none of the mentioned

View Answer

Answer: a [Reason:] By creating a role with privileges that are scoped to a specific collection in a particular database, administrators can provision users with roles that grant privileges on a collection level.

2. Point out the correct statement :
a) A rule consists of actions and the resources upon which the actions are permissible
b) Document-level access control allows developers to grant users privileges that are scoped to specific record
c) Each privilege action in a role can be scoped to a different record
d) None of the mentioned

View Answer

Answer: b [Reason:] Collection-level access control allows administrators to grant users privileges that are scoped to specific collections.

3. User can grant any role in the database to any user from any database in the system through _________ action.
a) grantRole
b) viewRole
c) killCursors
d) unlock

View Answer

Answer: a [Reason:] Apply this action to database resources.

4. User can remove any role from any user from any database in the system through _________ .
a) grantRole
b) viewRole
c) killCursors
d) revokeRole

View Answer

Answer: d [Reason:] User can view information about any role in the given database through viewRole.

5. Point out the wrong statement :
a) MongoDB uses the combination of the database name and the role name to uniquely define a role
b) A role consists of privileges that pair resources with not allowed operations
c) Roles grant users access to MongoDB resources
d) None of the mentioned

View Answer

Answer: d [Reason:] Except for roles created in the admin database, a role can only include privileges that apply to its database and can only inherit from other roles in its database.

6. _________ terminates an operation as specified by the operation ID.
a) db.killOp()
b) db.kill()
c) db.remove()
d) none of the mentioned

View Answer

Answer: a [Reason:] Only use db.killOp() to terminate operations initiated by clients and do not terminate internal database operations.

7. Which of the following allows user to view the information of any user in the given database?
a) createUser
b) viewUser
c) killCursors
d) all of the mentioned

View Answer

Answer: b [Reason:] To provide user administrators, MongoDB has userAdmin and userAdminAnyDatabase roles.

8. _________ deletes from a shard the orphaned documents whose shard key values fall into a single continuous range.
a) listallshards
b) cleanup
c) cleanupOrphaned
d) SelectIndexes

View Answer

Answer: c [Reason:] If two contiguous ranges do not belong to the shard, the cleanupOrphaned examines both ranges for orphaned documents.

9. Which of the following flushes user information from in-memory cache ?
a) grantCache
b) invalidateUserCache
c) validateUserCache
d) none of the mentioned

View Answer

Answer: b [Reason:] invalidateUserCache allows you to purge the cache at any given moment, regardless of the interval set in the userCacheInvalidationIntervalSecs parameter.

10. __________ displays the cached query plans for the specified query shape.
a) CacheListPlans
b) displayCacheListPlans
c) planCacheListPlans
d) none of the mentioned

View Answer

Answer: b [Reason:] The query optimizer only caches the plans for those query shapes that can have more than one viable plan.

MongoDB MCQ Set 5

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

View Answer

Answer: b [Reason:] Queries specify criteria, or conditions, that identify the documents that MongoDB returns to the clients.

2. Point out the correct statement :
a) Secondary indexes allow applications to store a view of a portion of the collection in an efficient data structure
b) MongoDB has full support for secondary indexes
c) Most indexes store an ordered representation of all values of a field or a group of fields
d) All of the mentioned

View Answer

Answer: b [Reason:] Secondary indexes is used to enhance the performance of common queries and updates.

3. MongoDB stores all documents in :
a) tables
b) collections
c) rows
d) all of the mentioned

View Answer

Answer: b [Reason:] Collections are analogous to a table in relational databases.

4. In MongoDB, _________ operations modify the data of a single collection.
a) CRUD
b) GRID
c) READ
d) All of the mentioned

View Answer

Answer: a [Reason:] Data modification refers to operations that create, update, or delete data.

5. Point out the wrong statement :
a) Indexes cannot enforce uniqueness in collection
b) CRUD stands for create, read, update, and delete
c) CRUD application is the most simplest application
d) All of the mentioned

View Answer

Answer: a [Reason:] Indexes may also enforce uniqueness, store objects in a geospatial representation, and facilitate text search.

6. Which of the following operation adds a new document to the users collection ?
a) add
b) insert
c) truncate
d) drop

View Answer

Answer: b [Reason:] For the update and delete operations, you can specify the criteria to select the documents to update or remove.

7. Which of the following preference determines how the client direct read operations to the set ?
a) read
b) write
c) update
d) delete

View Answer

Answer: a [Reason:] For replica sets and sharded clusters with replica set components, applications specify read preferences.

8. Applications can also control the behavior of write operations using _______ concern.
a) read
b) write
c) truncate
d) all of the mentioned

View Answer

Answer: b [Reason:] Write concern semantics allow clients to specify the assurance that MongoDB provides when reporting on the success of a write operation.

9. MongoDB process collection of documents using _________ operations.
a) Hbase
b) Hive
c) Map-reduce
d) None of the mentioned

View Answer

Answer: c [Reason:] In addition to the basic queries, MongoDB provides several data aggregation features.

10. Which of the following pipeline is used for aggregation in MongoDB ?
a) data processing
b) information processing
c) knowledge processing
d) none of the mentioned

View Answer

Answer: a [Reason:] MongoDB can return counts of the number of documents that match a query, or return the number of distinct values for a field.