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.
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)- A88% (38)
- B7% (3)
- C2% (1)
- D2% (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.
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.
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.
Char is used to store single characters and would be highly inefficient and inappropriate for storing a numerical age value.
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
Community Discussion
No community discussion yet for this question.