MongoDB Questions and Answers – Database Profiler

«
»

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Database Profiler”.

1. Which of the following information is captured by database profiler?
a) Read operations
b) Write operations
c) Cursor Operations
d) All of the mentioned
View Answer

Answer: d
Explanation: The database profiler captures data information about read and write operations, cursor operations, and database commands.

2. Point out the correct statement.
a) A limit() value of 0 (i.e. .limit(0)) is equivalent to setting no limit
b) The behavior of limit() is undefined for values less than -231 and greater than 231
c) You can use the ulimit command at the system prompt to check system limits
d) All of the mentioned
View Answer

Answer: d
Explanation: Use limit() to maximize performance and prevent MongoDB from returning more results than required for processing.

advertisement

3. Which of the following collection is capped?
a) system.index
b) system.replica
c) system.profile
d) all of the mentioned
View Answer

Answer: c
Explanation: The database profiler writes data in the system.profile collection, which is a capped collection.

4. The ___________ provides information for various lock types and lock modes held during the operation.
a) admin.system.authlocks
b) system.profile.locks
c) admin.system.locks
d) all of the mentioned
View Answer

Answer: b
Explanation: MongoDB uses reader-writer locks that allow concurrent readers shared access to a resource, such as a database or collection, but give exclusive access to a single write operation.

advertisement
advertisement

5. Point out the wrong statement.
a) Beginning with version 3.0, MongoDB ships with the WiredTiger storage engine
b) Some global operations, typically short lived operations involving multiple databases, still require a global “instance-wide” lock
c) The MMAPv1 storage engine uses collection-level locking
d) None of the mentioned
View Answer

Answer: d
Explanation: MongoDB operations can also yield locks between individual document modifications in write operations that affect multiple documents like update() with the multi parameter.

6. Which of the following keyword represents lock on the collection?
a) Database
b) Collection
c) Metadata
d) All of the mentioned
View Answer

Answer: b
Explanation: Database represents database lock.

advertisement

7. How many types of locking modes exist in MongoDB?
a) 1
b) 2
c) 3
d) More than 3
View Answer

Answer: d
Explanation: There are four possible locking modes for the lock types.

8. Which of the following represents number of times the operation acquired the lock in the specified mode?
a) system.profile.locks.acquireCount
b) system.profile.locks.acquireWaitCount
c) system.profile.locks.Count
d) none of the mentioned
View Answer

Answer: a
Explanation: system.profile.locks.acquireWaitCount is number of times the operation had to wait for the acquireCount lock acquisitions because the locks were held in a conflicting mode. acquireWaitCount is less than or equal to acquireCount.

advertisement

9. __________ can be used to limit the size of the result document for a query operation.
a) limit()
b) aggregate()
c) skip()
d) none of the mentioned
View Answer

Answer: a
Explanation: limit() is analogous to the LIMIT statement in a SQL database.

Sanfoundry Global Education & Learning Series – MongoDB.

advertisement

Here’s the list of Best Reference Books in MongoDB.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!
advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter