MongoDB Questions and Answers – Index Types – 2

This set of MongoDB Questions for campus interviews focuses on “Index Types – 2”.

1. Before version _______ capped collections did not have an _id field.
a) 2.1
b) 2.4
c) 3.0
d) 2.2
View Answer

Answer: d
Explanation: In version 2.2 and newer, capped collections do have an _id field, except those in the local database.

2. Point out the wrong statement.
a) You can create indexes on fields within embedded documents
b) Indexes on embedded fields are similar to indexes on embedded documents
c) Indexes on embedded fields allow you to use a “dot notation,” to introspect into embedded documents
d) None of the mentioned
View Answer

Answer: c
Explanation: Indexes on embedded fields differ from indexes on embedded documents, which include the full content up to the maximum index size of the embedded document in the index.

3. For a _____ multikey index, each indexed document can have at most one indexed field whose value is an array.
a) Hashed
b) Unique
c) Multikey
d) compound
View Answer

Answer: d
Explanation: As such, you cannot create a compound multikey index if more than one to-be-indexed field of a document is an array.

4. Which of the following indexes cannot be multikey?
a) Hashed
b) Unique
c) Multikey
d) compound
View Answer

Answer: a
Explanation: You cannot specify a multikey index as the shard key index.

advertisement
advertisement

5. Point out the wrong statement.
a) You may not create compound indexes that have hashed index fields
b) The order of the fields in a compound index is very important
c) You will receive a warning if you attempt to create a compound index that includes a hashed index
d) None of the mentioned
View Answer

Answer: c
Explanation: You will receive an error if you attempt to create a compound index that includes a hashed index.

6. To calculate geometry over an Earth-like sphere, store your location data on a spherical surface and use _____ index.
a) 2dsphere
b) 2d
c) geoHaystack
d) all of the mentioned
View Answer

Answer: a
Explanation: Secondary members replicate deletion operations from the primary.

Note: Join free Sanfoundry classes at Telegram or Youtube

7. ______ indexes can be constructed over arrays that hold both scalar values (e.g. strings, numbers) and nested documents.
a) Hashed
b) Unique
c) Multikey
d) Compound
View Answer

Answer: c
Explanation: Store your location data as GeoJSON objects with this coordinate-axis order: longitude, latitude.

8. The coordinate reference system for GeoJSON uses the _____ datum.
a) WGS88
b) WGS84
c) JGS88
d) None of the mentioned
View Answer

Answer: b
Explanation: Before storing your location data and writing queries, you must decide the type of surface to use to perform calculations.

advertisement

9. Which of the following is used to calculate distances on a Euclidean plane?
a) 2dsph
b) 2d
c) geoHaystack
d) all of the mentioned
View Answer

Answer: b
Explanation: Store your location data as legacy coordinate pairs

10. Queries on ________ objects always calculate on a sphere.
a) GeoBSON
b) GeoJSON
c) geoJSONB
d) All of the mentioned
View Answer

Answer: b
Explanation: Support for GeoJSON storage and queries is new in version 2.4.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

To practice all areas of MongoDB for campus interviews, Here is complete set of 1000+ Multiple Choice Questions and Answers.

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.