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 - The MongoDB explain() method does not support which of the following verbosity mode:

A - queryPlanner

B - executionStats

C - allPlansExecution

D - customExecutionStats

Answer : D

Explanation

The possible modes of explain() are: "queryPlanner", "executionStats", and "allPlansExecution".

Q 2 - Within how much time does MongDB writes are written to the journal?

A - 60 s

B - 100 ms

C - 1 s

D - 100 s

Answer : B

Explanation

Writes are physically written to the journal within 100 milliseconds, by default.

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 - What does the following query do when performed on the posts collection?

db.posts.update({_id:1},{Title:This is post with ID 1"})

A - Updates the Title of the post

B - Updating a document is possible only with $set

C - Replaces the complete document with _id as 1 with the document specified in second parameter

D - Syntax error

Answer : C

Explanation

Updating a document without using $set replaces the entire document with whatever document is specified in second parameter.

Q 5 - Which language is MongoDB written in?

A - C++

B - Java

C - Python

D - MongoC

Answer : A

Explanation

MongoDB is written in C++.

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

A - 16 MB

B - 255 K

C - 1 MB

D - 2 MB

Answer : B

Explanation

By default GridFS limits chunk size to 255k.

Answer : A

Explanation

You have to give state and city as the key to group by and then calculate the sum of the population in each city.

Q 8 - In a replica set, a ________ number of members ensures that the replica set is always able to select a primary.

A - Odd

B - Even

C - Depends on the application architecture

D - 2

Answer : A

Explanation

An odd number of members ensures that the replica set is always able to elect a primary. If you have an even number of members, add an arbiter to get an odd number.

Q 9 - The oplog (operations log) is a special capped collection that keeps a rolling record of all operations that modify the data stored in your databases. All the replica set members contain a copy of the oplog in the following collection:

A - oplog.rs

B - local.oplog.rs

C - <database>..oplog.rs

D - <replicasetid>.oplog.rs

Answer : B

Explanation

All replica set members contain a copy of the oplog, in the local.oplog.rs collection, which allows them to maintain the current state of the database.

Answer : A

Explanation

The $slice operation selects the document collection identified by a field named field that holds value and returns the number of elements specified by the value of count from the array stored in the array field.


mongodb_questions_answers.htm

Advertisements