Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

MongoDB MCQ Set 1

1. Which of the following database command is used for mapreduce function ?
a) mapReduce
b) mapperRed
c) redmap
d) none of the mentioned

View Answer

Answer: a [Reason:] For map-reduce operations, MongoDB provides the mapReduce database command.

2. Point out the wrong statement :
a) Map-reduce cannot have a finalize stage to make final modifications to the result
b) Map-reduce is less efficient and more complex than the aggregation pipeline
c) Specifically, a user with the userAdmin role can grant itself any privilege in the database
d) All of the mentioned

View Answer

Answer: a [Reason:] In general, map-reduce operations have two phases: a map stage that processes each document and emits one or more objects for each input document, and reduce phase that combines the output of the map operation.

3. MongoDB applies the _____ phase to each input document in mapreduce.
a) map
b) reduce
c) mapper
d) all of the mentioned

View Answer

Answer: a [Reason:] The map function emits key-value pairs.

4. MongoDB applies the _________ phase, which collects and condenses the aggregated data.
a) map
b) reduce
c) mapper
d) all of the mentioned

View Answer

Answer: b [Reason:] MongoDB then stores the results in a collection.

5. Point out the wrong statement :
a) MongoDB also provides map-reduce operations to perform aggregation
b) The pipeline provides efficient data aggregation using native operations within MongoDB
c) Map-reduce can specify a query condition to select the input documents as well as sort and limit the results
d) None of the mentioned

View Answer

Answer: D [Reason:] Aggregation is the preferred method for data aggregation in MongoDB.

6. The output of the reduce function may pass through a ______ function to further condense or process the results of the aggregation.
a) finalize
b) filter
c) procedure
d) none of the mentioned

View Answer

Answer: a [Reason:] The input and the output collections may be sharded.

7. _________ can return the results of a map-reduce operation as a document, or may write the results to collections.
a) mapReduce
b) mapperRed
c) RedMap
d) none of the mentioned

View Answer

Answer: a [Reason:] Map-reduce operations take the documents of a single collection as the input and can perform any arbitrary sorting and limiting before beginning the map stage.

8. Map-reduce uses custom __________ functions to perform the map and reduce operations
a) Java
b) Javascript
c) JSON
d) None of the mentioned

View Answer

Answer: b [Reason:] JavaScript provide great flexibility compared to the aggregation pipeline.

9. For most aggregation operations, the ______ Pipeline provides better performance and more coherent interface.
a) Aggregate
b) Replication
c) Sharding
d) None of the mentioned

View Answer

Answer: a [Reason:] Map-reduce operations provide some flexibility that is not presently available in the aggregation pipeline.

10. What would be the maximum document size for results of mapreduce operation ?
a) 15 MB
b) 16 MB
c) 17 MB
d) All of the mentioned

View Answer

Answer: b [Reason:] When returning the results of a map reduce operation inline, the result documents must be within the BSON Document Size limit, which is currently 16 megabytes.

MongoDB MCQ Set 2

1. The _____ JavaScript engine allows multiple JavaScript operations to execute at the same time.
a) V8
b) V12
c) V7
d) None of the mentioned

View Answer

Answer: a [Reason:] V8 JavaScript engine became the default engine in 2.4 version.

2. Point out the correct statement :
a) The read phase takes a exclusive lock
b) The map-reduce operation is composed of many tasks
c) Prior to version 3, JavaScript code executed in a single thread
d) All of the mentioned

View Answer

Answer: b [Reason:] It includes reads from the input collection, executions of the map function, executions of the reduce function, writes to a temporary collection during processing, and writes to the output collection.

3. If the ______ field for mapReduce has the sharded value, MongoDB shards the output collection using the _id field as the shard key.
a) input
b) $in
c) $out
d) none of the mentioned

View Answer

Answer: c [Reason:] During the post-processing, each shard will pull the results for its own chunks from the other shards, run the final reduce/finalize, and write locally to the output collection.

4. In MongoDB ______ ,mongos retrieves the results from each shard, performs a merge sort to order the results
a) 3.0
b) 2.0
c) 1.0
d) None of the mentioned

View Answer

Answer: b [Reason:] This model requires only a small amount of memory, even for large data sets.

5. Point out the wrong statement :
a) If the output collection does not exist, MongoDB creates and shards the collection on the _id field
b) Map-reduce supports operations on sharded collections, both as an input and as an output
c) mongos dispatches, in parallel, a map-reduce post-processing job to every shard that owns a chunk
d) None of the mentioned

View Answer

Answer: d [Reason:] When using sharded collection as the input for a map-reduce operation, mongos will automatically dispatch the map-reduce job to each shard in parallel.

6. Which of the following function follows the reduce method and modifies the output ?
a) finalize
b) final
c) max
d) all of the mentioned

