MongoDB Questions and Answers Part-10

1. A query may include a ___________ that specifies the fields from the matching documents to return.
a) selection
b) projection
c) union
d) none of the mentioned

Answer: b
Explanation: Queries specify criteria, or conditions, that identify the documents that MongoDB returns to the clients.

2. Point out the correct statement.
a) Secondary indexes allow applications to store a view of a portion of the collection in an efficient data structure
b) MongoDB has full support for secondary indexes
c) Most indexes store an ordered representation of all values of a field or a group of fields
d) all of the mentioned

Answer: b
Explanation: Secondary indexes are used to enhance the performance of common queries and updates.

3. MongoDB stores all documents in _____________
a) tables
b) collections
c) rows
d) all of the mentioned

Answer: b
Explanation: Collections are analogous to a table in relational databases.

4. In MongoDB _________ operations modify the data of a single collection.
a) CRUD
b) GRID
c) READ
d) All of the mentioned

Answer: a
Explanation: Data modification refers to operations that create, update, or delete data.

5. Point out the wrong statement.
a) Indexes cannot enforce uniqueness in collection
b) CRUD stands for create, read, update, and delete
c) CRUD application is the most simplest application
d) all of the mentioned

Answer: a
Explanation: Indexes may also enforce uniqueness, store objects in a geospatial representation, and facilitate text search.

6. Which of the following operation adds a new document to the users collection?
a) add
b) insert
c) truncate
d) drop

Answer: b
Explanation: For the update and delete operations, you can specify the criteria to select the documents to update or remove.

7. Which of the following preference determines how the client direct read operations to the set?
a) read
b) write
c) update
d) delete

Answer: a
Explanation: For replica sets and sharded clusters with replica set components, applications specify read preferences.

8. Applications can also control the behavior of write operations using _______ concern.
a) read
b) write
c) truncate
d) all of the mentioned

Answer: b
Explanation: Write concern semantics allow clients to specify the assurance that MongoDB provides when reporting on the success of a write operation.

9. MongoDB process collection of documents using _________ operations.
a) Hbase
b) Hive
c) Map-reduce
d) None of the mentioned

Answer: c
Explanation: In addition to the basic queries, MongoDB provides several data aggregation features.

10. Which of the following pipeline is used for aggregation in MongoDB?
a) data processing
b) information processing
c) knowledge processing
d) none of the mentioned

Answer: a
Explanation: MongoDB can return counts of the number of documents that match a query, or return the number of distinct values for a field.