Courseiva

C100DEV · topic practice

Indexing practice questions

This domain covers MongoDB index types, compound index field order, index selection, and how indexes affect read and write performance. Questions present realistic query patterns and schema shapes, then ask you to choose or evaluate an index definition, predict multikey behavior, or explain write overhead. You must reason about equality, sort, and range fields together.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
20 questionsDomain: Indexing

What the exam tests

What to know about Indexing

Be able to map a query's equality, sort, and range fields to a compound index key order, and to spot multikey and parallel-array problems. The most important thing: get field order right, since equality fields precede sort fields, and confirm with explain().

Choosing compound index field order for queries combining equality filters and sorts

Recognizing multikey indexes and the restriction on indexing parallel arrays

Using explain() to identify COLLSCAN, IXSCAN, and index usage in winning plans

Evaluating write amplification and storage cost from excess indexes on a collection

Watch out for

Common Indexing exam traps

  • ▸Creating an index on two array fields in one document, which MongoDB rejects as a parallel-array multikey index.
  • ▸Placing the sort field before equality fields in a compound index, preventing the index from supporting the sort.
  • ▸Assuming an index helps every query; low-selectivity or unused indexes only add write and storage overhead.

Practice set

Indexing questions

20 questions · select your answer, then reveal the explanation

Question 1mediummultiple choice
Read the full Indexing explanation →

An application frequently queries a collection using equality conditions on 'status' and 'category', followed by a range filter on 'created_at', and sorts the final results by 'priority' descending. How should you design a compound index for optimal performance according to the ESR rule?

Question 2mediummultiple choice
Read the full Indexing explanation →

An application queries an array field named 'tags' containing strings for product categorization. Queries frequently search for documents matching multiple tags simultaneously. Which index strategy optimizes this query workload?

Question 3mediummulti select
Read the full Indexing explanation →

A developer needs to ensure that the 'email' field in a 'users' collection is unique across all documents. Which TWO statements accurately describe the behavior or requirements of unique indexes in MongoDB?

Question 4hardmultiple choice
Read the full Indexing explanation →

You have a collection with 10 million documents. Most documents have a 'status' of 'processed', but about 1% have a 'status' of 'pending'. You frequently query for 'pending' documents sorted by 'creation_date'. Which indexing strategy provides the best balance between write performance and query efficiency?

Question 5mediummultiple choice
Read the full Indexing explanation →

Refer to the exhibit. Based on the explain output provided for a query on the 'logs' collection, which of the following is true about the query performance?

Exhibit

{
  "queryPlanner": {
    "winningPlan": {
      "stage": "FETCH",
      "inputStage": {
        "stage": "IXSCAN",
        "keyPattern": { "userId": 1, "timestamp": -1 },
        "indexName": "userId_1_timestamp_-1",
        "direction": "forward"
      }
    }
  },
  "executionStats": {
    "nReturned": 50,
    "totalKeysExamined": 50,
    "totalDocsExamined": 50
  }
}
Question 6mediummulti select
Read the full Indexing explanation →

You are implementing a session management system using MongoDB. Which TWO of the following are true regarding the use of TTL (Time-To-Live) indexes?

Question 7hardmulti select
Read the full Indexing explanation →

You have an index defined as { last_name: 1, first_name: -1 }. Which TWO of the following sort patterns can be efficiently satisfied by this index?

Question 8hardmulti select
Read the full Indexing explanation →

A developer wants to use a Wildcard Index to handle highly dynamic metadata fields. Which THREE of the following are limitations or characteristics of Wildcard Indexes?

Question 9hardmulti select
Read the full Indexing explanation →

Which TWO of the following statements regarding wildcard indexes in MongoDB are correct?

Question 10mediummultiple choice
Read the full Indexing explanation →

Refer to the exhibit. Which compound index would be most efficient for this query?

Exhibit

db.users.find({age: {$gt: 25}, status: 'active'}).sort({name: 1})
Question 11mediummulti select
Read the full Indexing explanation →

Which THREE of the following are valid limitations or behaviors of hashed indexes?

Question 12mediummultiple choice
Read the full Indexing explanation →

Refer to the exhibit. Which of the following queries can be served efficiently by this index?

Exhibit

db.products.createIndex({category: 1, price: -1})
Question 13mediummultiple choice
Read the full Indexing explanation →

An application frequently queries a collection of user profiles using an equality condition on the status field followed by a range condition on the created_at timestamp field. Which compound index structure provides optimal ESR (Equality, Sort, Range) rule compliance?

Question 14mediummultiple choice
Read the full Indexing explanation →

An application frequently queries a collection of user profiles using an equality condition on the 'status' field, followed by a range condition on the 'age' field, and then sorts the resulting documents by 'joinDate' in descending order. Which single index structure follows the ESR rule most effectively?

Question 15mediummultiple choice
Read the full Indexing explanation →

An e-commerce application frequently queries a collection by filtering on category and sorting by price descending. You need to create an index that efficiently supports both the equality query and the sort operation without requiring an in-memory sort stage. How should you define the index key pattern?

Question 16hardmultiple choice
Read the full Indexing explanation →

A collection contains large documents with deeply nested arrays. You want to create an index on a field inside these arrays to support queries matching multiple elements simultaneously. Which index type provides this capability while preventing Cartesian explosions in index size?

Question 17mediummultiple choice
Read the full Indexing explanation →

A collection `inventory` has an index `{ category: 1, price: 1 }`. A developer runs `db.inventory.find({ price: { $gt: 100 } }).sort({ category: 1 }).explain('executionStats')` and notices a high number of documents examined. They want to reduce the number of examined documents while keeping the same index. Which index usage strategy should they apply?

Question 18mediummultiple choice
Read the full Indexing explanation →

A social media application has a `posts` collection with a field `tags` that is an array of strings. You create an index on `{ tags: 1 }`. A query retrieves posts that contain both "mongodb" and "database" in the `tags` array. Which statement accurately describes how MongoDB uses this index for the query?

Question 19hardmulti select
Read the full Indexing explanation →

A development team is designing an index strategy for a MongoDB collection that stores sensor readings. Each document has a `sensor_id` field, a `timestamp` field, and a `value` field. The team needs to support queries that filter on `sensor_id`, filter on a range of `timestamp`, and project only `sensor_id` and `timestamp`. They also want to minimize the number of indexes and ensure queries are covered. Which TWO of the following statements are true regarding the creation of a compound index to achieve these goals? (Choose two.)

Question 20hardmultiple choice
Read the full Indexing explanation →

You have a collection `orders` with a compound index on `{ customer_id: 1, order_date: -1, status: 1 }`. A query filters on `customer_id` and `status`, and sorts by `order_date` descending. Which statement best describes the index's ability to support this query efficiently?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Indexing sessions

Start a Indexing only practice session

Every question in these sessions is drawn from the Indexing domain — nothing else.

Related practice questions

Related C100DEV topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the C100DEV exam test about Indexing?
Be able to map a query's equality, sort, and range fields to a compound index key order, and to spot multikey and parallel-array problems. The most important thing: get field order right, since equality fields precede sort fields, and confirm with explain().
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Indexing questions in a focused session?
Yes — the session launcher on this page draws every question from the Indexing domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other C100DEV topics?
Use the topic links above to move to related areas, or go back to the C100DEV question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the C100DEV exam covers. They are not copied from any real exam or dump site.