Most Asked Android Interview Questions In 2022
5 min readNov 22, 2022
Hey Android Folks,
Hi, I am Rahnuma Sharib, I have mentored many developers, and their efforts landed them high-paying tech jobs, helped many tech companies in solving their unique problems. I am passionate about sharing knowledge through open-source, blogs, and videos.
I habitually note down questions immediately after completing my interview round. I have listed down below some interview questions for senior developers and tried to include answers to most questions as well.
Java
- What is the diff between encapsulation & abstraction give practical example
- HashMaps vs HashTables
- Explain OOP Concepts.
- When to use array & Array List
- What is the volatile keyword
- What is the transient keyword
- What is a diff between a string buffer & string builder
- Why is string immutable
- What is the diff between encapsulation & abstraction (practical example)
- class A -> extends class B, implements interface C. Both have the same method fun add() {}, Which one will be implemented in class A?
Try yourself - What is the difference between String test = new String(“X”) & String test = “X”. Explain String constant pool & String literal
Android
- When I am in my activity get a phone call what will be the lifecycle of the activity
- When I am in my activity get a phone call what will be the lifecycle of the fragment inside my activity
- Fragment, activity and application life cycle and when there life cycle method get trigger.
- Difference between fragment or activity
- What is fragment.
- What happen when we press back button on activity A.
- Which activity life cycle method trigger when orientation change.
- When onDistroy will get called before onPause or onStop.
- Type of services in Android
- What do you think about NavHost in navigation
- What are SOLID principles?
- What is broadcast receiver and content provider and how can we implement it.
- Advantage of using recycle view over list and grid view.
- Launch mode and there type and differences.
- Data binding and its type.
- How to pass data from activity to fragment or fragment to fragment.
- Difference between adding or replacing a fragment.
- What is Intent and its type
- Constraint layout and its advantage
- Difference between push value and set value ( Live Data )
- Advantage of using live data
- Dex file
- Which database you use and why
- Benefit of using Room database
- Difference between room and sqlite.
- Difference between service and thread.
- What's is concurrency.
- How to improve app performance
- What is memory leak and how to avoid it
- How to go back on previous fragment when click on back button
- How to communicate between service and activity
- What is concurrency
- On which thread service run and how can we change the thread.
- Job intent service and its purpose
- How to improve application performance.
- What is memory leak and how to solve it.
- How service will communicate with activity.
- What is job scheduler and its work.
- Parameter constructer and non parameter constructer are good and why in fragment.
Kotlin
- What are the benefits of Kotlin over Java
- Explain the use of lateinit & lazy keywords
- How to check lateinit class is initialize or not.
- What is null safety in Kotlin?
- What is the diff between Var & Val and const and val
- What is Elvis operator?
- What is Flow API in Kotlin
- Explain coroutines in kotlin
- What are scoped functions and there use in kotlin
- What is singleton class and how can you declare it?
- what is the diff between companion obj & object
- Used extension functions? example
- Data class and how its different from other classes.
- Sealed class.
- What is suspend function.
- what is the diff between static & singleton Explain @jvmstatic @jvmoverloads @jvmfiled
- Difference between volatile and syncronized.
- Live data, Mutable live data and Mediator live data
- Advantage of live data
- What is flow , state flow and shared flow
- Extension, inline, inflix and high order function and there benefit in term of memory.
- Difference between public ( visiblity modifier ) and open keyword
- Difference between volatile and synchronized.
- Arraymap and hashmap.
- How hashmap work in background.
- What is referential equality and structal equality.
- Will reference of two data class with same set of data will it be equal or not?
Kotlin Coroutines.
- What is coroutines.
- What is coroutines dispatchers there type and work.
- What is coroutines scope and its type.
- What is coroutines context.
- What is coroutines builder, its type and there work.
- Difference between launch and async
ViewModel.
- What is ViewModel and its advantage.
- How to instantiate viewmodel.
- What is the difference between ViewModel and AndroidViewModel.
- How ViewModel work internally.
- How ViewModel retain data during configuration change.
- During configuration change activity distroy and re-create then how view-model instance remain same.
- What is view-model factory & how to pass data in view model constructor
- Difference between shared view model and view model.
Dependency Injection.
- What is Dependency Injection and its benefit.
- Where should we write code of DI.
- How hilt provide required object should we write it.
Mvvm
- What is MVVM, and how does it work and its advantage.
- what is the diff between MVP/MVC & MVVM
Networking libraries ( Retrofit & Volley )
- Which one you prefer to use and why?
- advantage of using retrofit.
VCS ( Git)
- what is Marge and rebase in git.
- how you create branch and work on them .
Jetpack Compose
- What are the benefits of using Jetpack compose?
- What is a Composable function?
- What is a declarative approach?
- What jetpack compose libraries have you used?
- Explain compose UI basic components
Testing
- In Unit testing, what is @Before & @Beforeclass annotation used for
- Why should we use a Mockito lib?
- Explain Unit & Instrumentation tests
Data Structure
- What is Queue, Stack and Array.
- The time complexity of Hash Table — O(1)
- Best for getting the last item — Stack
- Time Complexity of Binary Search — O(log N)
- Which is best Sorting Algo — Quick Sort
- Best performance for finding minimum value — Array
That’s a wrap for now! Many more to come
I hope you find this blog helpful.