11.) Which MongoDB operator is optimized by a geospatial index?
A) $geoNear
B) $or
C) $match
D) $regex
12.) What is the purpose of the unique option when creating an index?
A) To make the index case-sensitive
B) To enforce unique values for the indexed field
C) To allow duplicate values in the index
D) To improve sorting performance
13.) How do you create a unique index in MongoDB?
A) db.collection.createIndex({ field: 1 }, { unique: true })
B) db.collection.addUniqueIndex({ field: 1 })
C) db.collection.createUniqueIndex({ field: 1 })
D) db.collection.index({ field: 1, unique: true })
14.) Which of the following is NOT true about indexes?
A) They improve query performance.
B) They take up additional storage space.
C) They slow down write operations.
D) They are always created automatically for all fields.
15.) Which type of geospatial index does MongoDB support?
A) 2D index
B) 3D index
C) 2D sphere index
D) Both A and C
16.) What is the default collation for indexes in MongoDB?
A) Case-sensitive
B) Case-insensitive
C) Language-specific
D) Binary
17.) Which of the following methods is used to drop all indexes except _id?
A) db.collection.dropIndexes()
B) db.collection.dropIndex(“*”)
C) db.collection.deleteIndexes()
D) db.collection.removeIndexes()
18.) Which type of index is suitable for searching fields in natural language?
A) Text Index
B) Compound Index
C) Geospatial Index
D) Single Field Index
19.) What happens if you try to insert a duplicate value into a field with a unique index?
A) The duplicate value is ignored.
B) The operation fails with an error.
C) The document is inserted without the duplicate value.
D) A new unique index is created.
20.) How do indexes affect write performance in MongoDB?
A) They improve write performance.
B) They have no impact on write performance.
C) They slow down write performance slightly.
D) They prevent write operations.
Related