View Answer

Answer: a [Reason:] Finalize fucntion is optional for mapreduce operation.

7. __________ specifies global variables that are accessible in the map
a) jsMode
b) scope
c) finalize
d) Min

View Answer

Answer: b [Reason:] It can also access reduce functions.

8. MongoDB converts the JavaScript objects emitted by the map function to ________ objects.
a) BSON
b) JSON
c) Javascript
d) None of the mentioned

View Answer

Answer: a [Reason:] These BSON objects are then converted back to JavaScript objects when calling the reduce function.

9. You can only use jsMode for result sets with fewer than 500,000 distinct key arguments to the mapper’s _______ function.
a) emit()
b) emitter()
c) emitted()
d) none of the mentioned

View Answer

Answer: a [Reason:] A single emit can only hold half of MongoDB’s maximum BSON document size.

10. Which of the following mode defaults to false ?
a) jsMode
b) scope
c) finalize
d) min

View Answer

Answer: a [Reason:] Internally, the JavaScript objects emitted during map function remain as JavaScript objects.

MongoDB MCQ Set 3

1. Which of the following members should be hidden ?
a) Delayed
b) Hidden
c) Primary
d) All of the mentioned

View Answer

Answer: a [Reason:] Use hidden members for dedicated tasks such as reporting and backups.

2. Point out the wrong statement :
a) Clients will not distribute reads with the appropriate read preference to hidden members
b) Hidden members cannot vote in replica set elections
c) If you stop a voting hidden member, ensure that the set has an active majority or the primary will step down
d) None of the mentioned

View Answer

Answer: b [Reason:] Hidden members may vote in replica set elections

3. __________ operations cannot guarantee that the data files do not change.
a) db.lockl()
b) db.synclock()
c) db.fsyncUnlock()
d) secondary

View Answer

Answer: c [Reason:] As a result, do not use these methods to ensure consistency for the purposes of creating backups.

4. _______ may block reads, including those necessary to verify authentication.
a) db.lockall()
b) db.fsyncLock()
c) db,lockreads()
d) none of the mentioned

View Answer

Answer: b [Reason:] Such reads are necessary to establish new connections to a mongod that enforces authorization checks.

5. Point out the correct statement :
a) In MongoDB, clients cannot see the results of writes before they are made durable
b) Users may configure read preference on a per-connection basis to prefer that the read operations return results from the secondary members
c) Clients cannot read data which may be subsequently rolled back
d) None of the mentioned

View Answer

Answer: b [Reason:] If clients configure the read preference to permit secondary reads, read operations can return data from secondary members that have not replicated more recent write operations.

6. ________ unlocks a mongod instance to allow writes and reverses the operation of a db.fsyncLock() operation.
a) db.fsyncUnlock()
b) db.fsynclock()
c) db.syncUnlock()
d) secondary

View Answer

Answer: a [Reason:] Typically you will use db.fsyncUnlock() following a database backup operation.

7. Delayed members are a ________ or a running “historical” snapshot of the data set
a) “rolling backup”
b) “roll backup”
c) “rolling commit”
d) none of the mentioned

View Answer

Answer: a [Reason:] They may help you recover from various kinds of human error.

8. Delayed members apply operations from the _______ on a delay.
a) oplog
b) log
c) mlog
d) none of the mentioned

View Answer

Answer: a [Reason:] Always prevent applications from seeing and querying delayed members.

9. In sharded clusters, delayed members have limited utility when the __________ is enabled.
a) Balancer
b) Collector
c) Emitter
d) None of the mentioned

View Answer

Answer: a [Reason:] Delayed members replicate chunk migrations with a delay.

10. A delayed member has its priority equal to 0 and hidden equal to___________
a) 0
b) flase
c) true
d) all of the mentioned

View Answer

Answer: c [Reason:] When you configure a delayed member, the delay applies both to replication and to the member’s oplog.

MongoDB MCQ Set 4

1. The ________ settings of replica set members affect the outcomes of elections for primary.
a) priority
b) replication
c) Initiate
d) all of the mentioned

View Answer

Answer: a [Reason:] Use this setting to ensure that some members are more likely to become primary and that others can never become primary.

2. Point out the correct statement:
a) The value of the member’s priority setting determines the member’s priority in elections
b) The default value for the priority field is 3
c) The value of priority can be any floating point (i.e. decimal) number between 0 and 500
d) None of the mentioned

View Answer

Answer: a [Reason:] The higher the number, the higher the priority.

3. To modify priorities, you update the members _________ in the replica configuration object.
a) array
b) tag
c) mdimarray
d) all of the mentioned

View Answer

Answer: a [Reason:] The array index begins with 0. Do not confuse this index value with the value of the replica set member’s _id field in the array.

