AAD Kotlin & Programming Fundamentals Flashcards
6 cards from real AAD practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 AAD Kotlin & Programming Fundamentals flashcards as text
What is a companion object in Kotlin?
Answer: A singleton object declared inside a class that allows static-like member access
A companion object is a singleton defined inside a class whose members can be accessed using the class name, similar to static members in Java.
What is Kotlin Flow used for in Android development?
Answer: Emitting a stream of values asynchronously in a coroutine-friendly way
Kotlin Flow is a cold, asynchronous data stream built on coroutines that emits multiple sequential values and is commonly used for reactive data updates in Android.
What is the difference between `==` and `===` in Kotlin?
Answer: `==` checks structural equality (calls equals()); `===` checks referential identity (same object in memory)
In Kotlin, == checks structural equality by calling equals(), while === checks referential equality to determine if two references point to the exact same object.
What is a higher-order function in Kotlin?
Answer: A function that takes another function as a parameter or returns a function
A higher-order function accepts one or more functions as parameters or returns a function, enabling functional programming patterns in Kotlin.
What does `by lazy` do when used with a property in Kotlin?
Answer: Initializes the property only on first access and caches the result for subsequent accesses
by lazy creates a property that is initialized only on its first access using the provided lambda, and the result is cached and reused for all subsequent accesses.
What is a destructuring declaration in Kotlin?
Answer: A syntax to break apart a list into individual variables in a single statement
A destructuring declaration in Kotlin unpacks an object into multiple variables simultaneously, using the component1(), component2()... functions generated for data classes.