nerdexam
CompTIA

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…

Software Development

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)
  • A
    90% (43)
  • B
    2% (1)
  • C
    6% (3)
  • D
    2% (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

#data types#integer#variables#programming fundamentals

Community Discussion

No community discussion yet for this question.

Full FC0-U61 Practice