MongoDB Online Quiz



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

$set is used to set the value of a particular field in a document. The syntax of set is $set:{column_name : column_value}. Also, {multi:true} is needed to update all the documents. Otherwise only the first found document is updated.

Q 2 - What is the maximum size of Index Key Limit and Number of Indexes per collection?

A - 64 bytes and 1024 indexes

B - 12 mega bytes and 64 indexes

C - 1024 bytes and 64 indexes

D - 1024 bytes and unlimited indexes

Answer : C

Explanation

The total size of an index entry, which can include structural overhead depending on the BSON type, must be less than 1024 bytes. A single collection can have no more than 64 indexes.

Answer : A

Explanation

The efficiency of a MongoDB database depends on how well the database is designed depending on the application usage. The schema should be designed based on how the data access patterns are.

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 - If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which of the following option is correct?

A - The query used an index to fetch the results

B - The query returned 30000 documents after scanning the documents

C - The query returned 0 documents

D - None of the above

Answer : A

Explanation

When an index covers a query, the explain result has an IXSCAN stage that is not a descendant of a FETCH stage, and in the executionStats, the totalDocsExamined is 0.

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 - Which format/standard is used by MongoDB internally to store documents?

A - BSON

B - JSON

C - JSON - Extended

D - B+ Trees

Answer : A

Explanation

MongoDB uses BSON, a binary object format similar to, but more expressive than JSON.

Q 10 - Which index is used to index the content stored in arrays?

A - Multikey Index

B - Compound Index

C - Text Index

D - Sparse Index

Answer : A

Explanation

MongoDB uses multikey indexes to index the content stored in arrays. If you index a field that holds an array value, MongoDB creates separate index entries for every element of the array.

mongodb_questions_answers.htm
Advertisements