FC0-U61 · Question #413
A global variable called "age" will be created in a program and incremented through the use of a function. Which of the following data types should be defined with the age variable?
The correct answer is A. Integer. Integer is a data type that can store whole numbers, such as 1, 0, or -2. Integer would be the best data type to use for creating a variable to hold an age value because age is usually expressed as a whole number of years. Float, double, and string are not data types that would…
Question
A global variable called "age" will be created in a program and incremented through the use of a function. Which of the following data types should be defined with the age variable?
Options
- AInteger
- BFloat
- CDouble
- DString
How the community answered
(48 responses)- A90% (43)
- B2% (1)
- C6% (3)
- D2% (1)
Explanation
Integer is a data type that can store whole numbers, such as 1, 0, or -2. Integer would be the best data type to use for creating a variable to hold an age value because age is usually expressed as a whole number of years. Float, double, and string are not data types that would be suitable for creating a variable to hold an age value. Float and double are data types that can store decimal or fractional numbers, such as 3.14, 0.5, or -2.75. String is a data type that can store text or characters, such as "Hello", "A", or "123".
Topics
Community Discussion
No community discussion yet for this question.