Explore topic-wise MCQs in Mongodb.

This section includes 43 Mcqs, each offering curated multiple-choice questions to sharpen your Mongodb knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following operator is not very selective?

A. $nine
B. $nin
C. $ain
D. None of the mentioned
Answer» C. $ain
2.

Which of the following statement will insert 400 documents in to the testData collection?

A. insertData("test", "testData", 200)
B. insertData("test", "testData", 400)
C. insertData("test", "testData", 600)
D. all of the mentioned
Answer» C. insertData("test", "testData", 600)
3.

When you query a collection, MongoDB returns a ________ object that contains the results of the query.

A. row
B. cursor
C. colums
D. none of the mentioned
Answer» C. colums
4.

_________ is used to view statistics about the query plan for a given query.

A. db.explain()
B. cursor.explain()
C. cursor.explainstats()
D. all of the mentioned
Answer» C. cursor.explainstats()
5.

Which of the following is not a projection operator?

A. $slice
B. $elemMatch
C. $
D. None of the mentioned
Answer» E.
6.

Applications can also control the behavior of write operations using _______ concern.

A. read
B. write
C. truncate
D. all of the mentioned
Answer» C. truncate
7.

Which of the following operation adds a new document to the users collection?

A. add
B. insert
C. truncate
D. drop
Answer» C. truncate
8.

Which of the following query selects documents in the records collection that match the condition { “user_id”: { $lt: 42 } }?

A. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
B. db.records.find( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
C. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 1 } )
D. db.records.select( { “user_id”: { $lt: 42 } }, { “history”: 0 } )
Answer» C. db.records.findOne( { “user_id”: { $lt: 42 } }, { “history”: 1 } )
9.

MongoDB stores all documents in _____________

A. tables
B. collections
C. rows
D. all of the mentioned
Answer» C. rows
10.

To suppress the _id field from the result set, specify _________ in the projection document.

A. _id: 1
B. _id: 0
C. _id: it
D. None of the mentioned
Answer» C. _id: it
11.

Which of the following is the second argument to projection?

A. findOne()
B. findOne1()
C. selectOne()
D. find()
Answer» E.
12.

The __________ method limits the number of documents in the result set.

A. limit()
B. limitOf()
C. limitBy()
D. none of the mentioned
Answer» B. limitOf()
13.

An index cannot cover a query on a _______ collection when run against a mongos if the index does not contain the shard key.

A. vertical
B. sharded
C. horizontal
D. none of the mentioned
Answer» C. horizontal
14.

The mongo shell loads and parses the ___________ file on startup.

A. mongo.js
B. mongoc.js
C. mongorc.js
D. all of the mentioned
Answer» D. all of the mentioned
15.

Which of the following will display complete list of available cursor flags?

A. cursor.Option()
B. cursor.addOption()
C. cursor.addOptions()
D. all of the mentioned
Answer» C. cursor.addOptions()
16.

To iterate the cursor and return more documents, type _________ in the mongo shell.

A. cursor
B. it
C. next
D. none of the mentioned
Answer» C. next
17.

Which of the following flag can be set by mongo shell?

A. Timeout
B. noTimeout
C. Time
D. None of the mentioned
Answer» C. Time
18.

Which of the following method returns a cursor?

A. find
B. sort
C. skip
D. all of the mentioned
Answer» B. sort
19.

A ________ query plan has returned a threshold number of matching results.

A. execution
B. unordered
C. ordered
D. none of the mentioned
Answer» D. none of the mentioned
20.

Which of the following line skips the first 5 documents in the bios collection and returns all remaining documents?

A. db.bios.find().limit( 5 )
B. db.bios.find().skip( 1 )
C. db.bios.find().skip( 5 )
D. db.bios.find().sort( 5 )
Answer» D. db.bios.find().sort( 5 )
21.

Which of the following method corresponds to Order by clause in SQL?

A. sort()
B. order()
C. orderby()
D. all of the mentioned
Answer» B. order()
22.

