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. ___________ selects geometries that intersect with a GeoJSON geometry.
a) $near
b) $nearsphere
c) $geoIntersect
d) None of the mentioned

View Answer

Answer: c [Reason:] The 2dsphere index supports $geoIntersects.

2. Point out the wrong statement :
a) If $near or $nearSphere query specifies the center point as a GeoJSON point, specify the distance as a non-negative number in meters
b) If $nearSphere query specifies the center point as legacy coordinate pair, specify the distance as a non-negative number in radians
c) $near can only use the 2dsphere index if the query specifies the center point as a GeoJSON point
d) None of the mentioned

View Answer

Answer: d [Reason:]$minDistance filters the results of a geospatial $near or $nearSphere query to those documents that are at least the specified distance from the center point.

3. _______ returns geospatial objects in proximity to a point.
a) $near
b) $nearsphere
c) $geoIntersect
d) None of the mentioned

View Answer

Answer: a [Reason:]$near requires a geospatial index.

4. _________ specifies a geometry in GeoJSON format to geospatial query operators.
a) $sphere
b) $geoin
c) $geometry
d) All of the mentioned

View Answer

Answer: c [Reason:]$geometry uses EPSG:4326 as the default coordinate reference system (CRS).

5. Point out the correct statement :
a) Both 2dsphere and 2d geospatial indexes support $geoWithin
b) $geoWithin does not require a geospatial index
c) The $geoWithin operator does not return sorted results
d) None of the mentioned

View Answer

Answer: b [Reason:] However, a geospatial index will improve query performance.

6. _________ returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index.
a) $near
b) $nearsphere
c) $geoIntersect
d) None of the mentioned

View Answer

Answer: b [Reason:] The 2dsphere and 2d indexes support $nearSphere.

7. __________ specifies a minimum distance to limit the results of $near and $nearSphere queries.
a) $center
b) $maxDistance
c) $minDistance
d) All of the mentioned

View Answer

Answer: c [Reason:]$minDistance is available for use with 2dsphere index only.

8. The __________ operator constrains the results of a geospatial $near or $nearSphere query to the specified distance.
a) $center
b) $maxDistance
c) $minDistance
d) All of the mentioned

View Answer

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

9. The _________ operator specifies a circle for a $geoWithin query.
a) $within
b) $gwithin
c) $center
d) All of the mentioned

View Answer

Answer: c [Reason:] The query returns legacy coordinate pairs that are within the bounds of the circle.

10. ________ index must exist on a field holding coordinates before using any of the geospatial query operators.
a) Unique
b) Geospatial
c) Temporal
d) All of the mentioned

View Answer

Answer: b [Reason:] Only the 2d geospatial index supports $center.

MongoDB MCQ Set 2

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

View Answer

Answer: c [Reason:] mongo provides complete access to the JavaScript language and all standard functions as well as a full database interface for MongoDB.

2. Point out the correct statement :
a) MMS provides backup and monitoring
b) MongoDB can also be configured for data replication
c) MMS is available to all users in the cloud and on-premises as part of MongoDB Standard and Enterprise Subscriptions
d) All of the mentioned

View Answer

Answer: d [Reason:] MongoDB is limited to a total data size of about 2GB for all databases in 32-bit mode.

3. mongo looks for a database server listening on port 27017 on the ________ interface.
a) web
b) localhost
c) web host
d) all of the mentioned

View Answer

Answer: b [Reason:] To connect to a server on a different port or interface, use the –port and –host options.

4. After starting the mongo shell, your session will use the ________ database by default.
a) mongo
b) master
c) test
d) primary

View Answer

Answer: c [Reason:] At any time,db operation at the mongo shell is used to report the name of the current database.

5. Point out the wrong statement :
a) MongoDB works right out of the box, and you can dive right into developing your application, instead of spending a lot of time fine-tuning obscure database configurations
b) MongoDB works hard to be very easy to install, configure, maintain, and use
c) MongoDB does not provide a lot of the features of a traditional RDBMS
d) None of the mentioned

View Answer

Answer: c [Reason:] MongoDB focuses on flexibility, power, speed, and ease of use.

6. ___________ command display the list of databases.
a) show db
b) show dbs
c) show data
d) display dbs

View Answer

Answer: b [Reason:] Show dbs print a list of all databases on the server.

7. Which of the following operation is used to switch to new database mydb ?
a) use dbs
b) use db
c) use mydb
d) use mydbs

View Answer

Answer: c [Reason:] .Confirm that your session has the mydb database as context, by checking the value of the db object, which returns the name of the current database.

8. Which of the following also returns a list of databases ?
a) show databases
b) show database
c) display dbs
d) All of the mentioned

View Answer

Answer: a [Reason:] show databases is new in version 2.4.

9. Command to check existence of collection is :
a) show collection
b) show collections
c) show collect
d) None of the mentioned

View Answer

Answer: b [Reason:] The mongo shell will return the list of the collections in the current database.

10. Which of the following method is used to query documents in collections ?
a) find
b) move
c) shell
d) replace

View Answer

Answer: a [Reason:] The find() method with no parameters returns all documents from a collection and returns all fields for the documents.

MongoDB MCQ Set 3

1. ___________ is a specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.
a) FSpec
b) GridFS
c) Grid
d) None of the mentioned

View Answer

Answer: b [Reason:] Instead of storing a file in a single document, GridFS divides a file into parts, or chunks.

2. Point out the correct statement :
a) GridFS uses two collections to store files
b) You cannot perform range queries on files stored through GridFS
c) Applications that handle temporal and spatial data often require capturing fractional units of currency
d) All of the mentioned

View Answer

Answer: a [Reason:] One collection stores the file chunks, and the other stores file metadata.

3. By default GridFS limits chunk size to ______ k.
a) 225
b) 255
c) 256
d) None of the mentioned

View Answer

Answer: b [Reason:] GridFS is useful not only for storing files that exceed 16MB but also for storing any files for which you want access without having to load the entire file into memory.

4. When you query a GridFS store for a file, the _______ will reassemble the chunks as needed.
a) client
b) Server
c) Agent
d) None of the mentioned

View Answer

Answer: a [Reason:] You also can access information from arbitrary sections of files, which allows you to “skip” into the middle of a video or audio file.

5. Point out the wrong statement :
a) Chunks in the context of GridFS is related to the use of the term chunks in the context of sharding
b) The default chunk size changed from 256k to 255k
c) If you need to query the database for exact, mathematically valid matches, use Ambiguity Precision
d) None of the mentioned

View Answer

Answer: a [Reason:] By default, GridFS uses two collections with names prefixed by fs bucket.

6. MongoDB represents queries as ___________ objects.
a) BSON
b) JSON
c) GSON
d) None of the mentioned

View Answer

Answer: a [Reason:] As a client program assembles a query in MongoDB, it builds a BSON object, not a string.

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

View Answer

Answer: a [Reason:] Each chunk is identified by its unique ObjectId stored in its _id field.

8. GridFS uses a _________ index on the chunks collection for the files_id and n fields.
a) unique
b) single
c) non unique
d) none of the mentioned

View Answer

Answer: a [Reason:] The files_id field contains the _id of the chunk’s “parent” document.

9. The ___ field contains the sequence number of the chunk.
a) x
b) array
c) field
d) n

View Answer

Answer: d [Reason:] GridFS numbers all chunks, starting with 0.

10. The GridFS index allows efficient retrieval of __________ using the files_id and n values
a) chunks
b) files
c) bson
d) none of the mentioned

View Answer

Answer: a [Reason:] When you query for a large file, GridFS automatically reassembles the smaller files into the original large file.

MongoDB MCQ Set 4

1. To modify an existing index, you cannot just re-issue the _________ method with the updated specification of the index.
a) dropIndex()
b) modIndex()
c) createIndex()
d) none of the mentioned

View Answer

Answer: c [Reason:] To modify the index, you must drop the index first.

2. Point out the wrong statement :
a) To modify an existing index, you need to drop and recreate the index
b) Your client library may have a different or additional interface for this operation
c) To see the status of an indexing process, you can use the db.statusOp() method in the mongo shell
d) None of the mentioned

View Answer

Answer: c [Reason:] To see the status of an indexing process, you can use the db.currentOp() method in the mongo shell.

3. If you need to rebuild indexes for a collection you can use the _________ method to rebuild all indexes on a collection in a single operation.
a) db.collection.Index()
b) db.collection.reIndex()
c) db.collection.rebuildIndex()
d) none of the mentioned

View Answer

Answer: a [Reason:] This operation drops all indexes, including the _id index, and then rebuilds all indexes.

4. To terminate an ongoing index build, use the __________ method in the mongo shell.
a) db.currentOp()
b) db.killOp()
c) db.removeOp()
d) all of the mentioned

View Answer

Answer: b [Reason:] For index builds, the effects of db.killOp() may not be immediate and may occur well after much of the index build operation has completed.

5. Point out the correct statement :
a) After 4.0, you cannot terminate both background index builds and foreground index builds
b) Before MongoDB 2.1, you could only terminate background index builds
c) After 2.4, you can terminate both background index builds and foreground index builds
d) None of the mentioned

View Answer

Answer: c [Reason:] You cannot terminate a replicated index build on secondary members of a replica set.

6. In the mongo shell, you can use the ______ method to return a list of the indexes on a collection.
a) getallIndexes()
b) getretIndexes()
c) getIndexes()
d) none of the mentioned

View Answer

Answer: c [Reason:] When performing maintenance you may want to check which indexes exist on a collection.

7. __________ views partial execution statistics collected during plan selection
a) curs.explain()
b) cursor.explain()
c) cursr.explain()
d) all of the mentioned

View Answer

Answer: b [Reason:] Run db.collection.explain() or the cursor.explain() method in allPlansExecution mode.

8. The __________ operator constrains the results of a geospatial $near or $nearSphere query to the specified distance.
a) $center
b) $maxDistance
c) $minDistance
d) all of the mentioned

View Answer

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

9. To force MongoDB to use a particular index for a db.collection.________ operation, specify the index with the hint() method.
a) query()
b) find()
c) index()
d) all of the mentioned

View Answer

Answer: b [Reason:] Append the hint() method to the find() method.

10. Specify the ______ operator to the hint() method to prevent MongoDB from using any index
a) $unique
b) $natural
c) $spatial
d) all of the mentioned

View Answer

Answer: b [Reason:] To view the execution statistics for a specific index, append to the db.collection.find() the hint() method followed by cursor.explain()

MongoDB MCQ Set 5

1. ________ indexes expire documents after the specified number of seconds has passed since the indexed field value.
a) Hashed
b) Unique
c) Multikey
d) TTL

View Answer

Answer: d [Reason:] The expiration threshold is the indexed field value plus the specified number of seconds.

2. Point out the correct statement :
a) If you build a TTL index in the foreground, MongoDB does not remove expired documents as soon as the index finishes building
b) The TTL index does guarantee that expired data will be deleted immediately upon expiration
c) Duration of the removal operation depends on the workload of your mongod instance
d) None of the mentioned

View Answer

Answer: c [Reason:] There may be a delay between the time a document expires and the time that MongoDB removes the document from the database.

3. When the TTL thread is active, you will see _______ operations in the output of db.currentOp()
a) delete
b) update
c) insert
d) none of the mentioned

View Answer

Answer: a [Reason:] A background thread in mongod reads the values in the index and removes expired documents from the collection.

4. The background task that removes expired documents runs every ________ seconds.
a) 15
b) 45
c) 60
d) 120

View Answer

Answer: c [Reason:] As a result, documents may remain in a collection during the period between the expiration of the document and the running of the background task.

5. Point out the wrong statement :
a) The unique constraint applies to separate documents in the collection
b) Unique index prevents separate documents from having the same value for the indexed key
c) Index does prevent a document from having multiple elements or embedded documents in an indexed array from having the same value
d) None of the mentioned

View Answer

Answer: c [Reason:] In the case of a single document with repeating values, the repeated value is inserted into the index only once.

6. On replica sets, the TTL background thread only deletes documents on :
a) primary
b) secondary
c) upadte
d) none of the mentioned

View Answer

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

7. You can combine the ________ constraint with the sparse index to filter these null values from the unique index and avoid the error.
a) Hashed
b) Unique
c) sparse
d) compound

View Answer

Answer: c [Reason:] If a document does not have a value for the indexed field in a unique index, the index will store a null value for this document.

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. You may not specify a unique constraint on a ______ index.
a) Hashed
b) Unique
c) Sparse
d) Compound

View Answer

Answer: a [Reason:] Because of the unique constraint, MongoDB will only permit one document that lacks the indexed field.

10. Which of the following indexes are always sparse ?
a) 2dsphere
b) 2d
c) geoHaystack
d) all of the mentioned

View Answer

Answer: d [Reason:] 2dsphere (version 2), 2d, geoHaystack, and text indexes are always sparse.

.woocommerce-message { background-color: #98C391 !important; }