Questions
•Builder Pattern in Kotlin?•Collections API in Kotlin?•Covariance in Kotlin?•Delay vs Thread.sleep?•Difference Between const val and val?•Difference between Coroutine and Java Thread?•Difference between Flow/SharedFlow/StateFlow and elaborate it.•Dispatchers.Default vs Dispatchers.IO?•Exception Handling in Coroutine?•Higher Order Functions in Kotlin?•How does Coroutine switch context?•How to choose between apply and with?•How to manage series and parallel execution?•Is singleton thread-safe? vs Object?•Map vs FlatMap in Kotlin?•On which thread does Dispatchers.Default execute the task or use which thread?•Singleton Pattern in Kotlin with object keyword?•StateFlow vs SharedFlow?•Suspending vs Blocking in Kotlin Coroutines?•What are Dispatchers and name all of them?•What are the different Coroutine Scopes?•What happens if we call .cancel() from a coroutine scope?•What is an Init block in Kotlin?•What is Data Class in Kotlin?•What is inline function in Kotlin?•What is SupervisorScope?•What is Unidirectional Flow?•When to use Kotlin sealed classes?•Why Coroutines are lightweight?•What is Coroutine Context?•How to choose between apply and with??•Open keyword in Kotlin?•Is it possible to force the Garbage Collection in Android??•let scope function and its use cases?•What is the difference between open and public in Kotlin??•Launch vs Async in Kotlin Coroutines?•Why do we need to call setContentView() in onCreate() of Activity class?•What is Coroutine Scope??•What is a ViewModel and how is it useful??•Write a function(Higher-Order Function) that returns a function.?•What are Labels in Kotlin?•Android Push Notification Flow using FCM?•How does the Kotlin Multiplatform work?•What is a JvmStatic Annotation in Kotlin?•JvmOverloads Annotation in Kotlin?•What is the equivalent of Java static methods in Kotlin??•What is an inline function in Kotlin?•Difference between List and Array types in Kotlin?•What is Coroutine Context??
•Build a small application where you have to fetch data from a given API and show a list on the screen. API - https://dragonball-api.com/api/characters.•Build an app to perform CRUD operations.•Build an app using a given API and perform a Search Operation. How to avoid multiple API calls if the user keeps typing the text? API - https://developer.themoviedb.org/reference/intro/getting-started.•Build your own LRU cache.•Build an offline-first approach system.•Design and Build a Builder Pattern using Kotlin.•Build an app that saves Data to a file and can read a file.•Build a small stopwatch with functionality where I can show different laps to the user.•How you can design and build a notification system.•Design an app that manages user login sessions locally on the device.•Build your own Stack and Queue using core Kotlin and no helper functions.
•How does Garbage collection work?•What is a dangling pointer?•Elaborate Memory Leak?•Explain fragment lifecycle when it comes to ViewPager and sliding between different fragments.•Difference between FragmentStateAdapter and FragmentStatePagerAdapter.•Difference between Serializable and Parcelable? What are the disadvantages of Serializable?•How you could implement observable SharedPrefs or observable Databases i.e. Observe a certain key/table/query?•How does layout inflation work from xml tags to view references in memory?•What is a Thread, Handler, Looper, and Message Queue?•How does ViewModel instance provide to Activity and Fragment? How does ViewModelProviderStore decide when to retain the instance?•How do you inspect and solve the Jank issue?•How does OutOfMemory happen?•How do you find memory leaks in Android applications?•What is Doze? What about App Standby?•What does setContentView do?•Process of creating a custom view?•Deeplink understanding and architecture?•Notifications?•Difference between Fragment Lifecycle Observer and View Lifecycle Observer?•When should you use a Fragment rather than an Activity?•Explain the Android push notification system?•How LiveData is different from ObservableField?•What is the difference between setValue and postValue in LiveData?•What is process death?•What is ViewModelScope and how does it work internally?
•How to keep a video maintain a playing state when we rotate the screen?•How many callbacks are in Fragments?•What could be the reasons why onPause didn't get triggered?•What kind of events trigger onPause() to run?•In what scenario does the 'onDestroy' get called directly after 'onCreate'?•Which callback gets called on Activity when an AlertDialog is shown?•What's the lifecycle in PIP (Picture-in-Picture)?•What happens if you rotate the device?•Inside a viewpager (Fragment state pager adapter) what will be the lifecycle of the fragments when you swap from one tab to another?•Why onActivityCreated is now deprecated in Fragment?•Which callback should I use if I want to know when my activity came to the foreground?•When is onActivityResult called?•What does setRetainInstance do and how can you avoid it?•What callbacks trigger when a Dialog opens up? In both cases, the dialog is attached from the same activity/fragment and another activity/fragment.•What do launchWhenCreated, launchWhenStarted, and launchWhenResumed functions do?•Fragment Callbacks when moving from one fragment to another and coming back to prev one?•Does onCreateView get called after coming to a fragment from top fragment?•When does ViewModel not survive?•How to keep a video maintain a playing state when we rotate the screen?•How many callbacks are in Fragments?•What could be the reasons why `onPause` didn't get triggered?•What kind of events trigger `onPause()` to run?•In what scenario does the "onDestory" get called directly after "onCreate"?•Which callback gets called on Activity when an AlertDialog is shown?•What's the lifecycle in PIP (Picture-in-Picture)?•What happens if you rotate the device?•Inside a viewpager (Fragment state pager adapter) what will be the lifecycle of the fragments when you swap from one tab to another?•Why onActivityCreated is now depreciated in Fragment?•Which callback should I use if I want to know when my activity came to the foreground?•When is onActivityResult called?•What does setRetainInstance do and how you can avoid it?•What callbacks trigger when a Dialog opens up? In both cases, the dialog is attached from the same activity/fragment and another activity/fragment.•What do `launchWhenCreated`, `launchWhenStarted`, and `launchWhenResumed` functions do?•Fragment Callbacks when moving from one fragment to another and coming back to prev one?•Does onCreateView get called after coming to a fragment from top fragment?•When does ViewModel not survive•What are the different Coroutine Scopes?•How to manage series and parallel execution?•Difference between Flow/SharedFlow/StateFlow and elaborate it.•What happens if we call `.cancel()` from a coroutine scope?•What is an Init block in Kotlin?•How to choose between apply and with?•What is inline function in Kotlin?•Difference between Coroutine and Java Thread•Why Coroutines are light weight?•How does Coroutine switch context?•When to use Kotlin sealed classes?•Suspending vs Blocking in Kotlin Coroutines•What are Dispatchers and Name all of them•On which thread Dispatchers .Default execute the task or use which thread?•Dispatchers .Default vs Dispatcher .IO•What is SupervisorScope?•Exception Handling in Coroutine•Map vs FlatMap in kotlin•Singleton Pattern in Kotlin with object keyword•Collections API in Kotlin•What is Unidirectional Flow•StateFlow vs SharedFlow•Builder Pattern in Kotlin•Higher Order Functions in Kotlin•Covariance in Kotlin•Delay vs Thread.sleep?
•What is the role of OkHttp and Retrofit?•What design pattern does Retrofit use?•How to optimize access token expiration handling?•How to handle retry for failed API calls with custom interceptors?•What is the role of OkHttp and Retrofit?•What design pattern does Retrofit use?•How would optimize the handling of access token expiration? How would you handle a retry network call when the API fails? (Custom Interceptor response)
•Provides vs Binds in Dependency Injection?•Subcomponent vs Component dependency in Dagger?•What is a Subcomponent and its use in Dagger?•Constructor Injection vs Method Injection?•What is the Scope in Dependency Injection?•What is a Circular Dependency in Dagger? How to resolve it?•What is interesting about Hilt?•What are your thoughts on Koin?•Provides vs binds•Subcomponent vs. component dependency, what is the difference under the hood•What is a subcomponent and what is its use? How do you use qualifiers or how would you provide different instances of a class with the same data type? Constructor Injection V/s Method Injection? What is the scope? Singleton Annotation?•What is Circular dependency in dagger? and how to resolve it•What's interesting about Hilt?•Did you use Koin? What are your thoughts on it?
•How to launch a coroutine from a Composable function?•How to launch a coroutine from a non-Composable function, but tied to composition?•What is recomposition in Jetpack Compose?•What is remember in Jetpack Compose?•Why and when to use remember {}?•Difference between LazyColumn and RecyclerView?•What is AndroidView in Compose?•What is the lifecycle of Composables?•How to avoid recomposition if state is unchanged?•What are stable types that can skip recomposition?•What is State in Jetpack Compose?•What is MutableState and how does recomposition happen?•How to retain State across recomposition and configuration changes?•Difference between Stateless and Stateful Composables?•Difference between remember and LaunchedEffect?•What is CompositionLocal?•How to create Custom Views in Compose?•What are the benefits of Jetpack Compose?•How does Jetpack Compose integrate with existing Android frameworks?•What are the best practices for performance optimization in Jetpack Compose?•How is navigation handled in Jetpack Compose?•How to use Canvas in Jetpack Compose for custom drawing?•What are Modifier chains, and how to optimize them?•What is LazyVerticalGrid, and when to use it?•How to create dynamic themes using Material3 in Jetpack Compose?•What is SideEffect, and when to use it?•What is the purpose of DisposableEffect in Compose?•Difference between LaunchedEffect and SideEffect?•How to handle animation in Jetpack Compose?•What is AnimationSpec, and how to use it?•What are rememberUpdatedState and derivedStateOf in Compose?•What is a key in remember, and why is it important?•How to create a Snackbar in Jetpack Compose?•What is Scaffold in Jetpack Compose?•How to handle WindowInsets in Jetpack Compose?•What is BackHandler in Jetpack Compose?•How to use a ViewModel in Jetpack Compose?•How to implement LazyRow or LazyColumn with sticky headers?•What is Paging in Jetpack Compose?•How to use Accompanist libraries for Compose?•How to use Compose with Jetpack Navigation?•What is Layout in Compose, and how does it work?•What are the performance considerations in Jetpack Compose?•How to manage State Hoisting in Jetpack Compose?•What is Wear Compose, and how to use it for Wear OS apps?•How to test Composables in Jetpack Compose?•What are custom Modifiers, and how to create them?•How to launch a coroutine from a composable function? - [LaunchedEffect](https://www.droidcon.com/2021/10/28/jetpack-compose-side-effects-ii-remembercoroutinescope/)•How to launch a coroutine from a non-composable function, but tied to composition? - [rememberCoroutineScope()](https://www.droidcon.com/2021/10/28/jetpack-compose-side-effects-ii-remembercoroutinescope/)•What is recomposition? [Recomposition](https://developer.android.com/jetpack/compose/mental-model#recomposition)•**What is `remember` in compose?**•A composable function to remember the value produced by a calculation only at the time of composition. It will not calculate again in recomposition.•Recomposition will always return the value produced by composition.•Whole Compose is based on the concept of `Positional Memoization`•Why and when to use `remember {}`?•Difference between `LazyColumn` and `RecyclerView`?•What is AndroidView in compose?•What is the lifecycle of composeables?•How to avoid recomposition of any composable, if the state is not changed?•What are stable types that can skip recomposition?•What is State?•What is MutableState and how does recomposition happen?•How to retain State across recomposition and configuration changes?•Difference between Stateless and Stateful composeables?•What are your thoughts on flat hierarchy, constraint Layout in compose vs. the older view hierarchy in xml•Difference b/w remember and LaunchedEffect•Does re-composition of `ComposeItem1` bring any effect on `ComposeItem2`? If yes, then how?•`ComposeParent() { ComposeItem1 {} ComposeItem2() {...} } `•What is `CompositionLocal`?•Custom views in compose•Canvas in Compose•What are the benefits of Jetpack Compose?•How does Jetpack Compose integrate with existing Android frameworks and libraries?•What are the best practices for performance optimization in Jetpack Compose?•How is navigation handled in Jetpack Compose?•What is Strong Skipping Mode?
•What is Robolectric, and when to use it?•What are UI tests, and how to implement them in Android?•How to write Espresso tests for RecyclerView?•Difference between @Test and @ParameterizedTest?•What are Instrumentation Tests in Android?•How to mock dependencies in Android tests using Mockito?•How to test ViewModel logic with LiveData?•How to use Hilt for testing in Android?•How to perform API mocking in Android tests?•What is the role of MockWebServer in testing?•How to write Coroutine tests in Android?•What is the importance of TestCoroutineDispatcher?•What are test doubles, and when to use them?•How to verify navigation actions in Jetpack Compose tests?•What is snapshot testing in Jetpack Compose?
•How to optimize Android applications for low memory?•What are tools for performance profiling in Android?•How to reduce APK size in Android?•What are ProGuard and R8, and how to use them?•How to use Android Lint for performance improvements?•What are the best practices for battery optimization in Android?•How to minimize Jank in Compose UI rendering?•What is the role of the Android Profiler?•How to use StrictMode to identify potential issues?•How to optimize database queries in Room?•How to leverage WorkManager for efficient background tasks?
•What is Room, and how does it simplify database handling?•Difference between Room and SQLite?•How to manage migrations in Room?•What is LiveData, and how to use it with Room?•What are the benefits of using Paging with Room?•How to optimize complex queries in Room?•What are relationships in Room, and how to model them?•What is a Flow in Room, and how to observe changes?•How to handle multiple databases in an Android app?•How to test Room database with Hilt?
•What is Kotlin Multiplatform, and how is it used in Android?•What is Jetpack Compose Multiplatform, and what are its use cases?•How to implement adaptive layouts for foldable devices?•What is MotionLayout, and how to use it effectively?•What is the role of JNI in Android development?•How to create a custom Gradle plugin for Android?•What are Flavors in Android, and how to set them up?•How to implement custom animations with the Animation API?•How to optimize apps for Android TV?•What are Android Auto apps, and how to create one?•How to implement app widgets with Glance API?
•How does Garbage collection works?•What is a dangling pointer?•Elaborate Memory Leak?•Explain fragment Lifecycle when it comes to ViewPager and sliding between different fragments.•Difference between FragmentStateAdapter and FragmentStatePagerAdapter.•Difference between Serializable and Parcelable? What are the disadvantages of Serializable?•How you could implement observable SharedPrefs or observable Databases i.e. Observe a certain key/table/query?•How does layout inflation work from xml tags to view references in memory?•What is a Thread, Handler, Looper, and Message Queue?•What are the different methods of concurrency on Android? Can you explain the difference between ExecutorService vs CachedThreadPool vs FixedThreadPool vs AsyncTasks vs HandlerThreads?•How does `ViewModel` instance provide to Activity and Fragment? How does `ViewModelProviderStore` decide when to retain the instance?•How do you inspect and solve the Jank issue? [here](https://developer.android.com/studio/profile/jank-detection)•How does the OutOfMemory happen?•How do you find memory leaks in Android applications?•What is Doze? What about App Standby?•What does `setContentView` do?•Process of creating a custom view•Deeplink understanding and architecture•Notifications•Difference between Fragment Lifecycle Observer and View Lifecycle Observer.•When should you use a Fragment rather than an Activity?•Explain the Android push notification system.•How LiveData is different from ObservableField?•What is the difference between setValue and postValue in LiveData?•What is process death?•What is ViewModelScope and How does it work internally?
•What is SOLID principle?•What are different design patterns you know about?•What is a creational pattern?•What is a structural pattern?•What is a behavioral pattern?•Create Singleton Pattern without Kotlin default implementation•Create Observer Pattern•Create Adapter Pattern•How to make a Singleton Pattern Thread Safe?•What is Dependency Inversion•Write a real-life example of Dependency Injection without using any library•Explain how Android Architecture components (ViewModel, LiveData, etc.) utilize design patterns behind the scenes
•Design Image Loading Library•Design Image Downloading Library•Design LRU Cache•Design a real-time Twitter feed timeline. How will you structure the backend? Will you use WebSocket or REST for this use case? Justify.•Design Networking Library•Design Checkout Screen•Design Error handling Structure•REST <-> Web Sockets•Implement caching mechanism•Build an offline-first app•Design Analytics Library
KotlinIntermediate4 min
How does Coroutine switch context?
Answer
Coroutines switch context using Dispatchers and the Continuation passing style (CPS).
- Dispatchers: Determine which thread (or pool) the coroutine runs on (e.g., `Dispatchers.IO`, `Dispatchers.Main`).
- withContext: When you call `withContext(Dispatchers.IO)`, the coroutine suspends on the current thread.
- Under the hood:
- The state machine saves the current progress.
- The task is submitted to the target Dispatcher's thread pool.
- When the task finishes, it signals the original dispatcher to resume the coroutine.
This is much cheaper than an OS thread context switch because it's handled by the language runtime and doesn't necessarily involve the OS kernel scheduler.
Accelerate Your Growth
Don't just learn concepts in isolation. Build production-ready Android apps with expert guidance.
Live Interactive Sessions
Code Reviews & Feedback
Real-world Projects
Career Guidance