MongoDB Questions and Answers – BSON

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

1. _________ 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
View Answer

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

2. Point out the correct statement.
a) ObjectIds are small, likely unique, fast to generate, and ordered
b) ObjectIds are large, likely unique, and ordered
c) ObjectIds values consists of 18-byte
d) All of the mentioned
View Answer

Answer: a
Explanation: In MongoDB, documents stored in a collection require a unique _id field that acts as a primary key.

3. Which of the following data type is depreciated?
a) Double
b) String
c) Object
d) Undefined
View Answer

Answer: d
Explanation: MongoDB treats some types as an equivalent for comparison purposes.

4. Each data type has a corresponding number that can be used with the _______ operator to query documents by BSON type.
a) $type
b) $server
c) $agent
d) None of the mentioned
View Answer

Answer: a
Explanation: $type selects the documents where the value of the field is an instance of the specified numeric BSON type.

advertisement
advertisement

5. Point out the wrong statement.
a) BSON Date is a 32-bit integer that represents the number of milliseconds
b) The BSON timestamp type is for internal MongoDB use
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: This results in a representable date range of about 290 million years into the past and future.

6. There is _________ byte counter in BSON, starting with a random value.
a) 2
b) 3
c) 4
d) None of the mentioned
View Answer

Answer: b
Explanation: ObjectId is a 12-byte BSON type

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

7. In the mongo shell, you can access the creation time of the ObjectId, using the ______ method.
a) getTime()
b) getTimestamp()
c) Timestamp()
d) None of the mentioned
View Answer

Answer: b
Explanation: MongoDB clients should add an _id field with a unique ObjectId.

Sanfoundry Global Education & Learning Series – MongoDB.

advertisement

Here’s the list of Best Books in MongoDB.

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