Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare an integer with underscores for readability.
Kotlin
val number = 1[1]000_000
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using commas or dots inside number literals causes syntax errors.
Trying to use hyphens '-' inside numbers is invalid.
✗ Incorrect
In Kotlin, underscores can be used inside number literals to improve readability, like 1_000_000.
2fill in blank
mediumComplete the code to declare a hexadecimal number literal.
Kotlin
val hexNumber = [1]FF Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
0b which is for binary numbers.Using
0d or 0o which are invalid prefixes in Kotlin.✗ Incorrect
Hexadecimal literals in Kotlin start with 0x followed by hex digits.
3fill in blank
hardFix the error in the binary number literal declaration.
Kotlin
val binaryNumber = [1]1010_1010
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
0x which is for hexadecimal numbers.Using
0d or 0o which are invalid prefixes.✗ Incorrect
Binary literals in Kotlin start with 0b followed by binary digits.
4fill in blank
hardFill both blanks to create a hexadecimal number with underscores.
Kotlin
val color = [1]FF[2]00FF
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using hyphens instead of underscores.
Using binary prefix
0b for hex numbers.✗ Incorrect
Hexadecimal literals start with 0x. Underscores can separate digits for readability.
5fill in blank
hardFill all three blanks to declare a binary number with underscores and the correct prefix.
Kotlin
val mask = [1]1010[2]1010[3]1111
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using hexadecimal prefix
0x for binary numbers.Using hyphens instead of underscores.
✗ Incorrect
Binary literals start with 0b. Underscores _ can separate digits for clarity.