nerdexam
Oracle

1Z0-851 · Question #162

Given: NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); nf.setMinimumFractionDigits(2); String a = nf.format(3.1415926); String b = nf.format(2); Which two statements…

The correct answer is C. The value of b is 2.00. F. The value of a is 3.1416. See the full explanation below for the reasoning.

Question

Given: NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); nf.setMinimumFractionDigits(2); String a = nf.format(3.1415926); String b = nf.format(2); Which two statements are true about the result if the default locale is Locale.US? (Choose two.)

Options

  • AThe value of b is 2.
  • BThe value of a is 3.14.
  • CThe value of b is 2.00.
  • DThe value of a is 3.141.
  • EThe value of a is 3.1415.
  • FThe value of a is 3.1416.
  • GThe value of b is 2.0000.

How the community answered

(32 responses)
  • B
    9% (3)
  • C
    81% (26)
  • D
    6% (2)
  • E
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice