フリー問題

Java SE 17 Developer のフリー問題 1 / 20 問目

問題文

A summary screen needs the whole number that is nearest to a double value, and the value can be negative. Which statement about Math.round is accurate?

選択肢

  1. It drops the fraction in the same way as a cast to long does, so an argument of 2.7 comes back as 2 instead of as 3
  2. It returns a double when the argument is a double, so the result has to be rounded a second time before it can be stored in a long
  3. It adds one half to the argument and then takes the floor, so an argument of minus 2.5 comes back as minus 2 rather than as minus 3
  4. It moves a value away from zero whenever the fraction is exactly one half, so minus 2.5 comes back as minus 3

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。