
- MongoDB - Home
- MongoDB - Overview
- MongoDB - Advantages
- MongoDB - Environment
- MongoDB - Data Modeling
- MongoDB - Create Database
- MongoDB - Drop Database
- MongoDB - Create Collection
- MongoDB - Drop Collection
- MongoDB - Data Types
- MongoDB - Insert Document
- MongoDB - Query Document
- MongoDB - Update Document
- MongoDB - Delete Document
- MongoDB - Projection
- MongoDB - Limiting Records
- MongoDB - Sorting Records
- MongoDB - Indexing
- MongoDB - Aggregation
- MongoDB - Replication
- MongoDB - Sharding
- MongoDB - Create Backup
- MongoDB - Deployment
- MongoDB - Java
- MongoDB - PHP
- MongoDB - Relationships
- MongoDB - Database References
- MongoDB - Covered Queries
- MongoDB - Analyzing Queries
- MongoDB - Atomic Operations
- MongoDB - Advanced Indexing
- MongoDB - Indexing Limitations
- MongoDB - ObjectId
- MongoDB - Map Reduce
- MongoDB - Text Search
- MongoDB - Regular Expression
- Working with Rockmongo
- MongoDB - GridFS
- MongoDB - Capped Collections
- Auto-Increment Sequence
MongoDB Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to MongoDB Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - What kind of database MongoDB is?
Answer : B
Explanation
MongoDB stores data in JSON structure based documents. These documents in turn contains data in form of key value pairs.
Q 2 - mongoimport command is used to:
A - import all the data from one database to another
B - import all the data from one collection to another
C - imports content from an Extended JSON, CSV, or TSV export created by mongoexport
Answer : C
Explanation
The mongoimport tool imports content from an Extended JSON, CSV, or TSV export created by mongoexport, or potentially, another third-party export tool.
Q 3 - By default, the MongoDB cursor in mongo shell is configured to return how many documents? To get the next set of documents, which command is used?
Answer : A
Explanation
In the mongo shell, if the returned cursor is not assigned to a variable using the var keyword, then the cursor is automatically iterated up to 20 times [1] to print up to the first 20 documents in the results. To get the next set of results, you should use it command which will iterate over the next set of results.
Q 4 - What does the following query do when performed on the posts collection?
db.posts.update({_id:1},{$set:{Author:Tom"}})
B - Adds a new field Author in the searched collection if not already present
C - Updates only the Author field of the document with _id as 1
Answer : D
Explanation
$set sets the specific fields in the matched documents or adds them as a new field if not already present.
Q 5 - Which option should be used with findAndModify() command to return the modified document instead of the pre-modification document?
A - findAndModify by default returns the pre-modification document
C - Use the POST version of findAndModify called findAndModifyPost
Answer : B
Explanation
When true, returns the modified document rather than the original. The findAndModify() method ignores the new option for remove operations. The default is false.
Q 6 - Which of the following is not a system collection in MongoDB?
Answer : D
Explanation
There is no system collection to store database preferences.
Q 7 - The following aggregation option is used to specify the specific fields that needs to be passed to the next stage of the aggregation pipeline:
Answer : B
Explanation
The $project operator passes along the documents with only the specified fields to the next stage in the pipeline. The specified fields can be existing fields from the input documents or newly computed fields.
Q 8 - What is a replica set node which does not maintain its own data but exists only for voting purpose called?
Answer : B
Explanation
We may add an extra mongod instance to a replica set as an arbiter. Arbiters do not maintain a data set. Arbiters only exist to vote in elections. If your replica set has an even number of members, add an arbiter to obtain a majority of votes in an election for primary. Arbiters do not require dedicated hardware
Q 9 - Which of the following operators can reverse the effects of a double unwind operation?
Answer : A
Explanation
An unwind operation unwinds on an array field and creates separate documents. If you unwind it again same thing happens again. So if you had one document which had two arrays, the first array had 2 values and second array has 3 values. Unwinding this document two times will give 6 document. Now to combine them back, you can use the $push operator.
Q 10 - Which of the following operator can be used to control the number of items of an array that a query returns?
D - MongoDB does not support partial retrieval of items from an array
Answer : C
Explanation
The $slice operator controls the number of items of an array that a query returns.