This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Aggregation”.
1. ____________ are operations that process data records and return computed results.
a) ReplicaAgg
b) SumCalculation
c) Aggregations
d) None of the mentioned
View Answer
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: 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
Explanation: Both the aggregation pipeline and map-reduce can operate on a sharded collection.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Apply for Programming Internship
- Check MongoDB Books
- Check Information Technology Books
- Practice Programming MCQs