Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Sorting Limiting Pagination
mcq
Direction: Choose the correct option

Q1.

How do you sort query results in MongoDB?
A. Using the `order()` method
B. Using the `arrange()` method
C. Using the `sort()` method
D. Using the `orderBy()` method
Direction: Choose the correct option

Q2.

What does `sort({age: -1})` do?
A. Sorts by age in ascending order
B. Sorts by age and then by -1
C. Sorts by age in descending order
D. Removes the age field
Direction: Choose the correct option

Q3.

Which method limits the number of documents returned in a query?
A. `max()`
B. `first()`
C. `limit()`
D. `take()`
Direction: Choose the correct option

Q4.

How do you implement pagination (skip some documents and limit the rest)?
A. `page(n).size(m)`
B. `start(n).end(m)`
C. `skip(n).limit(m)`
D. `offset(n).limit(m)`
Direction: Choose the correct option

Q5.

Given `db.products.find().sort({price: 1}).limit(5).skip(10)`, what does this do?
A. Gets the first 5 cheapest products
B. Gets 5 products randomly
C. Gets all products sorted by price
D. Gets products 11-15 sorted by price ascending