4. The _________ shell method can force the current primary to step down, which causes an election.
a) rs.repliconfig()
b) rs.config()
c) rs.reconfig()
d) all of the mentioned

View Answer

Answer: c [Reason:] When the primary steps down, the mongod closes all client connections.

5. Point out the wrong statement :
a) Before an election the primary opens all open client connections
b) To block a member from seeking election as primary, assign it a priority of 0
c) Hidden members, delayed members, and arbiters all have priority set to 0
d) All of the mentioned

View Answer

Answer: a [Reason:] Reconfiguring priority can force the current primary to step down, leading to an election.

6. If the oplog is shorter than the slaveDelay window, the _______ member cannot successfully replicate operations.
a) hidden
b) delayed
c) priority
d) all of the mentioned

View Answer

Answer: b [Reason:] The length of the secondary slaveDelay must fit within the window of the oplog.

7. _________ members allow you to add additional members for read distribution beyond the maximum seven voting members.
a) Voting
b) Non-voting
c) Priority
d) all of the mentioned

View Answer

Answer: b [Reason:] To configure a member as non-voting, set its votes value to 0.

8. Remove the secondary from the replica set by calling ___________ method.
a) rs.removeRepli()
b) rs.remove()
c) rs.removeset()
d) isMaster

View Answer

Answer: b [Reason:] rs.remove() removes the member described by the hostname parameter from the current replica set.

9. ______ returns basic help text for replica set functions.
a) rs.printSlaveReplicationInfo()
b) rs.printReplication()
c) rs.help()
d) all of the mentioned

View Answer

Answer: c [Reason:] rs.help() returns a basic help text for all of the replication related shell functions.

10. __________ prints a report of the status of the replica set from the perspective of the secondaries.
a) rs.printSlaveReplicationInfo()
b) rs.printReplication()
c) rs.help()
d) none of the mentioned

View Answer

Answer: a [Reason:] rs.printSlaveReplicationInfo() returns a formatted report of the status of a replica set from the perspective of the secondary member of the set.

MongoDB MCQ Set 5

1. 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

View Answer

Answer: d [Reason:] The Nested Sets pattern provides a fast and efficient solution for finding subtrees but is inefficient for modifying the tree structure.

2. Point out the correct statement :
a) $regex is used for regular expression pattern matches
b) $like is used for regular expression pattern matches
c) $reg is used for regular expression pattern matches
d) All of the mentioned

View Answer

Answer: a [Reason:] If your application needs to perform queries on the content of a field that holds text you can perform exact matches on the text.

3. Which of the following operations are atomic on document level ?
a) update
b) remove
c) findAndModify
d) all of the mentioned

View Answer

Answer: d [Reason:] In MongoDB, write operations, e.g. db.collection.update(), db.collection.findAndModify(), db.collection.remove(), are atomic on the level of a single document.

4. ___________ bulk indexes may be more efficient for some kinds of content and workloads in real time.
a) Synchronous
b) Asynchronous
c) Unique
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB can support keyword searches using specific data models and multi-key indexes;

5. Point out the correct statement :
a) An array with a large number of elements will incur greater indexing costs on insertion
b) An array with a large number of elements will incur smaller indexing costs on updates
c) An array with a small number of elements will incur greater indexing costs on insertion
d) None of the mentioned

View Answer

Answer: a [Reason:] An array with a large number of elements, such as one with several hundreds or thousands of keywords will incur greater indexing costs on insertion.

6. ________ indexes can include any field whose value is a string or an array of string elements.
a) text
b) string
c) char
d) none of the mentioned

View Answer

Answer: a [Reason:] MongoDB provides text indexes to support text search of string content in documents of a collection.

7. Which of the following is related to document that do not provide a way to weight results?
a) Stemming
b) Synonyms
c) Ranking
d) None of the mentioned

View Answer

Answer: c [Reason:] The keyword look ups described in this document do not provide a way to weight results.

8. Which of the following is related to document that provide support for synonym or related queries in the application layer ?
a) Stemming
b) Synonyms
c) Ranking
d) None of the mentioned

View Answer

Answer: b [Reason:] MongoDB can support keyword searches using specific data models and multi-key indexes.

9. Which of the following is related to parsing of document for root ?
a) Stemming
b) Synonyms
c) Ranking
d) None of the mentioned

View Answer

Answer: a [Reason:] Keyword queries in MongoDB can not parse keywords for root or related words.

10. To add structures to your document to support keyword-based queries add the keywords as ______ in the array.
a) number
b) strings
c) character
d) none of the mentioned

View Answer

Answer: b [Reason:] You can then create a multi-key index on the array and create queries that select values from the array.

.woocommerce-message { background-color: #98C391 !important; }