Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 4 MCQs Indexing and Aggregation Framework

CSE494 — Intelligent Nosql Databases 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Single Indexes Easy

    What is the main purpose of a single-field index in a NoSQL database?

  2. Question 2 of 60 Single Indexes Easy

    Which field could be indexed to quickly find a user by email address?

  3. Question 3 of 60 Single Indexes Easy

    What is a possible disadvantage of creating many single-field indexes?

  4. Question 4 of 60 Compound Indexes Easy

    What does a compound index contain?

  5. Question 5 of 60 Compound Indexes Easy

    A compound index is created on category and price. Which query is most directly supported by its field order?

  6. Question 6 of 60 Compound Indexes Easy

    Why does the order of fields matter in a compound index?

  7. Question 7 of 60 Text Indexes Easy

    What is the primary purpose of a text index?

  8. Question 8 of 60 Text Indexes Easy

    Which type of field is most suitable for a text index?

  9. Question 9 of 60 Text Indexes Easy

    A text search for database is mainly intended to find documents containing what?

  10. Question 10 of 60 Performance with Indexing Easy

    How can an appropriate index affect a read query?

  11. Question 11 of 60 Performance with Indexing Easy

    What is a common cost of maintaining indexes during writes?

  12. Question 12 of 60 Performance with Indexing Easy

    Which tool helps inspect how a database executes a query?

  13. Question 13 of 60 Covered Queries and explain() Easy

    What is a covered query?

  14. Question 14 of 60 Covered Queries and explain() Easy

    Which condition is important for a query to be covered?

  15. Question 15 of 60 Covered Queries and explain() Easy

    What can explain() show about a query?

  16. Question 16 of 60 Aggregation Pipeline Concepts Easy

    What is an aggregation pipeline?

  17. Question 17 of 60 Aggregation Pipeline Concepts Easy

    Which aggregation stage filters documents?

  18. Question 18 of 60 Aggregation Pipeline Concepts Easy

    Which aggregation stage groups documents by a field?

  19. Question 19 of 60 Real-world Aggregation Examples Easy

    Which task is a suitable real-world use of aggregation?

  20. Question 20 of 60 Real-world Aggregation Examples Easy

    A store wants the average rating for each product. Which operation is needed?

  21. Question 21 of 60 Single Indexes Medium

    A MongoDB collection named orders is frequently queried using { status: "pending" }. Which index most directly supports this query?

  22. Question 22 of 60 Single Indexes Medium

    A query filters products with { price: { $gte: 500 } } and sorts them using { price: -1 }. The collection has an index { price: 1 }. How can MongoDB use this index?

  23. Question 23 of 60 Single Indexes Medium

    A users collection has a unique index on email. What happens when an application inserts a document whose email already exists?

  24. Question 24 of 60 Compound Indexes Medium

    A collection has the compound index { customerId: 1, orderDate: -1 }. Which query can use both indexed fields most effectively?

  25. Question 25 of 60 Compound Indexes Medium

    A collection has an index { department: 1, salary: -1, name: 1 }. Which query relies only on a valid prefix of this index?

  26. Question 26 of 60 Compound Indexes Medium

    An application commonly runs { region: "West", amount: { $gt: 1000 } } and sorts by { createdAt: -1 }. Which index best follows the equality-sort-range guideline?

  27. Question 27 of 60 Text Indexes Medium

    A collection has a text index on title and description. Which query searches both indexed fields for the terms wireless and charger?

  28. Question 28 of 60 Text Indexes Medium

    A text search returns several articles. Which projection adds each document's relevance score so the results can be sorted by relevance?

  29. Question 29 of 60 Text Indexes Medium

    A compound text index is defined as { category: 1, content: "text" }. What must a query include to use the text portion of this index?

  30. Question 30 of 60 Performance with Indexing Medium

    After adding many indexes, read performance improves but write latency increases. What is the most likely cause?

  31. Question 31 of 60 Performance with Indexing Medium

    A query uses an indexed active field, but almost every document has active: true. Why might the index provide little performance benefit for that value?

  32. Question 32 of 60 Performance with Indexing Medium

    A query examines 90,000 documents but returns only 20. Which change is most likely to improve its read efficiency?

  33. Question 33 of 60 Covered Queries and explain() Medium

    A collection has an index { sku: 1, price: 1 }. Which query can be covered by this index, assuming sku and price are scalar fields?

  34. Question 34 of 60 Covered Queries and explain() Medium

    An explain("executionStats") result shows totalKeysExamined: 120, totalDocsExamined: 0, and nReturned: 120. What does this most strongly indicate?

  35. Question 35 of 60 Covered Queries and explain() Medium

    In a query plan, which stage most clearly indicates that MongoDB scanned the collection rather than using an index?

  36. Question 36 of 60 Aggregation Pipeline Concepts Medium

    A pipeline must calculate total sales per region only for orders placed in 2025. Which stage order is generally most efficient?

  37. Question 37 of 60 Aggregation Pipeline Concepts Medium

    Documents contain an items array, and a report needs one pipeline document per array element. Which stage should be used?

  38. Question 38 of 60 Aggregation Pipeline Concepts Medium

    Which accumulator correctly computes the average score for each courseId in a $group stage?

  39. Question 39 of 60 Real-world Aggregation Examples Medium

    An online store needs the three products with the highest total quantity sold. After unwinding items, which sequence should follow?

  40. Question 40 of 60 Real-world Aggregation Examples Medium

    A sales dashboard needs monthly revenue from documents containing saleDate, quantity, and unitPrice. Which approach is appropriate?

  41. Question 41 of 60 Single Indexes Hard

    A collection has a single-field multikey index { tags: 1 }. For the query { tags: ["red", "blank"] }, which behavior is most accurate?

  42. Question 42 of 60 Single Indexes Hard

    A unique single-field index is created on email. Some documents have email: null, while others omit email. What constraint does the index impose?

  43. Question 43 of 60 Single Indexes Hard

    An index is created as { email: 1 } with partialFilterExpression: { active: true }. Which query is eligible to use the complete partial index without risking omitted matching documents?

  44. Question 44 of 60 Compound Indexes Hard

    A query filters by tenantId = 7, restricts createdAt to a range, and sorts by rating descending. Which compound index best follows the ESR guideline while avoiding a blocking sort?

  45. Question 45 of 60 Compound Indexes Hard

    Given the compound index { a: 1, b: -1, c: 1 } and no filtering predicate, which sort can be satisfied by scanning the entire index in reverse?

  46. Question 46 of 60 Compound Indexes Hard

    A compound index { tags: 1, ratings: 1 } is required, and both fields may contain arrays. Under which condition can MongoDB maintain this compound multikey index?

  47. Question 47 of 60 Text Indexes Hard

    A compound text index is defined as { tenantId: 1, body: "text" }. Which predicate is required for efficient use of this index in a text search?

  48. Question 48 of 60 Text Indexes Hard

    Which query correctly returns documents matching database indexing and orders them by MongoDB text relevance?

  49. Question 49 of 60 Text Indexes Hard

    Documents contain a lang field that identifies the language used by each document's indexed text. Which text-index configuration enables per-document stemming and stop-word rules?

  50. Question 50 of 60 Performance with Indexing Hard

    A write-heavy collection has ten overlapping indexes, while read latency is already acceptable. What is the most likely effect of adding another index?

  51. Question 51 of 60 Performance with Indexing Hard

    A collection has an index { active: 1 }, but { active: true } matches approximately 48% of ten million documents. Why might the optimizer prefer a collection scan?

  52. Question 52 of 60 Covered Queries and explain() Hard

    Given the index { tenantId: 1, status: 1, total: 1 }, which query and projection can be fully covered by that index?

  53. Question 53 of 60 Covered Queries and explain() Hard

    The index { event: 1, tags: 1 } is multikey because tags is an array. Which query can still be covered, assuming no other stage forces a fetch?

  54. Question 54 of 60 Covered Queries and explain() Hard

    For a query filtering { tenant: 42, status: "open" }, sorting by { createdAt: -1 }, and limiting to 20, explain("executionStats") shows an IXSCAN on { status: 1 }, totalKeysExamined: 500000, totalDocsExamined: 500000, and nReturned: 20. Which index is the strongest improvement?

  55. Question 55 of 60 Aggregation Pipeline Concepts Hard

    Consider a pipeline where $addFields computes discounted, followed by $match: { region: "EU", discounted: { $lt: 100 } }. Which optimization is semantically valid?

  56. Question 56 of 60 Aggregation Pipeline Concepts Hard

    Four documents have items values ['a','b'], [], missing, and 'x', respectively. How many output documents result from $unwind with preserveNullAndEmptyArrays: true?

  57. Question 57 of 60 Aggregation Pipeline Concepts Hard

    A correlated $lookup compares foreign stock_item with a local item and foreign instock with local ordered using $expr. When can a foreign compound index { stock_item: 1, instock: 1 } support both comparisons?

  58. Question 58 of 60 Real-world Aggregation Examples Hard

    Each paid order contains lineItems, where every item has productId, quantity, and unitPrice. Which stage sequence correctly calculates revenue per product?

  59. Question 59 of 60 Real-world Aggregation Examples Hard

    A telemetry collection stores multiple status records per device. Which pipeline pattern reliably returns the most recent complete record for every deviceId?

  60. Question 60 of 60 Real-world Aggregation Examples Hard

    An API must return one page of filtered results and the total number of matching documents from the same aggregation input. Which pipeline design is most appropriate?

That's unit 4

Answer a few questions and your score shows up here.