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.

advertisement

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

advertisement

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 Reference Books in MongoDB.

advertisement
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!
advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter