MongoDB MCQ Questions - Index

This section focuses on "Index" in MongoDB. These Multiple Choice Questions (MCQ) should be practiced to improve the MongoDB skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. How to create index in mongoDB?

A. index()
B. createIndex()
C. putIndex()
D. getIndex()

View Answer


2. Which of the following iis correct syntax of createindex?

A. db.COLLECTION_NAME.createIndex({KEY:1})
B. COLLECTION_NAME.createIndex({KEY:1})
C. db.COLLECTION_NAME.createIndex
D. db.createIndex({KEY:1})

View Answer


3. To create index in descending order, the value of key is?

A. 1
B. 0
C. -1
D. infinite

View Answer


4. The default value of background Parameter is :

A. TRUE
B. FALSE
C. 0
D. 1

View Answer


5. The default value of default_language Parameter is :

A. Mongo
B. DB
C. Mongod
D. English

View Answer


6. Which method deletes multiple (specified) indexes on a collection?

A. dropIndexes()
B. dropIndex()
C. Both A and B can be used
D. getIndexes()

View Answer


7. Which method returns the description of all the indexes int the collection?

A. putIndexes()
B. setIndexes()
C. getIndexes()
D. All of the above

View Answer


8. The maximum value of weights parameter is:

A. 999
B. 9999
C. 99999
D. 99

View Answer


9. What is the type of sparse parameter in createIndex()?

A. Boolean
B. string
C. integer
D. document

View Answer


10. What is the type of weights parameter in createIndex()?

A. Boolean
B. string
C. integer
D. document

View Answer





Discussion



* You must be logged in to add comment.