Kotlin Coroutines and Flow
Asynchronous programming with Coroutines: launch, async, suspend functions, Dispatchers, Flow, StateFlow, SharedFlow
20 面接問題·
Mid-Level
1What is a coroutine in Kotlin?
1
What is a coroutine in Kotlin?
回答
A coroutine is a lightweight thread that allows writing asynchronous code sequentially. It can be suspended without blocking the thread, allowing other tasks to execute. More efficient than traditional threads.
2What is the difference between launch and async?
2
What is the difference between launch and async?
回答
launch starts a coroutine that doesn't return a result (returns a Job). async starts a coroutine that returns a result via a Deferred (await()). Use async when you need the result.
3What is the suspend keyword used for?
3
What is the suspend keyword used for?
回答
suspend marks a function that can be suspended and resumed later without blocking the thread. These functions can only be called from other suspend functions or coroutines. They enable asynchronous operations.
4
What is a Dispatcher in coroutines?
5
When to use Dispatchers.IO?
+17 面接問題
その他のAndroid面接トピック
Android Fundamentals
Junior
24問Android UI and Resources
Junior
30問Android Lifecycle
Junior
30問Android Navigation
Junior
26問Android Data Management
Junior
29問Android Networking
Junior
29問Android Testing
Junior
28問Android Gradle
Junior
26問Kotlin Language Essentials for Android
Junior
24問Room Database
Mid-Level
25問Background Work
Mid-Level
18問Jetpack Compose
Mid-Level
28問Permissions and Device Features
Mid-Level
21問Firebase for Android
Mid-Level
23問Android MVVM Architecture
Mid-Level
18問Advanced Android Networking
Mid-Level
13問Kotlin Collections and Operators
Mid-Level
20問Android Dependency Injection
Mid-Level
15問Android MVI Architecture
Mid-Level
17問Android Clean Architecture
Senior
21問Android Compose Advanced
Senior
17問Android Performance and Monitoring
Senior
13問Android Security and Privacy
Senior
18問Android CI/CD and Release
Senior
15問Android UX and Form Factors
Senior
18問Android Testing Advanced
Senior
18問