MongoDB Questions and Answers Part-20

1. 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

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

2. By default GridFS limits chunk size to ______ k.
a) 225
b) 255
c) 256
d) None of the mentioned

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.

3. 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

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.

4. 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

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

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

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

6. 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

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

7. 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

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

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

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

9. 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

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

10. _________ is a binary serialization format used to store documents and make remote procedure calls in MongoDB.
a) BSON
b) GridFS
c) JSON
d) None of the mentioned

Answer: a
Explanation: BSON supports many data types as values in documents.