Basic Operators


  1. Which of these statements are incorrect?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    None


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    None



  1. With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?

    1. x++;
    2. x = x + 1;
    3. x += 1;
    4. x =+ 1;











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Operator ++ increases value of variable by 1. x = x + 1 can also be written in shorthand form as x += 1. Also x =+ 1 will set the value of x to 1.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

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



  1. Which of the following can be operands of arithmetic operators?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

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