Recall & Review
beginner
What is the Int type in Kotlin?
Int is a number type in Kotlin that stores whole numbers without decimals. It uses 32 bits and can hold values from -2,147,483,648 to 2,147,483,647.
Click to reveal answer
beginner
How is Long different from Int in Kotlin?
Long is a number type that stores bigger whole numbers than Int. It uses 64 bits and can hold values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Click to reveal answer
beginner
What does the Float type represent in Kotlin?
Float is a number type for decimal numbers (numbers with fractions). It uses 32 bits and is less precise than Double. You write a Float number with an 'f' or 'F' at the end, like 3.14f.
Click to reveal answer
beginner
Explain the Double type in Kotlin.
Double is a number type for decimal numbers with more precision than Float. It uses 64 bits and is the default type for decimal numbers in Kotlin.
Click to reveal answer
beginner
How do you write a Long and a Float literal in Kotlin?
To write a Long number, add 'L' or 'l' at the end, like 123L. To write a Float number, add 'f' or 'F' at the end, like 3.14f.
Click to reveal answer
Which Kotlin type would you use to store the number 5000000000?
✗ Incorrect
5000000000 is too big for Int, so Long is the correct type.
What suffix do you add to a number to make it a Float in Kotlin?
✗ Incorrect
You add 'f' to make a number a Float, like 2.5f.
Which type is the default for decimal numbers in Kotlin?
✗ Incorrect
Double is the default decimal type in Kotlin.
What is the size in bits of the Int type in Kotlin?
✗ Incorrect
Int uses 32 bits to store whole numbers.
Which type can store the largest whole number?
✗ Incorrect
Long can store larger whole numbers than Int.
Describe the differences between Int, Long, Float, and Double in Kotlin.
Think about size, precision, and whether the number has decimals.
You got /4 concepts.
How do you write literals for Long and Float types in Kotlin? Give examples.
Remember the suffix letters for each type.
You got /2 concepts.