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. ____________ are operations that process data records and return computed results.
a) ReplicaAgg
b) SumCalculation
c) Aggregations
d) None of the mentioned

View Answer

Answer: c [Reason:] MongoDB provides a rich set of aggregation operations that examine and perform calculations on the data sets.

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. Running data aggregation on the ________ instance simplifies application code and limits resource requirements.
a) document
b) mongod
c) mongos
d) all of the mentioned

View Answer

Answer: b [Reason:] Like queries, aggregation operations in MongoDB use collections of documents as an input and return results in the form of one or more documents.

4. Documents enter a multi-stage __________ that transforms the documents into an aggregated result.
a) pipeline
b) pipelineView
c) pipelineUser
d) all of the mentioned

View Answer

Answer: a [Reason:] MongoDB 2.2 introduced a new aggregation framework, modeled on the concept of data processing pipelines.

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 most basic pipeline stages provide __________ that operate like queries.
a) methods
b) filters
c) stored procedure
d) none of the mentioned

View Answer

Answer: b [Reason:] Other pipeline operations provide tools for grouping and sorting documents by specific field.

7. Pipeline stages can use __________ for tasks such as calculating the average or concatenating a string.
a) replicas
b) operators
c) roles
d) all of the mentioned

View Answer

Answer: b [Reason:] User can remove any role from any user from any database in the system.

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. Which of the following operation can be optionally used for map reduce ?
a) finally
b) final
c) static
d) none of the mentioned

View Answer

Answer: a [Reason:] Certain mongo shell functions and properties are inaccessible in map-reduce operations.

10. The aggregation pipeline can use ___________ to improve its performance during some of its stages.
a) indexes
b) OptmData
c) functions
d) all of the mentioned

View Answer

Answer: a [Reason:] Both the aggregation pipeline and map-reduce can operate on a sharded collection.

MongoDB MCQ Set 2

1. Pipeline stages can use __________ for tasks such as calculating the average or concatenating a string.
a) replicas
b) operators
c) roles
d) all of the mentioned

View Answer

Answer: b [Reason:] User can remove any role from any user from any database in the system.

2. Point out the wrong statement :
a) Some pipeline stages may generate new documents or filter out documents
b) $limit groups output documents by a specified operator
c) $group groups input documents by a specified identifier expression
d) None of the mentioned

View Answer

Answer: b [Reason:] $group consumes all input documents and outputs one document per each distinct group.

3. To handle large datasets, set _________ option to true to enable writing data to temporary files.
a) enableDiskUse
b) allowDiskUse
c) validateDiksUse
d) none of the mentioned

View Answer

Answer: b [Reason:] In the mongo shell, when you assign the cursor returned from the find() method to a variable using the var keyword, the cursor does not automatically iterate.

4. ________ deconstructs an array field from the input documents to output a document for each element.
a) $unwindelem
b) $unwind
c) $unwin
d) None of the mentioned

View Answer

Answer: c [Reason:] Each output document replaces the array with an element value.

5. Point out the wrong statement :
a) Boolean expressions evaluate their argument expressions as booleans and return a boolean as the result
b) In addition to the false boolean value, Boolean expression evaluates as false the following: null, 0, and undefined values
c) Set expressions performs set operation on arrays, treating arrays as sets
d) None of the mentioned

View Answer

Answer: d [Reason:] The Boolean expression evaluates all other values as true, including non-zero numeric values and arrays.

6. ________ applies an expression to each item in an array and returns an array with the applied results.
a) $map
b) $geo
c) $geoRear
d) None of the mentioned

View Answer

Answer: a [Reason:] The $map expression has the following syntax: { $map: { input: , as: , in: } }.

7. Which of the following accepts named parameters ?
a) $reduce
b) $letnum
c) $let
d) None of the mentioned

View Answer

Answer: d [Reason:] $let defines variables for use within the scope of a subexpression and returns the result of the subexpression.

8. String expressions, with the exception of ________ only have a well-defined behavior for strings of ASCII characters.
a) $setcon
b) $concatenation
c) $concat
d) None of the mentioned

View Answer

Answer: c [Reason:] $concat behavior is well-defined regardless of the characters used.

9. ___________ returns either the non-null result of the first expression.
a) $Null
b) $ifNull
c) $ElseNull
d) None of the mentioned

View Answer

Answer: b [Reason:] $ifNull returns the result of the second expression if the first expression results in a null result.

10. Which of the following returns the value that results from applying an expression to the last document ?
a) $end
b) $last
c) $max
d) All of the mentioned

View Answer

Answer: b [Reason:] $last has the following syntax: { $last: }.

MongoDB MCQ Set 3

1. Which of the following stages cannot appear multiple times in a pipeline ?
a) $regex
b) $reg
c) $match
d) $out

View Answer

Answer: c [Reason:] To use the $out stage, it must be the last stage in the pipeline.

2. Point out the correct statement :
a) To access variables in expressions, use a string that prefixes the variable name with $$$
b) Expressions can include field paths and system variables, literals, expression objects, and expression operators
c) To specify a field path, use a string that prefixes with a dollar sign % the field name or the dotted field name
d) All of the mentioned

View Answer

Answer: b [Reason:] Expressions can be nested.

3. Aggregation expressions use ______ path to access fields in the input documents.
a) mpath
b) dbpath
c) lpath
d) field

View Answer

Answer: [Reason:] To specify a field path, use a string that prefixes with a dollar sign $ the field name or the dotted field name, if the field is in embedded document.

4. Which of the following statement is equivalent to “$$CURRENT.” ?
a) “$%
b) “%
c) “$$
d) “$

View Answer

Answer: d [Reason:] CURRENT is a system variable that defaults to the root of the current object in the most stages, unless stated otherwise in specific stages.

5. Point out the wrong statement :
a) Literals can be of any type
b) CURRENT cannot be rebound
c) MongoDB parses string literals that start with a dollar sign $
d) None of the mentioned

View Answer

Answer: b [Reason:] Along with the CURRENT system variable, other system variables are also available for use in expressions.

6. ______ binds variables for use in the specified expression.
a) $skip
b) $let
c) $bind
d) None of the mentioned

View Answer

Answer: b [Reason:] $let also returns the result of the expression.

7. ________ applies an expression to each item in an array and returns an array with the applied results.
a) $map
b) $geo
c) $geoRear
d) None of the mentioned

View Answer

Answer: a [Reason:] The $map expression has the following syntax: { $map: { input: , as: , in: } }

8. In the vars assignment block, ________ refers to the value of an externally defined variable low .
a) “$$low”
b) “$$lowin”
c) “$$1”
d) None of the mentioned

View Answer

Answer: a [Reason:] If low is not defined outside this $let expression block, the expression is invalid.

9. To avoid treating numeric or boolean literals as projection flags, use the _______ expression to wrap the numeric or boolean literals.
a) $literal
b) $bool
c) $unwin
d) None of the mentioned

View Answer

Answer: a [Reason:] The $literal expression has the following syntax: { $literal: }

10. MongoDB treats the literals as projection flags, valid only in the _______ stage.
a) $project
b) $gmap
c) $match
d) None of the mentioned

View Answer

Answer: a [Reason:] Projection flags can be 1 or true to include the field.

MongoDB MCQ Set 4

1. _______ filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage.
a) $regex
b) $reg
c) $match
d) None of the mentioned

View Answer

Answer: c [Reason:]$match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match).

2. Point out the wrong statement :
a) Documents do not pass through the stages in sequence
b) Pipeline stages appear in an multi dimensional array
c) $project reshapes each document in the stream, such as by adding new fields or removing existing fields
d) All of the mentioned

View Answer

Answer: c [Reason:] For each input document, outputs one document.

3. Which of the following can be used to implement field level redaction ?
a) $skip
b) $limit
c) $match
d) $redact

View Answer

Answer: d [Reason:]$redact reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves.

4. ________ passes the first n documents unmodified to the pipeline where n is the specified limit
a) $skip
b) $limit
c) $match
d) $redact

View Answer

Answer: b [Reason:] For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents).

5. Point out the wrong statement :
a) Some pipeline stages may generate new documents or filter out documents
b) $limit groups output documents by a specified operator
c) $group groups input documents by a specified identifier expression
d) None of the mentioned

View Answer

Answer: b [Reason:]$group consumes all input documents and outputs one document per each distinct group.

