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. To support ________ based sharding, MongoDB provides a hashed index type,
a) primary
b) root
c) hash
d) all of the mentioned

View Answer

Answer: c [Reason:] These indexes have a more random distribution of values along their range, but only support equality matches and cannot support range-based queries.

2. Point out the correct statement :
a) Whether the use of a compound index or the use of an index intersection is more efficient depends on the particular query and the system
b) Certain restrictions apply to indexes, such as the length of the index keys or the number of indexes per collection
c) For queries that specify compound query conditions, if one index can fulfill a part of a query condition, and another index can fulfill another part of the query condition, then MongoDB can use the intersection of the two indexes to fulfill the query
d) None of the mentioned

View Answer

Answer: d [Reason:] In general, each index intersection involves two indexes; however, MongoDB can employ multiple/nested index intersections to resolve a query.

3. ________ index type, which indexes the hash of the value of a field.
a) Hashed
b) Unique
c) Multikey
d) None of the mentioned

View Answer

Answer: a [Reason:] Hashed indexes support equality matches and cannot support range-based queries.

4. The _________ property for an index causes MongoDB to reject duplicate values for the indexed field.
a) Hashed
b) Unique
c) Multikey
d) None of the mentioned

View Answer

Answer: c [Reason:] Other than the unique constraint, unique indexes are functionally interchangeable with other MongoDB indexes.

5. Point out the wrong statement :
a) TTL index is ideal for certain types of information like machine generated event data, logs, and session information that only need to persist in a database for a finite amount of time
b) You cannot combine the sparse index option with the unique index option
c) TTL indexes are special indexes that MongoDB can use to automatically remove documents from a collection after a certain amount of time
d) None of the mentioned

View Answer

Answer: b [Reason:] You can combine to reject documents that have duplicate values for a field but ignore documents that do not have the indexed key.

6. The ______ property of an index ensures that the index only contain entries for documents that have the indexed field.
a) Hashed
b) Unique
c) Sparse
d) None of the mentioned

View Answer

Answer: c [Reason:] The index skips documents that do not have the indexed field.

7. MongoDB can use the _________ of indexes to fulfill queries.
a) union
b) intersection
c) projection
d) none of the mentioned

View Answer

Answer: b [Reason:] The $project takes a document that can specify the inclusion of fields, the suppression of the _id field, the addition of new fields, and the resetting the values of existing fields.

8. Which of the following method is to verify whether MongoDB used index intersection ?
a) explain()
b) analyze()
c) intersect()
d) none of the mentioned

View Answer

Answer: a [Reason:] To determine if MongoDB used index intersection, run explain(); the results of explain() will include either an AND_SORTED stage or an AND_HASH stage.

9. An index prefix is a subset of a ______ index, consisting of one or more keys starting from the beginning of the index.
a) Hashed
b) Unique
c) Sparse
d) Compound

View Answer

Answer: d [Reason:] With index intersection, MongoDB can use an intersection of either the entire index or the index prefix.

10. Index __________ does not eliminate the need for creating compound indexes.
a) union
b) addition
c) intersection
d) all of the mentioned

View Answer

Answer: c [Reason:] Compound index may not support a query condition that does not include the index prefix keys or that specifies a different sort order.

MongoDB MCQ Set 2

1. MongoDB indexes use a _______ data structure.
a) Hash
b) Map
c) B-tree
d) All of the mentioned

View Answer

Answer: b [Reason:] MongoDB provides a number of different index types to support specific types of data and queries.

2. Point out the correct statement :
a) If an appropriate index exists for a query, MongoDB cannot use the index to limit the number of documents it must inspect
b) Indexes support the efficient execution of queries in MongoDB
c) The index stores the location of a specific field or set of fields, ordered by the value of the field
d) None of the mentioned

View Answer

Answer: b [Reason:] Without indexes, MongoDB must perform a collection scan.

3. MongoDB supports the creation of user-defined ascending/descending indexes on a ______ field of a document.
a) Single
b) Non Unique
c) Compound
d) None of the mentioned

View Answer

Answer: a [Reason:] If applications do not specify a value for _id the driver or the mongod will create an _id field with an ObjectId value.

4. The ______ index is unique and prevents clients from inserting two documents with the same value for the _id field.
a) _id
b) $default
c) _def
d) None of the mentioned

View Answer

Answer: a [Reason:] All MongoDB collections have an index on the _id field that exists by default.

5. Point out the wrong statement :
a) MongoDB can return sorted results by using the ordering in the index
b) MongoDB defines indexes at the collection level and supports indexes on any field or sub-field of the documents in a MongoDB collection
c) Fundamentally, indexes in MongoDB is different to indexes in other database systems
d) None of the mentioned

View Answer

Answer: c [Reason:] Indexes are special data structures that store a small portion of the collection’s data set in an easy to traverse form.

