Java

1. Which of the following expression evaluates to a value of 15?
1+2x3+4
(1+2)x(3+4)
1+2x(3+4)
(1+2)x3+4**
2. If x is an int which of the following statements adds 5 to the current value of x and store the new value back in x?
x=5;
x+5; **
x =+ 5;
x += 5;
3. If x is an int which of the following statements increments x by 1?
x = 1;
x+;
x++;
x + 1 = x; **
4. If d is a double variable with a value of 7.5 which of the following statements results in a value of 7 being assigned to x?
int x = (int)d;
int x = d;
int x = int(d); **
double x = d;
5. If the Unicode value for the letter A is 0041. Which of the following statements correctly assigns the value 'A' to char variable n?
char n = 41;
char n = '\u0041 ' ; **
char n = '0041';
char n = A;
Is this all correct? If not can you tell me how I am wrong? Thank you

  1. 👍 0
  2. 👎 0
  3. 👁 684
  1. If you're using java, ya gotta stop using "x" for multiplication. Use "*".

    #1. Nope
    (1+2)*3+4 = 3*3+4 = 9+4 = 13

    #2 Nope
    x+5 is just an expression which yields the sum of x and 5. It does not update the value of x.

    #3 Nope
    x+1 = x is invalid syntax. Try it in your java compiler.

    #4 Nope
    int(d) is invalid. You want to change the type of d, not call a function named "int". Try it out and you will get an error message.

    #5 ok

    1. 👍 0
    2. 👎 0

Respond to this Question

First Name

Your Response

Similar Questions

  1. Math. Check my answers

    1. What is the solution to 89+k=-42? a. K = 131 b. K = 47 c. K = -47 d. K = -131** 2. What is the additive inverse of -7? a. -7 b. 7** c. -|-7| d. -(-(-7)) 3. What is the solution to y-7=-7? a. y=14 b. y=7 c. y=0** d. y=-7 4. What

  2. Algebra

    1. Use the Distributive Property to simplify the expression. (-1)(4-c) 2. Use the Distributive Property to simplify the expression. 4(2x -4) 3. Use the Distributive Property to simplify the expression. (10 + 4 y) 1/2 4. To which

  3. Algebra

    1. Use the Distributive Property to simplify the expression. (-1) (4-c) 2. Use the Distributive Property to simplify the expression. 4 (2 x - 4) 3. Use the Distributive Property to simplify the expression (10+4y) 1/2 4. To which

  4. algebra II

    What are the possible rational zeros of f(x) = 2x3 – 15x2 + 9x + 22?

  1. Math: Please check my answers

    1. What is the degree of the monomial 3x2y3? 2 3 5 6 2. What is the simplified form of 8b3c2 + 4b3c2? 12bc 12b3c2 12b6c4 12b9c4 3. What is the simplified form of (4j2 + 6) + (2j2 – 3) ? (1 point) (0) 6j2 – 3 (1) 6j2 + 3 (0)

  2. math

    Which statement is true about the value of (5−n)(5n)? a.For all n, the value of the expression is 0. b.For n

  3. algebra

    Algebra 1. Use the Distributive Property to simplify the expression. (-1)(4-c) 2. Use the Distributive Property to simplify the expression. 4(2x -4) 3. Use the Distributive Property to simplify the expression. (10 + 4 y) 1/2 4. To

  4. pesh uni

    2x1+2x2+2x3=0 -2x1+5x2+2x3=1 8x1+x2+4x3=1 gauss elimnation method plz sol any one

  1. calculus

    1. Which of the following expressions is the definition of the derivative of f(x) = cos(x) at the point (2, cos(2))? 2. Find the derivative of f(x) = |x + 2| at the point (1, 3) 3. Find f '(x) for f(x) = -2x3 + 3x2 - x + 15. 4.

  2. Maths

    Number of solutions satisfying the equation, 3x²-2x³=log(x²+1)-logx is a) 1 b) 2 c) 3 d) none

  3. algebra

    Let X be a number. Translate the English phrase or sentence into a mathematical expression. Then evaluate the expression for X =8. The expression is ?

  4. Math

    j+150 times 50 is a(n)_ expression, because_ . numerical expression; it consists of only numbers numerical expression; it consists of operation symbols algebraic expression; it consists of numbers and a variable algebraic

You can view more similar questions or ask a new question.