Logical Operators

Last Updated :
Discuss
Comments

Question 1

What is the purpose of logical operators in MongoDB?

  • A

    Insert data

  • B

    Combine or negate conditions

  • C

    Delete databases

  • D

    Create collections

Question 2

Which operator performs a logical AND operation?

  • A

    $or

  • B

    $and

  • C

    $not

  • D

    $nor

Question 3

Which operator performs a logical OR operation?

  • A

    $and

  • B

    $nor

  • C

    $or

  • D

    $not

Question 4

Which operator negates a condition?

  • A

    $and

  • B

    $or

  • C

    $not

  • D

    $nor

Question 5

Which operator returns documents that do NOT match any condition?

  • A

    $not

  • B

    $nor

  • C

    $and

  • D

    $or

Question 6

What does $and operator require?

  • A

    At least one condition true

  • B

    All conditions true

  • C

    No condition true

  • D

    Only one condition

Question 7

What does $or operator require?

  • A

    All conditions true

  • B

    At least one condition true

  • C

    No condition true

  • D

    Only one condition allowed

Question 8

Which operator is equivalent to NOT OR?

  • A

    $and

  • B

    $not

  • C

    $nor

  • D

    $or

Question 9

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

  • A

    {age: {$gt:30}}

  • B

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

  • C

    {age: {$lt:30}}

  • D

    {age: {$or:30}}

Question 10

Which operator can combine multiple conditions into an array?

  • A

    $not

  • B

    $nor

  • C

    $and

  • D

    $cmp

There are 15 questions to complete.

Take a part in the ongoing discussion