nerdexam
CompTIA

DA0-001 · Question #317

Which of the following is the best variable formal to store a customer's age using the least possible amount of storage data?

The correct answer is A. Int. To store a customer's age using the least amount of storage, the Int data type is the most appropriate choice because age is typically represented as a whole number. Int uses less memory than floating-point types for whole numbers.

Data Concepts and Environments

Question

Which of the following is the best variable formal to store a customer's age using the least possible amount of storage data?

Options

  • AInt
  • BFloat
  • CChar
  • DDouble

How the community answered

(43 responses)
  • A
    88% (38)
  • B
    7% (3)
  • C
    2% (1)
  • D
    2% (1)

Why each option

To store a customer's age using the least amount of storage, the Int data type is the most appropriate choice because age is typically represented as a whole number. Int uses less memory than floating-point types for whole numbers.

AIntCorrect

Int (integer) is the most efficient data type for storing a customer's age, as age is typically a whole number without decimal points. Integers generally require less memory than floating-point types, ensuring minimal storage consumption for this type of data.

BFloat

Float is a floating-point data type used for numbers with decimal points, which is unnecessary for age and consumes more memory than an integer.

CChar

Char is used to store single characters and would be highly inefficient and inappropriate for storing a numerical age value.

DDouble

Double is a double-precision floating-point data type, which uses even more memory than Float and is also unsuitable for whole numbers like age.

Concept tested: Data types - Integer for efficiency

Source: https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/integral-numeric-types

Topics

#Data types#Storage efficiency#Integer data type

Community Discussion

No community discussion yet for this question.

Full DA0-001 Practice