MongoDB Questions and Answers – Index Types – 3

«
»

This set of MongoDB Aptitude Test focuses on “Index Types – 3”.

1. Which of the following GeoJSON object is not supported in MongoDB?
a) Point
b) LineString
c) MultiPoint
d) None of the mentioned
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) MongoDB can query for locations contained entirely within a specified polygon
b) MongoDB require an index for inclusion queries; however, such indexes will improve query performance
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: b
Explanation: Both 2d and 2dsphere indexes can support inclusion queries.

advertisement

3. MongoDB supports spherical surface calculations on legacy coordinate pairs using a _______ index.
a) 2dsphere
b) 2d
c) geoHaystack
d) all of the mentioned
View Answer

Answer: a
Explanation: If you choose flat surface calculations via a 2d index, you can store data only as legacy coordinate pairs.

4. Inclusion queries use the _________ operator in MongoDB.
a) $geokey
b) $geoin
c) $geoWithin
d) All of the mentioned
View Answer

Answer: c
Explanation: $geoWithin selects documents with geospatial data that exists entirely within a specified shape.

advertisement
advertisement

5. Point out the correct statement.
a) For $geoSphere queries that specify GeoJSON geometries with areas greater than a single hemisphere, the use of the default CRS results in queries for the complementary geometries
b) When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers
c) The custom MongoDB CRS uses a anti-clockwise winding order
d) None of the mentioned
View Answer

Answer: b
Explanation: The specified shape can be either a GeoJSON Polygon, a GeoJSON MultiPolygon, or a shape defined by legacy coordinate pairs.

6. The $geoWithin operator uses the _______ operator to specify the GeoJSON object.
a) $sphere
b) $geoin
c) $geometry
d) All of the mentioned
View Answer

Answer: c
Explanation: For $geoWithin, if you specify a single-ringed polygon that has an area greater than a single hemisphere, include the custom MongoDB coordinate reference system in the $geometry expression.

advertisement

7. If the specified polygon is _______ than a single hemisphere, the behavior of $geoWithin with the MongoDB CRS is the same as with the default CRS.
a) smaller
b) bigger
c) equal
d) all of the mentioned
View Answer

Answer: a
Explanation: For all other GeoJSON polygons with areas greater than a hemisphere, $geoWithin queries for the complementary geometry.

8. To query with a single-ringed GeoJSON polygon whose area is greater than a single hemisphere, the $geometry expression must specify the custom MongoDB ________
a) CRS
b) CDS
c) CLS
d) None of the mentioned
View Answer

Answer: a
Explanation: CRS stands for coordinate reference system.

advertisement

9. $geoWithin replaces _______ in MongoDB 2.4.
a) $withing
b) $gwithin
c) $within
d) All of the mentioned
View Answer

Answer: c
Explanation: $within is deprecated since version 2.4.

10. When used with the _____ operator, $geoWithin returns documents based on grid coordinates and does not query for GeoJSON shapes.
a) $box
b) $circle
c) $shape
d) All of the mentioned
View Answer

Answer: a
Explanation: $box specifies a rectangle for a geospatial $geoWithin query to return documents that are within the bounds of the rectangle, according to their point-based location data.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Reference Books in MongoDB.

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

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