Advanced Coroutines and Flows Kotlin Interview Questions

1. What are `Channel`s in Kotlin, and how do they facilitate communication between coroutines?

2. What is the difference between `ConflatedBroadcastChannel` and `SharedFlow`?

3. What is the role of `actor` in Kotlin, and how does it implement the actor model?

4. How does `stateIn` convert a `Flow` to a stateful representation?

5. What is `buffer` in Kotlin Flow, and how does it improve performance?

6. What is `produce` in Kotlin, and how does it help create a producer coroutine?

7. How does `combine` work in Kotlin Flow, and how is it different from `zip`?

8. What is `FlowCollector`, and how is it used in a custom Flow implementation?

9. How does `retry` work in Kotlin Flow, and when should it be used?

10. What is `tick` in Kotlin, and how can it be implemented using channels?

11. What is `select` in Kotlin coroutines, and how does it handle multiple suspending operations?

12. What is the difference between `StateFlow` and `SharedFlow`?

13. How does `ensureActive` work in coroutines, and why is it useful?

14. What is the difference between `conflate` and `buffer` in Kotlin Flow?

15. What are `flowOn` and `launchIn`, and how do they differ in Flow?

16. How does `supervisorScope` differ from `coroutineScope`, and when should you use it?

17. What is `MutableStateFlow` and how is it used for state management in Kotlin?

18. What is `broadcast` in Kotlin Channels, and how does it differ from regular channels?

19. How does `debounce` work in Kotlin Flow, and when should it be used?

20. What is `catch` in Kotlin Flow, and how does it handle exceptions?