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 : D

Explanation

MongoDB provides specific supports for functionalities related to 2d and 3d geospatial problems.

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.

Q 3 - Which of the following commands can cause the database to be locked?

A - Issuing a query

B - Inserting data

C - Map-reduce

D - All of the above

Answer : D

Explanation

All the above commands wither result in a read lock or a write lock or both.

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 option should be used with findAndModify() command to return the modified document instead of the pre-modification document?

A - findAndModify by default returns the pre-modification document

B - Set {new : true}

C - Use the POST version of findAndModify called findAndModifyPost

D - Both b and c are valid

Answer : B

Explanation

When true, returns the modified document rather than the original. The findAndModify() method ignores the new option for remove operations. The default is false.

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.

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

A - 2

B - 3

C - 4

D - 5

Answer : B

Explanation

The minimum number of sensible number of voting nodes is 3.

Q 8 - 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()

Answer : A

Explanation

db.collection.getIndexes() is the correct choice.

Q 9 - Which of the following is the correct syntax for starting a new mongod process and specifying its replica set name as rs0:

A - mongod --replSet "rs0"

B - mongod --repl "rs0"

C - mongod "rs0"

D - First execute this: mongod --replSet. And then execute this: rs.add()

Answer : A

Explanation

Replica set can be set/stated using the –replSet command and specifying the replica name with it.

Q 10 - The ________ operator limits the contents of an array field from the query results to contain only the first element matching the query condition.

A - $

B - $elemMatch

C - $slice

D - An array cannot be retrieved element wise in MongoDB.

Answer : B

Explanation

The $elemMatch operator limits the contents of an array field from the query results to contain only the first element matching the $elemMatch condition.


mongodb_questions_answers.htm

Advertisements