Kotlin (Coding) Quiz
Kotlin language fundamentals — null safety, coroutines, and the modern JVM/Android development idioms.
This category currently has 60 questions in the SERVBG quiz bank. Below are a few sample questions — the full interactive quiz shuffles through the whole set with instant scoring.
Sample questions
In Kotlin, what is the difference between val and var?
- val is local; var is global
- val is for primitives only; var is for objects only
- val declares a read-only reference; var declares a mutable reference
- val is a compile-time constant; var is a runtime variable
- val is nullable; var is non-nullable
How do you declare a nullable String in Kotlin?
- nullable String name = null
- val name: String! = null
- val name?: String = null
- val name: String = null
- val name: String? = null
What does the Elvis operator ?: do?
- Performs safe call and returns Unit
- Forces a non-null assertion at runtime
- Concatenates two strings ignoring nulls
- Returns the left expression if non-null, otherwise the right one
- Compares two objects for structural equality
What does the safe-call operator ?. do on a nullable receiver?
- Calls the member and ignores the return value
- Calls the member only if the receiver is non-null, else returns null
- Throws NullPointerException when the receiver is null
- Forces the compiler to treat the receiver as non-null
- Always returns a default value of zero
What does the !! operator do?
- Asserts the value is non-null or throws NullPointerException
- Marks a property as lateinit
- Forces the value to become null
- Performs a bitwise NOT
- Negates a Boolean twice
Related categories
Python (Coding)
Python syntax, standard-library usage, and the language idioms that come up in day-to-day scripting and application work.
JavaScript (Coding)
Core JavaScript language behavior, async patterns, and the quirks that trip up both beginners and experienced developers.
Linux
Linux command-line usage, file permissions, process management, and the everyday admin tasks every sysadmin and developer needs.
Security
General information security concepts — threats, defenses, and the fundamentals every IT professional should know.
Hardware
Computer hardware components, how they interact, and the troubleshooting knowledge behind keeping systems running.