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

Answer : C

Explanation

The skip and limit functions are applies linearly and hence it will first skip documents 1-5, and then return documents 6-10.

Q 2 - Which of the following replica sets vote in the election of a primary replica set?

A - Secondary

B - Hidden

C - Delayed

D - All of the above

Answer : D

Explanation

All members of a replica set, unless the value of votes is equal to 0, vote in elections. This includes all delayed, hidden and secondary-only members.

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.

Answer : D

Explanation

$set sets the specific fields in the matched documents or adds them as a new field if not already present.

Q 5 - Which type of indexes does MongoDB support?

A - Compound Indexes

B - Multikey Indexes

C - Geospatial Indexes

D - All of the above

Answer : D

Explanation

MongoDB supports all of the above mentioned indexes.

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

Answer : A

Explanation

GridFS stores files in two collections: chunks stores the binary chunks and files stores the file’s metadata.

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

Answer : B

Explanation

The $project operator passes along the documents with only the specified fields to the next stage in the pipeline. The specified fields can be existing fields from the input documents or newly computed fields.

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 9 - In a sharded replica set environment, w defines the level and kind of write concern. Which of the following values of w specifies to return success only after a majority of voting members have acknowledged?

A - n

B - majority

C - m

D - major

Answer : B

Explanation

For replica sets, if you specify the special majority value to w option, write operations will only return successfully after a majority of the voting members of the replica set have acknowledged the write operation.

Q 10 - Which of the following operator can be used to control the number of items of an array that a query returns?

A - $

B - $elemMatch

C - $slice

D - MongoDB does not support partial retrieval of items from an array

Answer : C

Explanation

The $slice operator controls the number of items of an array that a query returns.


mongodb_questions_answers.htm

Advertisements
E-Books Store