Kotlin Fundamentals Practice (Interactive)
Intuition
Learning through practice: Practice problems are like training drills — they help you apply knowledge and identify areas that need more study.
Why it matters: Regular practice builds confidence and reveals patterns in how concepts are tested. Each problem reinforces key programming concepts.
The key insight: Making mistakes during practice is valuable — each error points to a concept that needs clarification.
Kotlin — Fundamentals Practice
10 auto-graded practice problems covering Kotlin fundamentals. Select an answer, submit, and review the explanation.
Null Safety
Coroutines
Scope Functions
Sealed Classes
Extension Functions
Delegation
Type System
Collections
Inline and Reified
Cross-References
- Types and Variables: Type system fundamentals tested in the types section.
- Control Flow: When expressions and lambda patterns.
- Null Safety Deep Dive: Nullable type handling tested in null safety problems.
Common Mistakes
Using GlobalScope.launch: GlobalScope creates coroutines that outlive their intended scope and cannot be cancelled properly. Always use structured concurrency with viewModelScope, lifecycleScope, or custom scopes.
Confusing let, also, apply, and run: let/run return the last expression; also/apply return the receiver. Mixing them up leads to unexpected return values and confusing chains.
Forgetting that lazy properties must be val: by lazy only works with read-only val properties. Using it with var causes a compile error because lazy initialization assumes the value never changes after first access.