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
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
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
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
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.
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
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
Explanation: GridFS places the collections in a common bucket by prefixing each with the bucket name.
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
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
Explanation: repairDatabase is analogous to an fsck command for file systems.
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
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
Explanation: The GridFS index allows efficient retrieval of chunks using the files_id and n values.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Check Information Technology Books
- Practice Programming MCQs
- Apply for Programming Internship
- Check MongoDB Books