MongoDB Questions and Answers – Aggregation

«
»

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

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

advertisement

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

Answer: b
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.

advertisement
advertisement

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

Answer: d
Explanation: Aggregation is the preferred method for data aggregation in MongoDB.

advertisement

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

Answer: b
Explanation: User can remove any role from any user from any database in the system.

advertisement

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

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

advertisement

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
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 Reference Books in MongoDB.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter