Courseiva
CRUD Operations →mediumMultiple Choice

C100DBA CRUD Operations Practice Question

Exhibit

db.products.find({tags: 'electronics', price: {$lt: 500}}).sort({price: 1}).limit(5).pretty()

Refer to the exhibit. Which documents will this query return?

⚠ Common exam trap

Candidates often overlook the order of operations, forgetting that sorting and limiting happen after the filter is applied. They may guess the order incorrectly when multiple modifiers are present.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

The 5 cheapest products tagged 'electronics' that cost less than 500.

This query retrieves documents containing 'electronics' in the 'tags' array where the price is less than 500. The results are ordered by price in ascending order, and only the first 5 documents are returned. This combination demonstrates how to perform complex filtering, sorting, and limiting, which is fundamental for building performant search and discovery features in MongoDB-backed applications.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    All documents with 'electronics' tag sorted by price ascending.

    Why it's wrong here

    The query includes a limit(5) clause, meaning it will return at most five documents. Returning all documents would ignore the limit modifier, which is crucial for controlling memory usage and network overhead when dealing with large collections of data in a production environment.

  • ✓

    The 5 cheapest products tagged 'electronics' that cost less than 500.

    Why this is correct

    The query correctly filters by the tag and price range, sorts by price in ascending order to find the cheapest items, and restricts the output to the top five results. This accurately describes the logic executed by the MongoDB query engine based on the provided find, sort, and limit.

  • ✗

    Any 5 products with price less than 500, regardless of tags.

    Why it's wrong here

    The query includes a filter on the 'tags' field. MongoDB only considers documents where the 'tags' array contains the specific string 'electronics'. Ignoring the filter condition would return incorrect data for the application's business requirement, which specifically targets electronics within a certain price range.

  • ✗

    The 5 most expensive products tagged 'electronics' that cost less than 500.

    Why it's wrong here

    The sort order is specified as {price: 1}, which corresponds to ascending order (cheapest to most expensive). To get the most expensive products, the sort would need to be {price: -1}. The current order will return the lowest prices first, not the highest prices.

About these practice questions

One of 222 original C100DBA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official MongoDB exam blueprint

This C100DBA practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DBA exam.