Java OCA OCP Practice Question 1042

Question

What is the value of x after the following line is executed?

x = 32 * (31 - 10 * 3); 
  • A. 32
  • B. 31
  • C. 3
  • D. 704
  • E. None of the above


A.

Note

Using the order of precedence, the equation contained within the parentheses is evaluated first.

Using the order of precedence within the parentheses, the multiplication is executed first (10 * 3 = 30) and then the subtraction (31 - 30 = 1).

Once this is completed, the final equation is executed as 32 * 1, which equals 32.




PreviousNext

Related