nerdexam
CompTIA

FC0-U61 · Question #881

A developer is writing a script to calculate a bank account balance within two decimal places. Which of the following data types should the developer select to store the balance?

The correct answer is C. Float. A float is a data type that can store decimal numbers, such as 3.14 or 0.01. This is suitable for calculating a bank account balance within two decimal places, as it can represent fractions of a dollar. A boolean is a data type that can only store true or false values, which is n

Software Development

Question

A developer is writing a script to calculate a bank account balance within two decimal places. Which of the following data types should the developer select to store the balance?

Options

  • ABoolean
  • BInteger
  • CFloat
  • DChar

How the community answered

(22 responses)
  • C
    95% (21)
  • D
    5% (1)

Explanation

A float is a data type that can store decimal numbers, such as 3.14 or 0.01. This is suitable for calculating a bank account balance within two decimal places, as it can represent fractions of a dollar. A boolean is a data type that can only store true or false values, which is not useful for numerical calculations. An integer is a data type that can store whole numbers, such as 1 or 100, but not decimals. A char is a data type that can store a single character, such as a' or 9', but not multiple characters or decimals.

Topics

#data types#floating-point numbers#precision

Community Discussion

No community discussion yet for this question.

Full FC0-U61 Practice