Explore topic-wise InterviewSolutions in .

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

101.

How many types of locking modes exist in MongoDB?(a) 1(b) 2(c) 3(d) More than 3This question was posed to me during an online interview.I need to ask this question from Database Profiler in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The CORRECT ANSWER is (d) More than 3

Explanation: There are four possible LOCKING modes for the LOCK types.

102.

Point out the correct statement.(a) 2 is returned by mongod if there is a mismatch between hostnames specified on the command line and in the local.sources collection(b) When an index covers a query, MongoDB can both match the query conditions and return the results using only the index keys(c) Both 2 and 4 are returned by mongod if there is a mismatch between hostnames specified on the command line and in the local.sources collection(d) All of the mentionedThis question was posed to me in examination.I'm obligated to ask this question of Exit Codes and Statuses in portion Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

Right choice is (a) 2 is returned by mongod if there is a mismatch between hostnames specified on the command line and in the local.sources COLLECTION

The explanation is: mongod may ALSO return this status if OPLOG collection in the local DATABASE is not readable.

103.

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 mentionedThe question was posed to me during an interview for a job.My doubt stems from Database Profiler topic in division Production Checklist, Security Concepts and Network Security of MongoDB

Answer» RIGHT answer is (a) system.profile.locks.acquireCount

To elaborate: 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.
104.

Which of the following code is used for the successful exit of task?(a) 0(b) 1(c) 2(d) 3I got this question during an interview for a job.My question is from Exit Codes and Statuses topic in portion Production Checklist, Security Concepts and Network Security of MongoDB

Answer» CORRECT option is (a) 0

Easy explanation: 0 is RETURNED by MongoDB applications UPON successful exit.
105.

Which of the following keyword represents lock on the collection?(a) Database(b) Collection(c) Metadata(d) All of the mentionedThis question was addressed to me by my school teacher while I was bunking the class.The above asked question is from Database Profiler topic in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The CORRECT choice is (b) Collection

Best explanation: DATABASE REPRESENTS database LOCK.

106.

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 mentionedThis question was addressed to me by my college professor while I was bunking the class.My enquiry is from Database Profiler topic in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The CORRECT choice is (d) None of the mentioned

The explanation: MongoDB operations can also yield locks between individual document MODIFICATIONS in write operations that affect multiple documents LIKE update() with the multi PARAMETER.

107.

Which of the following information is captured by database profiler?(a) Read operations(b) Write operations(c) Cursor Operations(d) All of the mentionedThe question was posed to me in an online quiz.This intriguing question comes from Database Profiler topic in chapter Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The correct choice is (d) All of the mentioned

For explanation I WOULD say: The database profiler CAPTURES DATA INFORMATION about read and write operations, CURSOR operations, and database commands.

108.

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 mentionedI have been asked this question in an international level competition.My question is taken from Database Profiler topic in portion Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

Right answer is (b) system.profile.LOCKS

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.

109.

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 mentionedThis question was posed to me in class test.My doubt stems from Database Profiler in division Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

Correct answer is (d) All of the mentioned

Easy explanation: USE limit() to maximize performance and PREVENT MongoDB from returning more results than REQUIRED for PROCESSING.

110.

Which of the following collection is capped?(a) system.index(b) system.replica(c) system.profile(d) all of the mentionedI got this question in an interview.I want to ask this question from Database Profiler in division Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The correct answer is (C) system.profile

Explanation: The database profiler writes DATA in the system.profile COLLECTION, which is a capped collection.

111.

______ is used to load all the scripts saved in the system.js collection for the current database.(a) db.loadServerScripts()(b) db.loadScripts()(c) db.loadServerScriptsjs()(d) none of the mentionedThis question was addressed to me by my college professor while I was bunking the class.My doubt is from System Collections topic in division Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The correct OPTION is (a) db.loadServerScripts()

EXPLANATION: The DOCUMENTS in the system.js collection provide FUNCTIONS that your applications can use in any JAVASCRIPT context with MongoDB in this database.

112.

Which of the following The collection holds special JavaScript code for use in server side JavaScript?(a) .system.jserver(b) .system.jscript(c) .system.js(d) none of the mentionedThis question was addressed to me in unit test.I need to ask this question from System Collections topic in portion Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

Right OPTION is (c) .system.js

The BEST EXPLANATION: Do not STORE application LOGIC in the database.

113.

Which of the following can store JavaScript functions for reuse?(a) store.js(b) system.js(c) system.store.js(d) save.jsThis question was addressed to me by my college professor while I was bunking the class.This interesting question is from System Collections in chapter Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The CORRECT CHOICE is (B) system.js

Easiest EXPLANATION: To store a function, you can use the db.collection.save().

114.

The .system.indexes collection lists all the _________ in the database.(a) serverinfo(b) indexes(c) profiling(d) all of the mentionedI got this question in homework.Query is from System Collections topic in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer» RIGHT answer is (b) indexes

To ELABORATE: The .system.profile COLLECTION stores database PROFILING information. For information on profiling.
115.

Point out the wrong statement.(a) The “hard” ulimit refers to the maximum number of processes that a user can have active at any time(b) The “soft” ulimit refers to the minimum number of processes that a user can have active at any time(c) ulimit will modify both “hard” and “soft” values unless the -H or -S modifiers are specified when modifying limit values(d) None of the mentionedThe question was asked in an internship interview.My question is from System Collections topic in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer» CORRECT answer is (B) The “soft” ulimit refers to the minimum number of PROCESSES that a user can have ACTIVE at any time

To ELABORATE: There are both “hard” and the “soft” ulimits that affect MongoDB’s performance.
116.

Point out the correct statement.(a) You can limit the number of incoming connections using the maxConnections run-time option(b) mongos instances maintain a connection pool to each shard so that the mongos can reuse connections(c) You can use the limit command at the system prompt to check system limits(d) All of the mentionedI got this question in an interview for job.Enquiry is from System Collections topic in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The correct option is (b) MONGOS instances maintain a connection POOL to each shard so that the mongos can reuse connections

To explain I would SAY: This would quickly fulfill requests without NEEDING to create new connections.

117.

The ___________ collection stores the user’s authentication credentials as well as any roles assigned to the user.(a) admin.system.auth(b) admin.system.users(c) admin.system.usersauth(d) all of the mentionedI have been asked this question by my college professor while I was bunking the class.Query is from System Collections topic in division Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

Correct answer is (b) admin.system.users

For EXPLANATION I would SAY: Users MAY define authorization ROLES in the admin.system.roles collection.

118.

In replica sets, each ________ maintains a connection to all other members of the set.(a) serverInfo(b) mongod(c) mongos(d) none of the mentionedThis question was posed to me by my school principal while I was bunking the class.My enquiry is from System Collections in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer» CORRECT option is (b) MONGOD

To elaborate: mongod uses background threads for a number of internal processes, including TTL collections, replication, and replica SET health checks, which may REQUIRE a small number of additional resources.
119.

MongoDB stores additional instance-local metadata in the _______ database.(a) Master(b) Model(c) Local(d) All of the mentionedThe question was posed to me during a job interview.The origin of the question is System Collections in section Production Checklist, Security Concepts and Network Security of MongoDB

Answer»

The CORRECT choice is (C) Local

To explain I would SAY: It is stored specifically for replication PURPOSES.