6. MongoDB also supports user-defined indexes on multiple fields called :
a) compound
b) composite
c) candidate
d) none of the mentioned

View Answer

Answer: a [Reason:] The order of fields listed in a compound index has significance.

7. MongoDB uses ______ indexes to index the content stored in arrays.
a) singlekey
b) multikey
c) compkey
d) none of the mentioned

View Answer

Answer: b [Reason:] If you index a field that holds an array value, MongoDB creates separate index entries for every element of the array.

8. ___________ indexes use spherical geometry to return results.
a) 3sphere
b) 2sphere
c) 1sphere
d) none of the mentioned

View Answer

Answer: b [Reason:] To support efficient queries of geospatial coordinate data, MongoDB provides two special indexes.

9. MongoDB provides a ________ index type that supports searching for string content in a collection.
a) string
b) text
c) char
d) none of the mentioned

View Answer

Answer: b [Reason:] These text indexes do not store language-specific stop words (e.g. “the”, “a”, “or”) and stem the words in a collection to only store root words.

10. _____ indexes uses planar geometry when returning results.
a) 2d
b) 1d
c) 3d
d) All of the mentioned

View Answer

Answer: a [Reason:] MongoDB computes geohash values for the coordinate pairs within the specified location range and then indexes the geohash values.

MongoDB MCQ Set 3

1. __________ query calculates distances using flat (planar) geometry.
a) $center
b) $centre
c) $radii
d) Sort

View Answer

Answer: a [Reason:] In MongoDB, sort operations can obtain the sort order by retrieving documents based on the ordering in an index.

2. Point out the wrong statement :
a) The query scans the index and not the collection
b) If overall selectivity is high, and if MongoDB must read a number of documents to return results, then some queries may perform faster without indexes
c) A better strategy, depending on your queries, would be to create a compound index that includes the high-selectivity field and another field
d) None of the mentioned

View Answer

Answer: b [Reason:] To ensure selectivity, write queries that limit the number of possible documents with the indexed field. Write queries that are appropriately selective relative to your indexed data.

3. _________ defines a circle for a geospatial query that uses spherical geometry.
a) $center
b) $centre
c) $radii
d) $centersphere

View Answer

Answer: d [Reason:] You can use the $centerSphere operator on both GeoJSON objects and legacy coordinate pairs.

4. When used with the $box operator, _________ returns documents based on grid coordinates and does not query for GeoJSON shapes.
a) $geoNear
b) $geoWithin
c) $geoRear
d) All of the mentioned

View Answer

Answer: b [Reason:] To use the $box operator, you must specify the bottom left and top right corners of the rectangle in an array object.

5. Point out the correct statement :
a) Applications can use $center without having a geospatial index
b) Before 3.0, a geospatial index must exist on a field holding coordinates before using any of the geospatial query operators
c) To use $centerSphere, specify an array that contains grid coordinates of the circle’s center point
d) None of the mentioned

View Answer

Answer: a [Reason:] However, geospatial indexes support much faster queries than the unindexed equivalents.

6. Applications can use _________ without having a geospatial index.
a) $center
b) $centre
c) $radii
d) $centersphere

View Answer

Answer: d [Reason:] The query returns documents that are within the bounds of the circle.

7. __________ method provides a wrapper around the totalIndexSize output of the collStats (i.e. db.collection.stats()) operation.
a) db.collection.totalallIndexSize()
b) db.collection.totalIndexSizeAll()
c) db.collection.totalIndexSize()
d) all of the mentioned

View Answer

Answer: c [Reason:] To check the size of your indexes, use the db.collection.totalIndexSize() helper, which returns data in bytes.

8. _________ specifies a polygon for a geospatial $geoWithin query on legacy coordinate pairs.
a) $rect
b) $polygon
c) $poly
d) All of the mentioned

View Answer

Answer: b [Reason:] To define the polygon, specify an array of coordinate points.

9. Only the ______ geospatial index supports the $polygon operator
a) 1dsphere
b) 2d
c) 3d
d) None of the mentioned

View Answer

Answer: b [Reason:] The $polygon operator calculates distances using flat (planar) geometry.

10. ________ returns a document only once for a geospatial query even if the document matches the query multiple times.
a) $uniqueDocs
b) $unique
c) $Docs
d) All of the mentioned

View Answer

Answer: a [Reason:] Geospatial queries no longer return duplicate results.

MongoDB MCQ Set 4

1. _________ operations that use an index often have better performance than those that do not use an index.
a) Select
b) Update
c) Delete
d) Sort

View Answer

Answer: d [Reason:] In MongoDB, sort operations can obtain the sort order by retrieving documents based on the ordering in an index.

2. Point out the wrong statement :
a) The query scans the index and the collection
b) An index supports a query when the index contains all the fields scanned by the query
c) Creating indexes that support queries results in greatly increased query performance
d) None of the mentioned

View Answer

Answer: a [Reason:] The query scans the index and not the collection.

3. A prefix of a _______ index is a subset that consists of one or more keys at the start of the index key pattern.
a) unique
b) primary
c) compound
d) none of the mentioned

View Answer

Answer: b [Reason:] If the sort keys correspond to the index keys or an index prefix, MongoDB can use the index to sort the query results.

4. Sort operations that do not use an index will abort when they use _______ megabytes of memory.
a) 16
b) 32
c) 64
d) All of the mentioned

View Answer

Answer: b [Reason:] If the query planner cannot obtain the sort order from an index, it will sort the results in memory.

5. Point out the correct statement :
a) If you only ever query on a single key in a given collection, then you need to create just multikey index for that collection
b) If you sometimes query on only one key and at other times query on that key combined with a second key, then creating a compound index is more efficient than creating a single-key index
c) The choice between creating compound indexes that support your queries or relying on index intersection is independent of specifics of your system
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB will use the compound index for both queries.

6. An index can support sort operations on a non-prefix subset of the index key pattern using _________ condition.
a) predicate
b) selection
c) equality
d) none of the mentioned

View Answer

Answer: c [Reason:] Query must include equality conditions on all the prefix keys that precede the sort keys.

7. __________ method provides a wrapper around the totalIndexSize output of the collStats (i.e. db.collection.stats()) operation.
a) db.collection.totalallIndexSize()
b) db.collection.totalIndexSizeAll()
c) db.collection.totalIndexSize()
d) all of the mentioned

View Answer

Answer: c [Reason:] To check the size of your indexes, use the db.collection.totalIndexSize() helper, which returns data in bytes.

8. To avoid creating an index with a name that exceeds the index name length limit, you can pass the _____ option to the db.collection.createIndex() method.
a) name
b) lang
c) number
d) all of the mentioned

View Answer

Answer: a [Reason:] The measuring units for the maximum distance are determined by the coordinate system in use.

9. Indexes do not have to fit entirely into ______ in all cases.
a) ROM
b) RAM
c) Secondary Storage
d) None of the mentioned

View Answer

Answer: a [Reason:] There are some limited cases where indexes do not need to fit in memory.

10. ________ is the ability of a query to narrow results using the index.
a) Causality
b) Cardinality
c) Selectivity
d) All of the mentioned

View Answer

Answer: b [Reason:] Effective indexes are more selective and allow MongoDB to use the index for a larger portion of the work associated with fulfilling the query.

MongoDB MCQ Set 5

1. For each _______ the Kerberos Key Distribution Center (KDC) maintains a database of the realm’s principal and the principals’ associated “secret keys”.
a) key
b) realm
c) document
d) none of the mentioned

View Answer

Answer: b [Reason:] Principals belong to administrative units called realms.

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

View Answer

Answer: a [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. To authenticate using Kerberos, you must add the Kerberos user principals to MongoDB to the _________ database.
a) $internal
b) $external
c) $extern
d) None of the mentioned

View Answer

Answer: b [Reason:] For every user you want to authenticate using Kerberos, you must create a corresponding user in MongoDB in the $external database.

5. Point out the wrong statement :
a) Authorization determines the verified user’s access to resources and operations
b) MongoDB does not support authentication mechanisms
c) To authenticate a client in MongoDB, you must add a corresponding user to MongoDB
d) None of the mentioned

View Answer

Answer: b [Reason:] In addition to verifying the identity of a client, MongoDB can require members of replica sets and sharded clusters to authenticate their membership.

6. To specify a different value for , use ________ during the start up of mongod.
a) servicepwd
b) serviceName
c) servicelogin
d) none of the mentioned

View Answer

Answer: b [Reason:] mongo shell or other clients may also specify a different service principal name using serviceName.

7. Linux systems can store Kerberos authentication keys for a service principal in ______ files.
a) Client
b) Server
c) keytab
d) All of the mentioned

View Answer

Answer: c [Reason:] To keep keytab files secure, use file permissions that restrict access to only the user that runs the mongod or mongos process.

8. MongoDB __________ supports authentication using a Kerberos service.
a) Standard
b) Express
c) Enterprise
d) None of the mentioned

View Answer

Answer: c [Reason:] Kerberos is an industry standard authentication protocol for large client/server systems.

9. On Linux, MongoDB clients can use Kerberos’s _______ program to initialize a credential cache for authenticating the user principal to servers.
a) knight
b) kinit
c) Knite
d) None of the mentioned

View Answer

Answer: b [Reason:] Unlike on Linux systems, mongod and mongos instances running on Windows do not require access to keytab files.

10. The MongoDB _________ Console interface does not support Kerberos authentication.
a) TCP
b) HTTP
c) HTTPS
d) None of the mentioned

View Answer

Answer: b [Reason:] Each host that runs a mongod or mongos instance must have both A and PTR DNS records to provide forward and reverse lookup.