0
0
Kotlinprogramming~10 mins

Char type and Unicode behavior in Kotlin - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a Char variable holding the letter 'A'.

Kotlin
val letter: Char = '[1]'
Drag options to blanks, or click blank then click option'
A"A"
B'A'
CA
D'AA'
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes instead of single quotes for Char.
Trying to assign multiple characters to a Char.
2fill in blank
medium

Complete the code to print the Unicode code of the Char 'Z'.

Kotlin
println([1].code)
Drag options to blanks, or click blank then click option'
A'Z'
B"Z"
C'z'
DZ
Attempts:
3 left
💡 Hint
Common Mistakes
Using double quotes instead of single quotes.
Using a variable name without quotes.
3fill in blank
hard

Fix the error in the code to convert an Int to a Char.

Kotlin
val ch: Char = 65.[1]()
Drag options to blanks, or click blank then click option'
AtoChar
BChar
CtoCharCode
Dchar
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to use Char() constructor with an Int.
Using a non-existent function like toCharCode.
4fill in blank
hard

Fill both blanks to create a map of characters to their Unicode codes for letters 'a' to 'c'.

Kotlin
val map = mapOf([1] to [2], 'b' to 'b'.code, 'c' to 'c'.code)
Drag options to blanks, or click blank then click option'
A'a'
B'a'.code
C'b'
D'c'
Attempts:
3 left
💡 Hint
Common Mistakes
Using strings with double quotes instead of Chars.
Using Char without quotes.
5fill in blank
hard

Fill all three blanks to create a list of Chars from Unicode codes 65 to 67.

Kotlin
val chars = listOf([1](65), 66.[2](), 67.[3]())
Drag options to blanks, or click blank then click option'
AChar
BtoChar
CtoChar()
Dchar
Attempts:
3 left
💡 Hint
Common Mistakes
Using toChar without parentheses.
Using lowercase 'char' which is invalid.