Logical Operators

Last Updated :
Discuss
Comments

Question 1

What is the purpose of logical operators in MongoDB?

  • Insert data

  • Combine or negate conditions

  • Delete databases

  • Create collections

Question 2

Which operator performs a logical AND operation?

  • $or

  • $and

  • $not

  • $nor

Question 3

Which operator performs a logical OR operation?

  • $and

  • $nor

  • $or

  • $not

Question 4

Which operator negates a condition?

  • $and

  • $or

  • $not

  • $nor

Question 5

Which operator returns documents that do NOT match any condition?

  • $not

  • $nor

  • $and

  • $or

Question 6

What does $and operator require?

  • At least one condition true

  • All conditions true

  • No condition true

  • Only one condition

Question 7

What does $or operator require?

  • All conditions true

  • At least one condition true

  • No condition true

  • Only one condition allowed

Question 8

Which operator is equivalent to NOT OR?

  • $and

  • $not

  • $nor

  • $or

Question 9

Which query finds documents where age is NOT greater than 30?

  • {age: {$gt:30}}

  • {age: {$not: {$gt:30}}}

  • {age: {$lt:30}}

  • {age: {$or:30}}

Question 10

Which operator can combine multiple conditions into an array?

  • $not

  • $nor

  • $and

  • $cmp

There are 15 questions to complete.

Take a part in the ongoing discussion