MongoDB Questions and Answers – GridFS

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “GridFS”.

1. ___________ is a specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.
a) FSpec
b) GridFS
c) Grid
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 correct statement.
a) GridFS uses two collections to store files
b) You cannot perform range queries on files stored through GridFS
c) Applications that handle temporal and spatial data often require capturing fractional units of currency
d) All of the mentioned
View Answer

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

3. By default GridFS limits chunk size to ______ k.
a) 225
b) 255
c) 256
d) None 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 access without having to load the entire file into memory.

4. When you query a GridFS store for a file, the _______ will reassemble the chunks as needed.
a) client
b) Server
c) Agent
d) None of the mentioned
View Answer

Answer: a
Explanation: You also can access information from arbitrary sections of files, which allows you to “skip” into the middle of a video or audio file.

advertisement
advertisement

5. Point out the wrong statement.
a) Chunks in the context of GridFS is related to the use of the term chunks in the context of sharding
b) The default chunk size changed from 256k to 255k
c) If you need to query the database for exact, mathematically valid matches, use Ambiguity Precision
d) None of the mentioned
View Answer

Answer: a
Explanation: By default, GridFS uses two collections with names prefixed by fs bucket.

6. MongoDB represents queries as ___________ objects.
a) BSON
b) JSON
c) GSON
d) None of the mentioned
View Answer

Answer: a
Explanation: As a client program assembles a query in MongoDB, it builds a BSON object, not a string.

7. Each document in the __________ collection represents a distinct chunk of a file as represented in the GridFS store.
a) chunks
b) files
c) bson
d) none of the mentioned
View Answer

Answer: a
Explanation: Each chunk is identified by its unique ObjectId stored in its _id field.

8. GridFS uses a _________ index on the chunks collection for the files_id and n fields.
a) unique
b) single
c) non unique
d) none of the mentioned
View Answer

Answer: a
Explanation: The files_id field contains the _id of the chunk’s “parent” document.

advertisement

9. The ___ field contains the sequence number of the chunk.
a) x
b) array
c) field
d) n
View Answer

Answer: d
Explanation: GridFS numbers all chunks, starting with 0.

10. The GridFS index allows efficient retrieval of __________ using the files_id and n values.
a) chunks
b) files
c) bson
d) none of the mentioned
View Answer

Answer: a
Explanation: When you query for a large file, GridFS automatically reassembles the smaller files into the original large file.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.