Question:

Which of the following is called 'NOT' operator ?

Show Hint

Think `!` for logical operations (true/false) and `~` for bitwise operations (flipping 1s and 0s).
  • \textasciitilde
  • !
  • &&
  • ||
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Distinguish between different types of NOT operators. In languages like C++, there are two types of "not" operators:

Logical NOT (`!`): This operator is used to invert the truth value of a boolean expression. `!true` is `false`, and `!false` is `true`.
Bitwise NOT (`~`): This operator is used to invert all the bits of a binary number.

Step 2: Analyze the options in common context.

(A) \text{\textasciitilde}: This is the bitwise NOT operator.
(B) \text{!}: This is the logical NOT operator. It is the most common operator referred to simply as "the NOT operator".
(C) \text{&&}: This is the logical AND operator.
(D) \text{||}: This is the logical OR operator.
In general programming context, when someone refers to the "NOT operator", they are almost always referring to the logical NOT (`!`).
Was this answer helpful?
0
0