MongoDB Questions and Answers – Data Modeling Concepts – 2

This set of MongoDB Interview Questions and Answers for experienced focuses on “Data Modeling Concepts – 2”

1. _______________ is a specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.
a) DataFS
b) GridFS
c) ReadFS
d) None of the mentioned
View Answer

Answer: b
Explanation: Instead of storing a file in a single document, GridFS divides a file into parts, or chunks.

2. Point out the wrong statement.
a) By default GridFS limits chunk size to 255k
b) GridFS is useful only for storing files that exceed 16MB
c) When you query a GridFS store for a file, the driver or client will reassemble the chunks as needed
d) All of the mentioned
View Answer

Answer: b
Explanation: GridFS is useful not only for storing files that exceed 16MB but also for storing any files for which you want to access without having to load the entire file into memory.

3. How many does collections GridFS use to store files?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
Explanation: One collection stores the file chunks, and the other stores file metadata.

4. The default chunk size is changed from 256k to 255k in which version?
a) 3.0
b) 2.4.9
c) 2.4.10
d) None of the mentioned
View Answer

Answer: b
Explanation: The use of the term chunks in the context of GridFS is not related to the use of the term chunks in the context of sharding.

advertisement
advertisement

5. Point out the wrong statement.
a) Client libraries provide a convenient, injection free, process to build these objects
b) MongoDB represents queries as BSON objects
c) Field names in MongoDB’s query language have semantic meaning
d) All of the mentioned
View Answer

Answer: d
Explanation: If you need to use db.eval() with user supplied values, you can either use a CodeWScope or you can supply extra arguments to your function.

6. Which of the collection in GridFS stores the binary chunks?
a) chunks
b) files
c) data
d) log
View Answer

Answer: a
Explanation: GridFS places the collections in a common bucket by prefixing each with the bucket name.

Note: Join free Sanfoundry classes at Telegram or Youtube

7. ___________ is the _id is of the data type chosen for the original document in files collections.
a) files._id
b) file._id
c) fileobj._id
d) none of the mentioned
View Answer

Answer: a
Explanation: The default type for MongoDB documents is BSON ObjectId.

8. Which of the following checks and repairs errors and inconsistencies in data storage?
a) repairDatabase
b) repairedDatabase
c) recoverDatabase
d) all of the mentioned
View Answer

Answer: a
Explanation: repairDatabase is analogous to an fsck command for file systems.

advertisement

9. The files_id field contains the _id of the chunk’s __________ document.
a) parent
b) child
c) top
d) none of the mentioned
View Answer

Answer: a
Explanation: GridFS uses a unique, compound index on the chunks collection for the files_id and n fields.

10. Which of the following field allows efficient retrieval of chunks?
a) n
b) name
c) object
d) 2n
View Answer

Answer: a
Explanation: The GridFS index allows efficient retrieval of chunks using the files_id and n values.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

To practice all areas of MongoDB for interviews, Here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.