VOOZH about

URL: https://www.geeksforgeeks.org/quizzes/mongodb-operators-quiz/

⇱ Quiz about MongoDB Operators Quiz


Last Updated :
Discuss
Comments

Question 1

Which MongoDB operator is used to compare two values and return -1, 0, or 1?

  • $gt

  • $eq

  • $cmp

  • $lte

Question 2

What does the $gte operator do in MongoDB?

  • Compares if one value is greater than another

  • Checks if a field is greater than or equal to a given value

  • Compares if one value is strictly equal to another

  • Sorts documents in ascending order

Question 3

Which logical operator in MongoDB returns true if all conditions are met?

  • $or

  • $nor

  • $not

  •  $and

Question 4

What does the $multiply operator do in MongoDB?

  • Multiplies two values

  • Finds the product of an array of numbers

  • Multiplies a field value by a specified number

  • Performs an aggregation on numeric fields

Question 5

Which MongoDB operator adds elements to an array?

  • $push

  • $pop

  • $pullAll

  • $unset

Question 6

How does the $pop operator work in MongoDB?

  • Removes the last element of an array

  • Removes the first element of an array

  • Removes an element at a specified index

  • Can remove the first or last element of an array

Question 7

What is the function of the $rename operator in MongoDB?

  • Updates a field’s value

  • Renames a field in a document

  • Changes the type of a field

  • Removes a field from a document

Question 8

Which array query operator is used to return the length of an array?

  • $size

  •  $isArray

  • $arrayElemAt

  • $count

Question 9

What does the $strcasecmp operator do in MongoDB?

  • Concatenates two strings

  • Converts a string to uppercase

  • Compares two strings case-insensitively

  • Splits a string into an array

Question 10

How do you find an element at a specific index in a MongoDB array?

  • $elemMatch

  • $arrayElemAt

  • $indexOfArray

  • $slice

Tags:

There are 10 questions to complete.

Take a part in the ongoing discussion