MongoDB Online Quiz


Advertisements

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.

Questions and Answers

Q 1 - A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?

A - Table and Row

B - Table and Column

C - Column and Row

D - Database and Table

Answer : A

Explanation

The way SQL databases stores data rows in a table, MonngoDB stores documents inside collections.

Q 2 - What is the maximum size of a MongoDB document?

A - 2 MB

B - 16 MB

C - 12 MB

D - There is no maximum size. It depends on the RAM.

Answer : B

Explanation

The maximum BSON document size is 16 megabytes. The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth.

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 - Which of the following commands removes a single document that matches the condition that Author is Joe?

A - db.posts.removeOne( { Author : "Joe" }, 1 )

B - db.posts.remove( { Author : "Joe" }, 1 )

C - db.posts.remove( { Author : "Joe" }, {justOne: true} )

D - Both b and c

Answer : D

Explanation

The third parameter to the remove function is justOne. You can either simply say 1 or write justOne as true.

Q 5 - Which of the following methods can be used on a cursor object?

A - cursor.next()

B - cursor.hasNext()

C - cursor.forEach()

D - All of the above

Answer : D

Explanation

All of the above methods can be used on a cursor object.

Q 6 - 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

Answer : A

Explanation

The Update if Current pattern is an approach to concurrency control when multiple applications have access to the data.

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?

A - 0

B - 1

C - 3

D - 7

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 aggregation commands in MongoDB does not support sharded collections?

A - aggregate

B - mapReduce

C - group

D - All of the above

Answer : C

Explanation

The group command in MongoDB groups documents in a collection by the specified key and performs simple aggregation functions, such as computing counts and sums. It is the most basic one and does not support such sharding concepts.s

Q 10 - The _______ operator can be used to identify an element in the array to be updated without explicitly specifying the position of the element.

A - $

B - $elemMatch

C - $slice

D - Updating an array field without knowing its index is not possible.

Answer : A

Explanation

The positional $ operator identifies an element in an array to update without explicitly specifying the position of the element in the array.

mongodb_questions_answers.htm
Advertisements