MongoDB Questions and Answers Part-18

1. Which of the following pattern is best for static trees that do not change?
a) Child
b) Parent
c) Root
d) None of the mentioned

Answer: d
Explanation: The Nested Sets pattern provides a fast and efficient solution for finding subtrees but is inefficient for modifying the tree structure.

2. Point out the correct statement.
a) $regex is used for regular expression pattern matches
b) $like is used for regular expression pattern matches
c) $reg is used for regular expression pattern matches
d) All of the mentioned

Answer: a
Explanation: If your application needs to perform queries on the content of a field that holds text you can perform exact matches on the text.

3. Which of the following operations are atomic on document level?
a) update
b) remove
c) findAndModify
d) all of the mentioned

Answer: d
Explanation: In MongoDB, write operations, e.g. db.collection.update(), db.collection.findAndModify(), db.collection.remove(), are atomic on the level of a single document.

4. ___________ bulk indexes may be more efficient for some kinds of content and workloads in real time.
a) Synchronous
b) Asynchronous
c) Unique
d) None of the mentioned

Answer: b
Explanation: MongoDB can support keyword searches using specific data models and multi-key indexes;

5. Point out the correct statement.
a) An array with a large number of elements will incur greater indexing costs on insertion
b) An array with a large number of elements will incur smaller indexing costs on updates
c) An array with a small number of elements will incur greater indexing costs on insertion
d) None of the mentioned

Answer: a
Explanation: An array with a large number of elements, such as one with several hundred or thousands of keywords will incur greater indexing costs on insertion.

6. ________ indexes can include any field whose value is a string or an array of string elements.
a) text
b) string
c) char
d) none of the mentioned

Answer: a
Explanation: MongoDB provides text indexes to support text search of string content in documents of a collection.

7. Which of the following is related to document that do not provide a way to weight results?
a) Stemming
b) Synonyms
c) Ranking
d) None of the mentioned

Answer: c
Explanation: The keyword look ups described in this document do not provide a way to weight results.

8. Which of the following is related to document that provide support for synonym or related queries in the application layer?
a) Stemming
b) Synonyms
c) Ranking
d) None of the mentioned

Answer: b
Explanation: MongoDB can support keyword searches using specific data models and multi-key indexes.

9. Which of the following is related to the parsing of document for root?
a) Stemming
b) Synonyms
c) Ranking
d) None of the mentioned

Answer: a
Explanation: Keyword queries in MongoDB can not parse keywords for root or related words.

10. To add structures to your document to support keyword-based queries add the keywords as ______ in the array.
a) number
b) strings
c) character
d) none of the mentioned

Answer: b
Explanation: You can then create a multi-key index on the array and create queries that select values from the array.