フリー問題

Java SE 11 Developer のフリー問題 3 / 20 問目

問題文

A pricing sheet rounds the measurement 2.5 through the method of the Math class that returns the nearest mathematical integer as a double, and the stored figure reads 2.0 where the reviewer expected 3.0. What does the Math class say about that method, and why?

選択肢

  1. It settles a tie toward positive infinity for either sign, because rint carries the tie rule that Math.round applies and that rule reaches for the larger of the two mathematical integers in every case
  2. It settles a tie on the even one of the two neighbors, because rint takes over the tie rule of Math.round and that rule reaches for the integer whose lowest bit has been cleared by the binary format itself
  3. It settles a tie on the even one of the two neighbors, because the rule in the specification of rint reaches for the integer value that is even whenever two mathematical integers sit equally close to it in binary
  4. It settles a tie toward positive infinity for either sign, because the binary format resolves a tie in the hardware of the machine well before rint is handed the value that two mathematical integers neighbor

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

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