• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in MongoDB by
Q:

Top 25+ MongoDB MCQ Interview Questions with explanation in 2021

MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on concept of collection and document.

MongoDB automatically logs,mongodb questions,Mongodb logs slow,mongodb faq,MongoDB

Perpetuus

MongoDB, MongoDB-MCQ, MongoDO-Interview-questions, MongoDB-questions-answers, MongoDB-best-questions, Top-50-mongodb-mcq

1) Which is the method used to check the current length of replication lag?

Pick the best answer from given options

a) rs.status()

b) rs.printSlaveReplicationInfo()

c) rs.initiate()

d) rs.conf()

Correct answer for above question is : b) rs.printSlaveReplicationInfo()

2) Which of the following can be used to check the status of replica set?

Pick the best answer from given options

a) rs.status()

b) rs.initiate()

c) db.isMaster()

d) rs.conf()

Correct answer for above question is : a) rs.status()

3) Find the command that forces MongoDB to use a particular index for a db.collection.find() operation.

Pick the best answer from given options

a) explain()

b) hint()

c) hit()

Correct answer for above question is : b) hint()

4) In MongoDB, _________ helps to synchronize data across multiple servers.

Pick the best answer from given options

a) Indexes

b) Sharding

c) Replication

Correct answer for above question is : c) Replication

5) Which is the command to Check the Size of the Oplog?

Pick the best answer from given options

a) rs.conf()

b) rs.printSlaveReplicationInfo()

c) rs.initiate()

d) rs.printReplicationInfo()

Correct answer for above question is : d) rs.printReplicationInfo()

6) In MongoDB, identify the command that adds an shard with a sharded Cluster.

Pick the best answer from given options

a) add

b) Shardadd

c) addShard

d) ShardAdd

Correct answer for above question is : c) addShard

7) Which will be the command to return information on query plans and execution statistics of the query plans?

Pick the best answer from given options

a) explain()

b) stats()

c) All the Options

d) queryplan()

Correct answer for above question is : a) explain()

8) In MongoDB, _________ is the operator limits the contents of an array field from the query.

Pick the best answer from given options

a) $Match

b) $elemMatch

c) $slice

Correct answer for above question is : b) $elemMatch

MongoDB automatically logs,mongodb questions,Mongodb logs slow,mongodb faq,MongoDB

Perpetuus

9) ______ can be used to check if the connected node is primary or not?

Pick the best answer from given options

a) rs.status()

b) db.isMaster()

c) rs.conf()

d) rs.initiate()

Correct answer for above question is : b) db.isMaster()

10) Choose the indexes to index the content stored in arrays.

Pick the best answer from given options

a) Array Index

b) Singlekey indexes

c) Multikey indexes

d) Compoundkey indexes

Correct answer for above question is : c) Multikey indexes

11) Which is the method used in MongoDB to Grant user?

Pick the best answer from given options

a) db.grantRole()

b) All the Options

c) db.grantRolesToUser()

d) db.grantToUser()

Correct answer for above question is : c) db.grantRolesToUser()

12) In MongoDB, which is the storage measure used by masters oplog?

Pick the best answer from given options

a) Byte

b) MB

c) GB

d) KB

Correct answer for above question is : c) GB

13) Choose the operations that can be captured by database profiler?

Pick the best answer from given options

a) Read operations

b) Write operations

c) Cursor Operations

d) All the Options

Correct answer for above question is : d) All the Options

14) Mongo client will generate _____ command to initiate a new replica set.

Pick the best answer from given options

a) rs.initiate()

b) rs.conf()

c) db.isMaster()

d) rs.status()

Correct answer for above question is : a) rs.initiate()

15) Default size of Chunk in MongoDB is ___________.

Pick the best answer from given options

a) 64 GB

b) 128 KB

c) 64 KB

d) 64 MB

Correct answer for above question is : d) 64 MB

16) Which of the following will control the amount of logging output that mongodb writes to the log?

Pick the best answer from given options

a) operationProfiling.mode

b) operationProfiling.slowOpThresholdMs

c) systemLog.verbosity

Correct answer for above question is : c) systemLog.verbosity

17) The ____________ command returns a document that provides an overview of the databases state.

Pick the best answer from given options

a) hit()

b) explain()

c) hint()

d) ServerStatus()

Correct answer for above question is : d) ServerStatus()

18) Which model is used when there contains relationships between entities?

Pick the best answer from given options

a) External Model

b) All the Options

c) Reference Model

d) Embedded Model

Correct answer for above question is : d) Embedded Model

19) Choose the data model which allows applications to store related pieces of information in the same database record.

Pick the best answer from given options

a) External Model

b) All the Options

c) Embedded Model

d) Reference Model

Correct answer for above question is : c) Embedded Model

20) Which method is used to return information for all users associated with a database?

Pick the best answer from given options

a) db.Users()

b) db.returnUsers()

c) db.getUsers()

Correct answer for above question is : c) db.getUsers()

MongoDB, MongoDB-MCQ, MongoDO-Interview-questions, MongoDB-questions-answers, MongoDB-best-questions, Top-50-mongodb-mcq

21) Find a technique of splitting up a large collection among multiple servers.

Pick the best answer from given options

a) Indexes

b) Sharding

c) Replication

Correct answer for above question is : b) Sharding

22) By default, MongoDB automatically logs slow queries above _____ ms to the log.

Pick the best answer from given options

a) 16

b) 100

c) 64

d) 264

Correct answer for above question is : b) 100

23)  Which of the following MongoDB query is equivalent to the following SQL query:

UPDATE users SET status = "C" WHERE age > 25

a)

db.users.update(

   { age: { $gt: 25 } },

   { status: "C" })

b)

db.users.update(

 { age: { $gt: 25 } },

 { $set: { status: "C" } })

c)

db.users.update(

 { age: { $gt: 25 } },

 { $set: { status: "C" } },

 { multi: true })

d)

db.users.update(

 { age: { $gt: 25 } },

 { status: "C" },

 { multi: true })

Correct answer for above question is : 

c)

db.users.update(

 { age: { $gt: 25 } },

 { $set: { status: "C" } },

 { multi: true })

24)  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

Correct answer for above question is :c) - 1024 bytes and 64 indexes

25)  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

Correct answer for above question is : d) - All of the above

26)   Consider that you are using { upsert : true } option in your update command. Which of the following parameters will be used to determine if any new documents were inserted:

a)  nMatched

b)  nInserted

c)  nModified

d)  nUpserted

Correct answer for above question is : d) - nUpserted

27)  Which type of indexes does MongoDB support?

a)  Compound Indexes

b)  Multikey Indexes

c)  Geospatial Indexes

d)  All of the above

Correct answer for above question is : d) - All of the above

mongodb interview questions madanswer

mongodb aggregation interview questions

mongodb mcq questions

Related questions

+1 vote
asked Apr 17, 2021 in MongoDB by rajeshsharma
+1 vote
asked Apr 17, 2021 in MongoDB by rajeshsharma
...