11.) Which operator is used to query embedded documents in MongoDB?
A) $elemMatch
B) $nested
C) $lookup
D) Dot notation
12.) How do you limit the number of documents returned in a query?
A) db.collection.find().limit(n)
B) db.collection.limit(n)
C) db.collection.query.limit(n)
D) db.collection.resultLimit(n)
13.) How do you sort query results in MongoDB?
A) db.collection.sort({ field: 1 })
B) db.collection.find().sort({ field: 1 })
C) db.collection.find({}).order({ field: 1 })
D) db.collection.orderBy({ field: 1 })
14.) Which operator matches documents where all array elements meet the specified criteria?
A) $size
B) $match
C) $all
D) $elemMatch
15.) How do you include only specific fields in a query result?
A) { field: 1 }
B) { field: 0 }
C) { field: include }
D) { field: true }
16.) Which operator is used to match all values in an array?
A) $all
B) $in
C) $exists
D) $and
17.) What does the $regex operator do?
A) Matches values equal to a string
B) Matches values based on a regular expression
C) Checks if a field exists
D) Matches values not in an array
18.) Which MongoDB method skips a specific number of documents in query results?
A) db.collection.skip()
B) db.collection.query.skip(n)
C) db.collection.find().skip(n)
D) db.collection.limit().skip(n)
19.) What does the $type operator check?
A) If a field exists
B) The data type of a field
C) The value of a field
D) The size of an array
20.) Which MongoDB query method limits the output to specified fields only?
A) db.collection.find({}, { fields })
B) db.collection.find({}, { field: 1 })
C) db.collection.query({ fields: 1 })
D) db.collection.select({ field })
Related