A variable should hold a person's height in meters. Which data type should the variable be?

Prepare for the WGU EDUC5289 D017 School Law Test. Engage with flashcards and multiple-choice questions, each with hints and explanations. Get exam-ready now!

The appropriate data type for holding a person's height in meters is a float. This is because height is a measurement that can involve decimal places, such as 1.75 meters or 1.62 meters. A float, which is a data type used to represent numbers that are not whole numbers, allows for this level of precision.

In contrast, an integer can only store whole numbers and would not be suitable for values like 1.5 or 1.75 meters, which are commonly used in height measurements. A string, which is meant for text, would also be inappropriate as it does not allow for numerical operations or comparisons effectively. Lastly, a boolean data type, which only stores true or false values, is not relevant when measuring something like height. Thus, float is clearly the ideal choice for representing height accurately.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy