What are unary, binary and ternary operators?

Q10. What are unary, binary and ternary operators? Classify the operators you have learnt so far into these three categories.

Ans.  Unary Operators

Operators that act on one operand are referred to as Unary Operators.

Following are unary operators:

Unary +

Unary –

Increment ++

Decrement —

Logical Not !

Binary Operators

Operators that act upon two operands are referred to as Binary Operators.

Following are binary operators:

Addition +

Subtraction –

Multiplication *

Division /

Modulus %

Less than <

Less than or equal to <=

Equal to ==

Greater than >

Greater than or equal to >=

Not equal to !=

Logical OR ||

Logical AND &&

Ternary Operators

Operators that act upon three operands are referred to as Ternary Operators.

Following are ternary operators:

?:

Leave a Reply

Your email address will not be published. Required fields are marked *

298 Views
%d bloggers like this: