MongoDB Questions and Answers Part-14

1. ________ store the relationships between data by including links or references from one document to another.
a) Capped
b) Embedded
c) External
d) References

Answer: d
Explanation: Applications can resolve these references to access the related data. Broadly, these are normalized data models.

2. Point out the correct statement.
a) In practice, the documents in a collection share a different structure
b) Data in MongoDB has a flexible schema
c) The key challenge in data modeling is balancing the needs of the application, the performance characteristics of the database engine, and the data retrieval patterns
d) None of the mentioned

Answer: b
Explanation: MongoDB’s collections do not enforce document structure.

3. In MongoDB, write operations are atomic at the __________ level.
a) collection
b) document
c) row
d) all of the mentioned

Answer: b
Explanation: No single write operation can atomically affect more than one document or more than one collection.

4. ______________ documents capture relationships between data by storing related data in a single document structure.
a) Capped
b) Embedded
c) External
d) Internal

Answer: b
Explanation: MongoDB documents make it possible to embed document structures in a field or array within a document.

5. Point out the wrong statement.
a) The key decision in designing data models for MongoDB applications revolves around the structure of documents and how the application represents relationships between data
b) There are two tools that allow applications to represent these relationships: references and embedded documents
c) When designing data models, always consider the application usage of the data (i.e. queries, updates, and processing of the data) as well as the inherent structure of the data itself
d) All of the mentioned

Answer: d
Explanation: Denormalized data models allow applications to retrieve and manipulate related data in a single database operation.

6. A ____________ data model with embedded data combines all related data for a represented entity in a single document.
a) normalized
b) denormalized
c) non relational
d) relational

Answer: b
Explanation: This facilitates atomic write operations since a single write operation can insert or update the data for an entity.

7. For the __________ storage engine, if the document size exceeds the allocated space for that document, MongoDB relocates the document on disk.
a) MAPv1
b) MAPv2
c) MAPv3
d) MAPv4

Answer: c
Explanation: Normalizing the data would split the data across multiple collections and would require multiple write operations that are not atomic collectively.

8. With MongoDB 3.0.0, the default use of the Power of _________ Allocations minimizes the occurrences of re-allocations as well as allows for the effective reuse of the freed record space.
a) 2 Sized
b) 3 Sized
c) 4 Sized
d) 5 Sized

Answer: a
Explanation: When using MMAPv1, if your applications require updates that will frequently cause document growth to exceeds the current power of 2 allocation, you may want to refactor your data model to use references between data in distinct documents rather than a denormalized data model.

9. ___________ strategy is used to explicitly avoid document growth.
a) deallocation
b) allocation
c) pre-allocation
d) none of the mentioned

Answer: c
Explanation: A data model that embeds related data in a single document facilitates atomic operations.

10. Each index in MongoDB requires at least _________ of data space.
a) 8KB
b) 28KB
c) 68KB
d) 108KB

Answer: a
Explanation: Adding an index has some negative performance impact for write operations.