0% found this document useful (0 votes)
1K views7 pages

Mongodb Mock Test

Uploaded by

Luna Cañiza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views7 pages

Mongodb Mock Test

Uploaded by

Luna Cañiza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

MONGODB MOCK TEST

http://www.tutorialspoint.com Copyright © tutorialspoint.com

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.

MONGODB MOCK TEST III

Q 1 - Update If Correct is an approach for which of the following concepts in


MongoDB:

A - Concurrency Control

B - Transaction Management

C - Atomicity

D - Performance Management

Q 2 - Which of the following about Capped Collections is correct?

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

Q 3 - Which of the following is not a system collection in MongoDB?

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?

SELECT * FROM posts WHERE author like "%john%"


A - db.posts.findauthor: /john/

B - db.posts.findauthor: $like: /john/

C - db.posts.find$like: author: /john/

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

Q 6 - What is the default size of a GridFS chunk?

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?

A - fs.files and fs.chunks

B - fs.grid and fs.chunks

C - fs.parts and fs.files

D - fs.chunks and fs.parts

Q 8 - Which is the correct order lowesttohighest in which MongoDB compares the BSON
types?

A - Null, Number, String and Object

B - Number, Null, String and Object

C - String, Null, Number and Object

D - Null, Number, Object and String

Q 9 - As per the aggregation pipeline optimization concepts, if you have a sortfollowedbya


match:

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

Q 10 - Aggregation Pipelines have a limit of:

A - 2 MB document and 100 MB RAM

B - 16 MB document and 100 MB RAM

C - 2 MB document and no limit on RAM

D - No limit on document and 100 MB RAM

Q 11 - Which of the following methods can be used in MongoDB for relation


documents?

A - Manual References

B - DBRefs

C - Both a and b

D - There is no concept of relations in documents

Q 12 - Which of the following command inside aggregate command is used in


MongoDB aggregation to filter the documents to pass only the documents that match
the specified conditions to the next pipeline stage.

A - $group

B - $match

C - $aggregate

D - $sum

Q 13 - What does the following aggregate query perform?

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:

db.posts.aggregate[$group: id:" $author " , x: $sum:" $likes " ]

A - Average of likes on all the posts of an author, grouped by author


B - Number of posts by an author

C - Sum of likes on all the posts by an author, grouped by author

D - Sum of likes on all the posts by all the authors

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?

Q 16 - What is the minimum sensible number of voting nodes to a replica set?

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

Q 19 - In a sharded replicas set environment with multiple mongos servers, which of


the following would decide the mongos failover?

A - mongo shell

B - mongod

C - individual language drivers

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

Q 21 - Given the following posts document:

{
"_id" : 1,
"post_text" : "This post does not matter",
"tags": [ "tutorial", "fun", "learning"],
// rest of the document
}

What will be the output of following query:

db.posts.aggregate[$unwind:" $tags " ]

A - Return three separate documents for three separate tags

B - Arranges the tags wind in ascending order

C - Arranges the tags wind in descending order

D - Returns one document but converts the tags array in an object

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

Q 23 - Given a collection posts as shown below having a document array comments,


which of the following command will create an index on the comment author
descending?

{
"_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?

Q 25 - Which of the following SQL terminology is same as $match in MongoDB?

A - WHERE

B - HAVING

C - Both WHERE and HAVING

D - GROUP BY

ANSWER SHEET

Question Number Answer Key

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

You might also like