Operators

Operators in Java are special symbols to perform specific tasks on operands. Operators can be classified into the following types: arithmetical, relational, increment/ decrement, logical and assignment.

Arithmetic operators are used to perform arithmetic operations, such as addition subtraction and multiplication. The arithmetic operators are of two types: unary operators and binary operators. The relational operators are used to compare two values and determine the relationship between them. The increment operator (++) adds 1 to operand’s value. The decrement operator (--) subtracts 1 from operand’s value. The logical operators are used to evaluate multiple conditions together as a single expression. The assignment operator is used to update the value of a variable.

To Access the full content, Please Purchase

  • Q1

    What are Arithmetic Operators?

    Marks:2
    Answer:

    There are 5 arithmetic operators.

    i) + ii) – iii) * iv} division as / and v) remainder as %

    View Answer
  • Q2

    Name the binary operators.

    Marks:2
    Answer:

    The binary operators are

    · Arithmetic Operators

    · Assignment Operators

    · Bitwise Operators

    · Logical Operators

    · Shift Operators

    · Relational Operators

    · Complement selection Operators

    · Class member Operators and

    · Conditional Operators

    View Answer
  • Q3

    Give three examples of bitwise operators used in Java.

    Marks:2
    Answer:

    (i) & (bitwise And)

    (ii) ! (Bitwise OR)

    (iii) ^ (bitwise exclusive OR also referred to as XOR)

    View Answer
  • Q4

    What are unary operators? Give some examples.

    Marks:2
    Answer:

    Operators that act on one operand are referred to as unary operators. Some examples are: ++ Increment Operator and –- decrement operator, && Address operator, * Indirection operator, + Unary plus, - unary minus, ! logical negation, _ bitwise compliment.

    View Answer
  • Q5

    What are Binary Operators?

    Marks:2
    Answer:

    They are operators that require two operands to operate upon. The examples are: Addition operator, Subtraction operator, Multiplication operator, Division operator, and Modulus operator.

    View Answer