Complete the code to check if two strings have the same content using structural equality.
val a = "hello" val b = "hello" println(a [1] b)
In Kotlin, == checks if two objects have the same content (structural equality).
Complete the code to check if two string variables point to the exact same object using referential equality.
val x = "world" val y = x println(x [1] y)
The === operator checks if two references point to the same object (referential equality).
Fix the error in the code to correctly compare two different String objects for content equality.
val s1 = String(charArrayOf('k', 'o', 't', 'l', 'i', 'n')) val s2 = String(charArrayOf('k', 'o', 't', 'l', 'i', 'n')) println(s1 [1] s2)
Use == to compare the content of two different String objects in Kotlin.
Fill both blanks to create a map of words to their lengths, but only include words with length greater than 3.
val words = listOf("cat", "kotlin", "dog", "java") val lengths = words.associateWith { it.[1] } val filtered = lengths.filter { it.value [2] 3 }
Use length to get the length of each word, and filter with > to keep words longer than 3.
Fill all three blanks to create a map of uppercase words to their lengths, including only words with length greater than 3.
val words = listOf("apple", "bat", "carrot", "dog") val result = words.associate { it.[1]() to it.[2] } val filtered = result.filter { it.value [3] 3 }
Use toUpperCase() to convert words to uppercase, length for their length, and > to filter lengths greater than 3.