

InterviewSolution
Saved Bookmarks
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.
251. |
Which of the following pattern is best for static trees that do not change?(a) Child(b) Parent(c) Root(d) None of the mentioned |
Answer» Correct answer is (d) None of the mentioned The best I can explain: The Nested Sets pattern provides a fast and efficient solution for finding subtrees but is inefficient for modifying the tree structure. |
|
252. |
______________ documents capture relationships between data by storing related data in a single document structure.(a) Capped(b) Embedded(c) External(d) Internal |
Answer» Correct answer is (b) Embedded For explanation I would say: MongoDB documents make it possible to embed document structures in a field or array within a document. |
|
253. |
Point out the correct statement.(a) In practice, the documents in a collection share a different structure(b) Data in MongoDB has a flexible schema(c) The key challenge in data modeling is balancing the needs of the application, the performance characteristics of the database engine, and the data retrieval patterns(d) None of the mentioned |
Answer» Right answer is (b) Data in MongoDB has a flexible schema The explanation: MongoDB’s collections do not enforce document structure. |
|
254. |
Which of the following pattern may provide a suitable solution for storing graphs?(a) Child(b) Parent(c) Root(d) None of the mentioned |
Answer» The correct option is (a) Child The best explanation: Node may have multiple parents for Child Parents. |
|
255. |
Point out the wrong statement.(a) Documents have static schema in MongoDB(b) Eventually-consistent reads can be distributed over replicated servers(c) Indexes can include keys from embedded documents and arrays(d) None of the mentioned |
Answer» Right choice is (a) Documents have static schema in MongoDB Explanation: Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents may hold different types of data. |
|
256. |
The .system.indexes collection lists all the _________ in the database.(a) serverinfo(b) indexes(c) profiling(d) all of the mentioned |
Answer» Right answer is (b) indexes To elaborate: The |
|
257. |
The ____________ pattern identifies each node in the tree as stops in a round-trip traversal of the tree.(a) Materialized Paths(b) Array of Ancestors(c) Nested Sets(d) None of the mentioned |
Answer» The correct choice is (c) Nested Sets To elaborate: The Nested Sets pattern stores each tree node in a document; in addition to the tree node, document stores the id of node’s parent, the node’s initial stop in the left field, and its return stop in the right field. |
|
258. |
The ________ Links pattern provides a simple solution to tree storage but requires multiple queries to retrieve subtrees.(a) Child(b) Parent(c) Root(d) All of the mentioned |
Answer» Right answer is (b) Parent Best explanation: You can query by the parent field to find its immediate children nodes. |
|
259. |
Point out the wrong statement.(a) You cannot query for a node in the children field to find its parent node only(b) You can query for a node in the children field to find its parent node as well as its siblings(c) You can query for a node in the children field to find its siblings only(d) None of the mentioned |
Answer» Correct option is (b) You can query for a node in the children field to find its parent node as well as its siblings The explanation is: The Child References pattern provides a suitable solution to tree storage as long as no operations on subtrees are necessary. |
|
260. |
________ store the relationships between data by including links or references from one document to another.(a) Capped(b) Embedded(c) External(d) References |
Answer» The correct option is (d) References For explanation: Applications can resolve these references to access the related data. Broadly, these are normalized data models. |
|
261. |
Data of .system.indexes can be accessed using ____________(a) listallIndexes(b) listIndexes(c) ViewIndexes(d) SelectIndexes |
Answer» Right option is (b) listIndexes To elaborate: Kerberos is an industry standard authentication protocol for large client/server systems. |
|
262. |
Point out the correct statement.(a) A rule consists of actions and the resources upon which the actions are permissible(b) Document-level access control allows developers to grant users privileges that are scoped to specific record(c) Each privilege action in a role can be scoped to a different record(d) None of the mentioned |
Answer» Right option is (b) Document-level access control allows developers to grant users privileges that are scoped to specific record The best I can explain: Collection-level access control allows administrators to grant users privileges that are scoped to specific collections. |
|
263. |
You must have the __________ action on a role’s database to grant the role to another user.(a) grantRole(b) grantRoleAdm(c) grantRolePrivilege(d) none of the mentioned |
Answer» Right answer is (a) grantRole Explanation: listIndexes returns information about the indexes on the specified collection. |
|
264. |
User can grant any role in the database to any user from any database in the system through _________ action.(a) grantRole(b) viewRole(c) killCursors(d) unlock |
Answer» Correct answer is (a) grantRole To explain I would say: Apply this action to database resources. |
|
265. |
Instance exits cleanly are represented by ___ exit code.(a) 4(b) 1(c) 2(d) 3 |
Answer» Right option is (a) 4 To elaborate: Restart mongod with the –upgrade option to upgrade the database to the version supported by this mongod instance. |
|
266. |
The ________ References pattern stores each tree node in a document; in addition to the tree node, the document stores the id of the node’s parent.(a) Child(b) Parent(c) Root(d) None of the mentioned |
Answer» The correct choice is (b) Parent To explain: Data model that describes a tree-like structure in MongoDB documents by storing references to “parent” nodes in children nodes. |
|
267. |
___________ replicas maintain a copy of the data on the primary using built-in replication.(a) Primary(b) Secondary(c) Backup(d) All of the mentioned |
Answer» The correct answer is (b) Secondary To explain I would say: When a primary replica fails, the replica set automatically conducts an election process to determine which secondary should become the primary. |
|
268. |
The _________ References pattern stores each tree node in array the id(s) of the node’s children.(a) Child(b) Parent(c) Root(d) None of the mentioned |
Answer» The correct answer is (a) Child Explanation: In addition to the tree node, document stores in an array the id(s) of the node’s children. |
|
269. |
User can remove any role from any user from any database in the system through _________(a) grantRole(b) viewRole(c) killCursors(d) revokeRole |
Answer» Right answer is (d) revokeRole Explanation: User can view information about any role in the given database through viewRole. |
|
270. |
Point out the wrong statement.(a) MongoDB uses the combination of the database name and the role name to uniquely define a role(b) A role consists of privileges that pair resources with not allowed operations(c) Roles grant users access to MongoDB resources(d) None of the mentioned |
Answer» Right option is (d) None of the mentioned The explanation: Except for roles created in the admin database, a role can only include privileges that apply to its database and can only inherit from other roles in its database. |
|
271. |
_________ deletes from a shard the orphaned documents whose shard key values fall into a single continuous range.(a) listallshards(b) cleanup(c) cleanupOrphaned(d) SelectIndexes |
Answer» Correct choice is (c) cleanupOrphaned For explanation: If two contiguous ranges do not belong to the shard, the cleanupOrphaned examines both ranges for orphaned documents. |
|
272. |
Which of the following method corresponds to Order by clause in SQL?(a) sort()(b) order()(c) orderby()(d) all of the mentioned |
Answer» Correct answer is (a) sort() Best explanation: The sort() method orders the documents in the result set. |
|
273. |
How many types of locking modes exist in MongoDB?(a) 1(b) 2(c) 3(d) More than 3 |
Answer» The correct answer is (d) More than 3 Explanation: There are four possible locking modes for the lock types. |
|
274. |
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 |
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. |
|
275. |
Point out the wrong statement.(a) Each replica set member will act in the role of primary replica only(b) The primary replica performs all writes and reads by default(c) Secondaries can also perform read operations, but the data is eventually consistent by default(d) None of the mentioned |
Answer» The correct answer is (a) Each replica set member will act in the role of primary replica only Easy explanation: Each replica set member may act in the role of the primary or secondary replica at any time. |
|
276. |
MongoDB scales horizontally using _________ for load balancing purpose.(a) Replication(b) Partitioning(c) Sharding(d) None of the mentioned |
Answer» The correct option is (c) Sharding The explanation is: The user chooses a shard key, which determines how the data in a collection will be distributed. |
|
277. |
_________ terminates an operation as specified by the operation ID.(a) db.killOp()(b) db.kill()(c) db.remove()(d) none of the mentioned |
Answer» The correct answer is (a) db.killOp() The best explanation: Only use db.killOp() to terminate operations initiated by clients and do not terminate internal database operations. |
|
278. |
Which of the following code is used for the successful exit of task?(a) 0(b) 1(c) 2(d) 3 |
Answer» Correct option is (a) 0 Easy explanation: 0 is returned by MongoDB applications upon successful exit. |
|
279. |
The mongo shell and the drivers provide several cursor methods that call on the cursor returned by the _______ method to modify its behavior.(a) cursor()(b) find()(c) findc()(d) none of the mentioned |
Answer» Right choice is (b) find() Best explanation: The method iterates completely the cursor, loading all the documents. |
|
280. |
MongoDB can be used as a ____________ taking advantage of load balancing and data replication features over multiple machines for storing files.(a) AMS(b) CMS(c) File system(d) None of the mentioned |
Answer» The correct answer is (a) AMS Explanation: The data is split into ranges (based on the shard key) and distributed across multiple shards. |
|
281. |
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 |
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. |
|
282. |
Which of the following keyword represents lock on the collection?(a) Database(b) Collection(c) Metadata(d) All of the mentioned |
Answer» The correct choice is (b) Collection Best explanation: Database represents database lock. |
|
283. |
Which of the following method returns true if the cursor has documents?(a) hasMethod()(b) hasNext()(c) hasDoc()(d) all of the mentioned |
Answer» Correct choice is (b) hasNext() The best I can explain: hasNext() returns true if the cursor returned by the db.collection.find() query can iterate further to return more documents. |
|
284. |
___________ strategy is used to explicitly avoid document growth.(a) deallocation(b) allocation(c) pre-allocation(d) none of the mentioned |
Answer» Correct answer is (c) pre-allocation To elaborate: A data model that embeds related data in a single document facilitates atomic operations. |
|
285. |
_____________ can be used for batch processing of data and aggregation operations.(a) Hive(b) MapReduce(c) Oozie(d) None of the mentioned |
Answer» Right answer is (b) MapReduce Best explanation: The aggregation framework enables users to obtain the kind of results for which the SQL GROUP BY clause is used. |
|
286. |
Point out the correct statement.(a) Documents can contain many different key-value pairs, or key-array pairs, or even nested documents(b) MongoDB has official drivers for a variety of popular programming languages and development environments(c) When compared to relational databases, NoSQL databases are more scalable and provide superior performance(d) All of the mentioned |
Answer» Correct choice is (d) All of the mentioned To explain: There are also a large number of unofficial or community-supported drivers for other programming languages and frameworks. |
|
287. |
Point out the wrong statement.(a) Queries need an index to return documents in insertion order(b) The options document creates a capped collection or preallocates space in a new ordinary collection(c) Capped collections have maximum size or document counts that prevent them from growing beyond maximum thresholds(d) None of the mentioned |
Answer» Right option is (a) Queries need an index to return documents in insertion order Explanation: Capped collections guarantee preservation of the insertion order. |
|
288. |
Which of the following command obtains a global write lock and will block other operations until it has completed?(a) ToCapped(b) isCapped(c) convertToCapped(d) None of the mentioned |
Answer» Correct answer is (b) isCapped The explanation: If the capped size specified for the capped collection is smaller than the size of the original uncapped collection, then MongoDB will overwrite documents in the capped collection based on the insertion order, or first in, first out order. |
|
289. |
Which of the following collection is capped?(a) system.index(b) system.replica(c) system.profile(d) all of the mentioned |
Answer» The correct answer is (c) system.profile Explanation: The database profiler writes data in the system.profile collection, which is a capped collection. |
|
290. |
___________ convert a non-capped collection to a capped collection.(a) ToCapped(b) convertToCap(c) convertToCapped(d) none of the mentioned |
Answer» Correct choice is (c) convertToCapped Explanation: convertToCapped takes an existing collection ( |
|
291. |
Point out the correct statement.(a) A database is a set of key-value pairs(b) A MongoDB deployment hosts a number of databases(c) A document holds a set of collections(d) All of the mentioned |
Answer» Correct choice is (b) A MongoDB deployment hosts a number of databases The best I can explain: A database holds a set of collections. A collection holds a set of documents. |
|
292. |
With MongoDB 3.0.0, the default use of the Power of _________ Allocations minimizes the occurrences of re-allocations as well as allows for the effective reuse of the freed record space.(a) 2 Sized(b) 3 Sized(c) 4 Sized(d) 5 Sized |
Answer» Right answer is (a) 2 Sized Explanation: When using MMAPv1, if your applications require updates that will frequently cause document growth to exceeds the current power of 2 allocation, you may want to refactor your data model to use references between data in distinct documents rather than a denormalized data model. |
|
293. |
MongoDB supports fixed-size collections called ____________ collections.(a) primary(b) secondary(c) capped(d) all of the mentioned |
Answer» Right choice is (c) capped The best I can explain: This type of collection maintains insertion order and, once the specified size has been reached, behaves like a circular queue. |
|
294. |
Which of the following is not a NoSQL database?(a) SQL Server(b) MongoDB(c) Cassandra(d) None of the mentioned |
Answer» Right choice is (a) SQL Server Explanation: Microsoft SQL Server is a relational database management system developed by Microsoft. |
|
295. |
_________ command creates the capped collection and imports the data.(a) CollectionAsCapped(b) cloneCollection(c) cloneCollectionAsCapped(d) None of the mentioned |
Answer» Right option is (c) cloneCollectionAsCapped The explanation is: MongoDB does not support the convertToCapped command in a sharded cluster. |
|
296. |
Which of the following should is used to check whether collection is capped or not?(a) isCAP()(b) isCapped()(c) isColl()(d) none of the mentioned |
Answer» The correct option is (b) isCapped() To explain: Use the isCapped() method to determine if a collection is capped, as: db.collection.isCapped(). |
|
297. |
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» The correct option is (b) cursor To explain: The mongo shell then iterates over the cursor to display the results. |
|
298. |
MongoDB uses a ____________ lock that allows concurrent read access to a database but exclusive write access to a single write operation.(a) readers(b) readers-writer(c) writer(d) none of the mentioned |
Answer» The correct answer is (b) readers-writer To elaborate: Before version 2.2, this lock was implemented on a per-mongod basis. Since version 2.2, the lock has been implemented at the database level. |
|
299. |
Command to check existence of collection is _____________(a) show collection(b) show collections(c) show collect(d) none of the mentioned |
Answer» The correct option is (b) show collections To explain: The mongo shell will return the list of the collections in the current database. |
|
300. |
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» Right option is (c) use mydb The best explanation: .Confirm that your session has the mydb database as context, by checking the value of the db object, which returns the name of the current database. |
|