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?
Correct Answer: A
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". References: CompTIA IT Fundamentals+ Study Guide: Exam FC0-U61, Second Edition, Chapter 4: Programming Concepts and Data Structures, page 146.