Mongodb Mock Test
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 - Posts with likes greater than 100 but less than 200
B - Posts with likes greater than or equal to 100 but less than or equal to 200
Q 2 - Consider that our posts collection contains an array field called tags that
contains tags that the user enters.
{
_id: 1,
tags: ["tutorial", "fun", "learning"],
post_text: "This is my first post",
//other elements of document
}
Which of the following commands will find all the posts that have been tagged as
tutorial?
Q 3 - Which of the following is the most important consideration while designing the
schema for MongoDB?
A - The schema should match the data access and query patterns
A - update
B - $push
C - Both a and b
A - ACID Transactions
C - Journaling
D - Transaction Management
Q 6 - Consider that our posts collection contains an array field called tags that
contains tags that the user enters.
{
_id: 1,
tags: ["tutorial", "fun", "learning"],
post_text: "This is my first post",
//other elements of document
}
B - All the posts which contains only one tag element in the tag array
C - All the posts having the first element of the tags array as tutorial
Q 7 - Consider that the posts collection contains an array called ratings which contains
ratings given to the post by various users in the following format:
{
_id: 1,
post_text: "This is my first post",
ratings: [5, 4, 2, 5],
//other elements of document
}
Which of the following query will return all the documents where the array ratings
contains at least one element between 3 and 6?
Q 8 - Consider that the posts collection contains an array called ratings which contains
ratings given to the post by various users in the following format:
{
_id: 1,
post_text: "This is my first post",
ratings: [5, 4, 2, 5],
//other elements of document
}
Which of the following query will return all the documents where the ratings array
contains elements that in some combination satisfy the query conditions?
Q 9 - Which option should be used to update all the documents with the specified
condition in the MongoDB query?
Q 10 - What does the following query do when performed on the posts collection?
C - Replaces the complete document with _id as 1 with the document specified in second
parameter
D - Syntax error
Q 11 - What does the following query do when performed on the posts collection?
A - Sets the complete document with _id as 1 with the document specified in second parameter
by replacing it completely
B - Adds a new field Author in the searched collection if not already present
D - Both b and c
Q 12 - Which option can be used with update command so that a new document gets
created if no matching document is found based on the query condition?
D - This has to be handled in application code Node.js, PHP, JAVA, C#, etc. and cannot be handled in
mongo shell query
Q 13 - Consider that you are using { upsert : true } option in your update command.
Which of the following parameters will be used to determine if any new documents
were inserted:
A - nMatched
B - nInserted
C - nModified
D - nUpserted
Q 14 - Which of the following commands removes a single document that matches the
condition that Author is Joe?
D - Both b and c
Which of the following queries will return the documents but with only the first two
tags in the tags array?
D - Both a and c are valid. $slice works both with projection and limit.
A - $elemMatch
B - $slice
C-$
Q 19 - 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?
A - pushalongwitheach, sortandslice
B - $removeFromSet
C - $arrayLimit
A - cursor.next
B - cursor.hasNext
C - cursor.forEach
A - C++
B - Java
C - Python
D - MongoC
A - Compound Indexes
B - Multikey Indexes
C - Geospatial Indexes
A - Tailable Cursor
C - Compound Indexing
ANSWER SHEET
1 C
2 A
3 A
4 C
5 C
6 C
7 A
8 B
9 B
10 C
11 D
12 A
13 D
14 D
15 C
16 B
17 A
18 D
19 A
20 D
21 A
22 D
23 B
24 A
25 B
Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js