6. _______ reorders the document stream by a specified sort key
a) $skip
b) $limit
c) $sort
d) None of the mentioned

View Answer

Answer: c [Reason:] Only the order changes; the documents remain unmodified.

7. Which of the following operator incorporates the functionality of $match, $sort, and $limit for geospatial data?
a) $geoSpatial
b) $geoNear
c) $geoRear
d) None of the mentioned

View Answer

Answer: b [Reason:] The output documents include an additional distance field and can include a location identifier field.

8. _____ Writes the resulting documents of the aggregation pipeline to a collection.
a) $out
b) $in
c) $output
d) None of the mentioned

View Answer

Answer: a [Reason:] To use the $out stage, it must be the last stage in the pipeline.

9. ________ deconstructs an array field from the input documents to output a document for each element.
a) $unwindelem
b) $unwind
c) $unwin
d) None of the mentioned

View Answer

Answer: c [Reason:] Each output document replaces the array with an element value.

10. Which of the following operator is related to geography of data ?
a) $geoSpatial
b) $geoNear
c) $geoRear
d) None of the mentioned

View Answer

Answer: b [Reason:]$geoNear returns an ordered stream of documents based on the proximity to a geospatial point.

MongoDB MCQ Set 5

1. Aggregation pipeline was introduced in MongoDB version ______
a) 2.1
b) 2.2
c) 2.4
d) 3.0

View Answer

Answer: b [Reason:] The aggregation pipeline provides an alternative to map-reduce.

2. Point out the wrong statement :
a) Aggregation pipeline have some limitations on value types and result size
b) The aggregation pipeline is a framework for data aggregation modeled on the concept of data processing pipelines
c) Documents enter a multi-stage pipeline that transforms the documents into an aggregated results
d) All of the mentioned

View Answer

Answer: d [Reason:] The MongoDB aggregation pipeline consists of stages.

3. ________ calculates aggregate values for the data in a collection.
a) db.collection.aggregate
b) db.collection.agg
c) db.collection.pipeline
d) all of the mentioned

View Answer

Answer: a [Reason:] In the mongo shell, if the cursor returned from the db.collection.aggregate() is not assigned to a variable using the var keyword, then the mongo shell automatically iterates the cursor up to 20 times.

4. Cursors returned from aggregation only supports cursor methods like :
a) cursor.hasNext()
b) cursor.Next()
c) cursor.has()
d) all of the mentioned

View Answer

Answer: a [Reason:] cursor.hasNext() returns true if the cursor returned by the db.collection.find() query can iterate further to return more documents.

5. Point out the wrong statement :
a) Some pipeline stages may generate new documents or filter out documents
b) Pipeline stages do need to produce one output document for every input document
c) Pipeline stages can appear multiple times in the pipeline
d) None of the mentioned

View Answer

Answer: b [Reason:] Pipeline stages do need to produce one output document for every input document.

6. ______ can be used to iterate the cursor of document results returned by db.collection.find().
a) it
b) next
c) cur
d) none of the mentioned

View Answer

Answer: a [Reason:] The mongo shell iterates the returned cursor automatically to print the results.

7. To handle large datasets, set _________ option to true to enable writing data to temporary files.
a) enableDiskUse
b) allowDiskUse
c) validateDiksUse
d) none of the mentioned

View Answer

Answer: b [Reason:] In the mongo shell, when you assign the cursor returned from the find() method to a variable using the var keyword, the cursor does not automatically iterate.

8. Syntax for specifying an initial batch size for the cursor is :
a) cursor: { batchSize: <string> }
b) cursor: { batchSize: <int> }
c) cur: { batchSize: <int> }
d) none of the mentioned

View Answer

Answer: b [Reason:] A batchSize of 0 means an empty first batch and is useful for quickly returning a cursor or failure message without doing significant server-side work.

9. Query shape consists of a combination of query, sort, and _________ specifications.
a) selection
b) projection
c) collection
d) none of the mentioned

View Answer

Answer: c [Reason:] If an index filter exists for a given query shape, the optimizer only considers those indexes specified in the filter.

10. Which of the following method is overrided by Index filters ?
a) hint
b) plan
c) execute
d) all of the mentioned

View Answer

Answer: a [Reason:] When an index filter exists for the query shape, MongoDB ignores the hint().

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