Quiz: Java Operators

To View Tricks: Login Required

Number of Questions: 20

Question: 1 -

Which of the following can be operands of arithmetic operators?

Options:
  1. Both Numeric & Characters

  2. Numeric

  3. Characters

  4. Boolean

  5. Answer:

    Both Numeric & Characters

    Solution:

    The operand of arithmetic operators can be any of numeric or character type, But not boolean.


Question: 2 -

Modulus operator, %, can be applied to which of these?

Options:
  1. Both Integers and floating - point numbers

  2. None of the mentioned

  3. Floating - point numbers

  4. Integers

  5. Answer:

    Both Integers and floating - point numbers

    Solution:

    Modulus operator can be applied to both integers and floating point numbers.


Question: 3 -

Can 8 byte long data type be automatically type cast to 4 byte float data type?

Options:
  1. can not say

  2. TRUE

  3. Can be true or false

  4. FALSE

  5. Answer:

    TRUE

    Solution:

    Both data types have different memory representation that is why 8-byte integral data type can be stored to 4-byte floating point data type.


Question: 4 -

Decrement operator, −−, decreases the value of variable by what number?

Options:
  1. 1

  2. 4

  3. 2

  4. 3

  5. Answer:

    1

    Solution not available.

Question: 5 -

Which of these statements are incorrect?

Options:
  1. Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms

  2. None of the mentioned

  3. Assignment operators run faster than their equivalent long forms

  4. Assignment operators can be used only with numeric and character data type

  5. Answer:

    None of the mentioned

    Solution not available.