- MongoDB Tutorial
- 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
- Advanced MongoDB
- 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 Useful Resources
- MongoDB - Questions and Answers
- MongoDB - Quick Guide
- MongoDB - Useful Resources
- MongoDB - Discussion
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 - Which is the default mode in which the explain() command runs?
Answer : A
Explanation
Default mode is "queryPlanner".
Q 3 - Which of the following command can be used to check the size of a collection named posts?
Answer : A
Explanation
To view the statistics for a collection, including the data size, use the db.collection.stats() method from the mongo shell.
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 are the ONLY ways to project portions of an array?
Answer : D
Explanation
$elemMatch, $slice, and $ are the only way to project portions of an array. For e.g. you cannot use {“tags.0”:1} for projection.
Q 6 - Aggregation Pipelines have a limit of:
A - 2 MB document and 100 MB RAM
B - 16 MB document and 100 MB RAM
Answer : B
Explanation
Pipeline stages have a limit of 100 megabytes of RAM. If a stage exceeds this limit, MongoDB will produce an error. If the aggregate command returns a single document that contains the complete result set, the command will produce an error if the result set exceeds the BSON Document Size limit, which is currently 16 megabytes.
Q 7 - In a sharded replica set environment, the w Option provides ability for write concern and j Option provides ability for the data to be written on disk journal. Consider that we have a seven member replica set and we want to assure that the writes are committed to journal as well as acknowledged by at least 3 nodes. What should be the value of w?
Answer : C
Explanation
The value of w determines the writes are committed and acknowledged by some minimum number of nodes which in this case is 3.
Q 8 - Which of the following SQL terminology is same as $match in MongoDB?
Answer : C
Explanation
In MongoDB, we use $match as the aggregation operator corresponding to WHERE and HAVING condition in MongoDB.
Q 9 - We can insert multiple documents in bulk using which of the following operations:
Answer : A
Explanation
The initializeUnorderedBulkOp operation returns an unordered operations builder which maintains a list of operations to perform. Unordered operations means that MongoDB can execute in parallel as well as in nondeterministic order.
Q 10 - When should we consider representing a one-to-many relationship in an embedded collection instead of separate collection?
A - When the many is very large
Answer : B
Explanation
If the many is very large, then we should create separate collection, else the document size would go on increasing.
To Continue Learning Please Login
Login with Google