0
0
Kotlinprogramming~10 mins

Project structure and build basics 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 the main function in Kotlin.

Kotlin
fun [1]() {
    println("Hello, Kotlin!")
}
Drag options to blanks, or click blank then click option'
Aexecute
Bstart
Cmain
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different function name like 'start' or 'run' which won't be recognized as the entry point.
2fill in blank
medium

Complete the code to define a Kotlin source file path inside the standard project structure.

Kotlin
src/[1]/kotlin/com/example/app/Main.kt
Drag options to blanks, or click blank then click option'
Amain
Btest
Cresources
Djava
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'test' or 'resources' folder for main source files.
3fill in blank
hard

Fix the error in the Gradle build script to apply the Kotlin plugin.

Kotlin
plugins {
    id("[1]") version "1.8.0"
}
Drag options to blanks, or click blank then click option'
Ajava
Bkotlin-android
Capplication
Dkotlin-jvm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'java' plugin id which is for Java projects.
Using 'kotlin-android' for non-Android projects.
4fill in blank
hard

Fill both blanks to create a Kotlin data class with two properties.

Kotlin
data class User(val [1]: String, val [2]: Int)
Drag options to blanks, or click blank then click option'
Aname
Bage
Cemail
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using properties with wrong types or unrelated names.
5fill in blank
hard

Fill all three blanks to create a Gradle dependency declaration for Kotlin standard library.

Kotlin
dependencies {
    implementation("org.jetbrains.kotlin:[1]:[2]")
    testImplementation("org.jetbrains.kotlin:kotlin-test:[3]")
}
Drag options to blanks, or click blank then click option'
Akotlin-stdlib
B1.8.0
Dkotlin-reflect
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong library names or mismatched versions.