Which of the following pipeline is used for aggregation in MongoDB?

A. data processing
B. information processing
C. knowledge processing
D. none of the mentioned
Answer» B. information processing
23.

_id is a ________ bytes hexadecimal number which assures the uniqueness of every document.

A. 13
B. 16
C. 12
D. 10
Answer» D. 10
24.

Which of the following functionality is used for aggregation framework?

A. $match
B. $project
C. $projectmatch
D. All of the mentioned
Answer» C. $projectmatch
25.

With a receipt acknowledged write concern, the _________confirms that it received the write operation and applied the change to the in-memory view of data.

A. mongod
B. mongos
C. mongo
D. mongoc
Answer» B. mongos
26.

Which of the following function is valid for creation of new data inside MongoDB Shell?

A. function insertData(dbName, colName, num)
B. function insertData(dbName, colName, num)
C. insertData(dbName, colName, num)
D. None of the mentioned
Answer» B. function insertData(dbName, colName, num)
27.

Which of the following method returns true if the cursor has documents?

A. hasMethod()
B. hasNext()
C. hasDoc()
D. all of the mentioned
Answer» C. hasDoc()
28.

_____ can modify specific fields of an existing document or documents or replace an existing document entirely, depending on the update parameter.

A. modify()
B. update()
C. find()
D. none of the mentioned
Answer» C. find()
29.

Which of the following method is called while accessing documents using the array index notation?

A. cur.toArray()
B. cursor.toArray()
C. doc.toArray()
D. all of the mentioned
Answer» C. doc.toArray()
30.

Which of the following key is used to denote uniqueness in the collection?

A. _id
B. id
C. id_
D. none of the mentioned
Answer» B. id
31.

___________ concern describes the guarantee that MongoDB provides when reporting on the success of a write operation.

A. Write
B. Read
C. Update
D. None of the mentioned
Answer» B. Read
32.

With an __________ write concern, MongoDB does not acknowledge the receipt of write operations.

A. Nacknowledged
B. Acknowledgement
C. Acknowledged
D. Unacknowledged
Answer» E.
33.

A query _______ consists of a combination of query, sort, and projection specifications.

A. plan
B. shape
C. stats
D. all of the mentioned
Answer» C. stats
34.

MongoDB process collection of documents using _________ operations.

A. Hbase
B. Hive
C. Map-reduce
D. None of the mentioned
Answer» D. None of the mentioned
35.

Which of the following preference determines how the client direct read operations to the set?

A. read
B. write
C. update
D. delete
Answer» B. write
36.

In MongoDB _________ operations modify the data of a single collection.

A. CRUD
B. GRID
C. READ
D. All of the mentioned
Answer» B. GRID
37.

MongoDB does not ___________ modifications made before the wtimeout interval expired.

A. commit
B. rollback
C. save
D. all of the mentioned
Answer» C. save
38.

Which of the following will implicitly create the collection testData?

A. while (var i = 1; i <= 25; i++)
B. for (var i = 1; i <= 25; i++)
C. for (var i = 1; i <= 25; i++)
D. None of the mentioned
Answer» C. for (var i = 1; i <= 25; i++)
39.

Which of the following operation is used to switch to new database mydb?

A. use dbs
B. use db
C. use mydb
D. use mydbs
Answer» D. use mydbs
40.

__________ is a part of the standard MongoDB distribution and provides a full JavaScript environment.

A. mongod
B. mongodb
C. mongo
D. none of the mentioned
Answer» D. none of the mentioned
41.

Which of the following method is used to query documents in collections?

A. find
B. move
C. shell
D. replace
Answer» B. move
42.

Which of the following also returns a list of databases?

A. show databases
B. show database
C. display dbs
D. all of the mentioned
Answer» B. show database
43.

Command to check existence of collection is _____________

A. show collection
B. show collections
C. show collect
D. none of the mentioned
Answer» C. show collect