Mongodb Mock Test
Mongodb Mock Test
This section presents you various set of Mock Tests related to MongoDB Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
A - Concurrency Control
B - Transaction Management
C - Atomicity
D - Performance Management
A - Fixed Size
B - If the allocated space for a capped collection exceeds, it stops inserting new documents
C - High-throughput operations that insert and retrieve documents based on insertion order
D - Only a and c
A - database.system.indexes
B - database.system.namespaces
C - admin.system.users
D - admin.system.preferences
Q 4 - What is the equivalent command in MongoDB for the following SQL query?
D - db.posts.findauthor: / john /
Q 5 - For capped collection, cursors which do not automatically close and remain open
after the client exhausts the results are called:
A - Capped Cursors
B - Tailable Cursors
C - Open Cursors
D - Indexing Cursors
A - 16 MB
B - 255 K
C - 1 MB
D - 2 MB
Q 7 - Which of the following collections are used by MongoDB to store GridFS data?
Q 8 - Which is the correct order lowesttohighest in which MongoDB compares the BSON
types?
A - matchmovesbeforesort
B - sortmovesbeforematch
C - MongoDB does not do any movements by default and will use the order provided
D - Providing these parameters in any order does not impact the performance
A - Manual References
B - DBRefs
C - Both a and b
A - $group
B - $match
C - $aggregate
D - $sum
db.posts.aggregate( [
{ $match : { likes : { $gt : 100, $lte : 200 } } },
{ $group: { _id: null, count: { $sum: 1 } } }
] );
A - Calculates the number of posts with likes between 100 and 200
B - Groups the posts by number of likes 101, 102, 103 by adding 1 every time
C - Fetches the posts with likes between 100 and 200 and sets their _id as null
D - Fetches the posts with likes between 100 and 200, sets the _id of the first document as null
and then increments it 1 every time
Q 14 - What does the output x of the following MongoDB aggregation query result
into:
Q 15 - Consider that you have a collection called population which has fields state and
city. Which of the following query will calculate the population grouped by state and
city?
A-2
B-3
C-4
D-5
Q 17 - 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. What should be the value of j?
A-0
B-1
C-2
D-7
Q 18 - 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?
A-0
B-1
C-3
D-7
A - mongo shell
B - mongod
D - mongos
Q 20 - The following aggregation option is used to specify the specific fields that
needs to be passed to the next stage of the aggregation pipeline:
A - $match
B - $project
C - $group
D - $aggregate
{
"_id" : 1,
"post_text" : "This post does not matter",
"tags": [ "tutorial", "fun", "learning"],
// rest of the document
}
Q 22 - Which of the following command is used to get all the indexes on a collection?
A - db.collection.getIndexes
B - db.collection.showIndexes
C - db.collection.findIndexes
D - db.showIndexes
{
"_id":1,
"post_text":"This is a sample post",
"author":"Tom",
"comments":[
{
"author":"Joe",
"comment_text":"This is comment 1"
},
{
"author":"Leo",
"comment_text":"This is comment 2"
}
]
}
Q 24 - Which of the following commands create an unique index on author field of the
posts collection?
A - WHERE
B - HAVING
D - GROUP BY
ANSWER SHEET
1 A
2 D
3 D
4 A
5 B
6 B
7 A
8 A
9 A
10 B
11 C
12 B
13 A
14 C
15 A
16 B
17 B
18 C
19 C
20 B
21 A
22 A
23 B
24 A
25 C
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js