Which of the following is a fundamental data type in Kotlin used to represent whole numbers?

Computer Science
Which of the following is a fundamental data type in Kotlin used to represent whole numbers?

ScanSolve AI Answer

Answer

Int

Step 1: Whole numbers are integers, such as 10, without fractional parts.

Step 2: Kotlin has fundamental integer data types for whole numbers:

  • Byte: 8-bit integers (-128 to 127)
  • Short: 16-bit integers (-32,768 to 32,767)
  • Int: 32-bit integers (-2,147,483,648 to 2,147,483,647)
  • Long: 64-bit integers (with L suffix)

Step 3: The declaration shown uses Int for the whole number 10:

val num: Int = 10\texttt{val num: Int = 10}

Int is the standard fundamental data type for most whole numbers in Kotlin.

** Int **

Was this helpful?

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question