- 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 - Which of the following is correct explanation of MongoDB processes?
A - mongod.exe is the shell process and mongo.exe is the actual database process
B - mongo.exe is the shell process and mongod.exe is the actual database process
C - mongos.exe is the MongoDB server process needed to run database
D - mongodump.exe can be used to import database backup dump
Answer : B
Explanation
The core components in the MongoDB package are: mongod, the core database process; mongos the controller and query router for sharded clusters; and mongo the interactive MongoDB Shell.
Answer : A
Explanation
In the default configuration, MongoDB writes data to the main data files on disk every 60 seconds.
Q 3 - In our posts collection, which command can be used to find all the posts whose author names begin lie between “A” and “C” in dictionary order?
A - db.posts.find( { post_author : { $gte : "A" , $lte : "C" } } );
B - db.posts.find( { post_author : { $gte : "C" , $lte : "A" } } );
C - db.posts.find( { post_author : { $gt : "A" , $lt : "C" } } );
Answer : A
Explanation
The $gt, $lt and related operators can be applied for string manipulations too. They work in the same manner as they would work on numeric values.
Q 4 - What does the following query do when performed on the posts collection?
db.posts.update({_id:1},{Title:This is post with ID 1"})
A - Updates the Title of the post
B - Updating a document is possible only with $set
C - Replaces the complete document with _id as 1 with the document specified in second parameter
Answer : C
Explanation
Updating a document without using $set replaces the entire document with whatever document is specified in second parameter.
Q 5 - Which of the following operator can be used to limit the number of documents in an array field of a document after an update is performed?
Answer : A
Explanation
You can iterate over all the array elements using $each, slice them using $slice and then push them back to the document using $push.
Q 6 - What is the equivalent command in MongoDB for the following SQL query?
SELECT * FROM posts WHERE author like "%john%"
A - db.posts.find( { author: /john/ } )
B - db.posts.find( { author: {$like: /john/} } )
Answer : A
Explanation
db.posts.find( { author: /john/ } )
Answer : B
Explanation
The minimum number of sensible number of voting nodes is 3.
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 tags in a replica set configuration specify the operations to be read from the node with the least network latency?
Answer : C
Explanation
Operations read from member of the replica set with the least network latency, irrespective of the member’s type.
Q 10 - What does the following $slice query return using the following command?
db.posts.find( {}, { comments: { $slice: [ -10, 5 ] } } )
A - Returns 5 comments, beginning with the last 10 items
B - Returns 10 comments, beginning with the first
Answer : A
Explanation
The $slice operation selects the document collection identified by a field named field that holds value and returns the number of elements specified by the value of count from the array stored in the array field.
To Continue Learning Please Login
Login with Google