Android & Kotlin Development Questions Interview Questions and Answers Practice every question in this topic using expandable answers and interview tips. Answer aloud first, then open the explanation. Back to the complete interview hub Read question Answer aloud Review Q1. What is Kotlin and why did Google adopt it as the preferred language for Android? [Easy] Answer: Kotlin is a modern, concise, statically typed programming language developed by JetBrains. Google declared Kotlin preferred for Android because of its null safety features, extension functions, coroutines for asynchronous programming, conciseness, and 100% interoperability with Java. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q2. Explain the Activity Lifecycle in Android. [Easy] Answer: An Activity represents a single focused screen. Its lifecycle callbacks are: onCreate() -> onStart() -> onResume() [Active state] -> onPause() -> onStop() -> onDestroy(). When navigating away, onPause() and onStop() are triggered. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q3. What is a Fragment and how does it differ from an Activity? [Easy] Answer: A Fragment represents a reusable modular portion of user interface within an Activity. It has its own lifecycle tied to its host Activity. Multiple Fragments can be combined in a single Activity to build adaptive UI layouts across phones and tablets. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q4. What is MVVM Architecture in Android and why is ViewModel used? [Medium] Answer: MVVM (Model-View-ViewModel) separates UI code (View) from business logic (ViewModel) and data (Model). ViewModel stores and prepares data for the View and survives configuration changes (like screen rotations), preventing unnecessary data re-fetching or memory leaks. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q5. What are Kotlin Coroutines and StateFlow/SharedFlow? [Medium] Answer: Kotlin Coroutines provide light-weight concurrency for asynchronous tasks (such as network calls or database operations) without blocking the main UI thread. StateFlow is a state-holder observable flow that emits current and updated state updates to UI collectors. SharedFlow is used for one-time events like navigation or toast messages. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q6. What is Jetpack Compose? [Medium] Answer: Jetpack Compose is Android's modern toolkit for building native UI using declarative Kotlin code. It replaces legacy XML layouts with composable functions (@Composable) that automatically re-render (recompose) when state changes. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q7. Explain Android Room Database and Retrofit library. [Hard] Answer: Room is an official Jetpack ORM persistent library over SQLite that provides compile-time verification of SQL queries and LiveData/Flow support. Retrofit is a type-safe HTTP client library by Square for consuming RESTful APIs efficiently using OkHttp and Gson/Moshi converters. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Q8. How do you prevent Memory Leaks in Android applications? [Hard] Answer: Memory leaks occur when unused objects are held in memory by long-lived references. Prevention techniques include: 1) Using WeakReference for Context, 2) Using ViewModel instead of storing Activity references in static fields, 3) Unregistering listeners/receivers in onDestroy(), 4) Cancelling Coroutine Job scopes (viewModelScope) when views are destroyed, 5) Using LeakCanary to detect memory leaks. Interview tip: Define it clearly, give a small example, and mention one practical use or limitation. Study checklist Explain the answer without reading. Write one small example. Compare framework or database version differences in official documentation.

Android & Kotlin Development Questions Interview Questions and Answers

Practice one question at a time. Read the question, answer aloud, then compare your explanation with the answer.

← Back to the complete interview hub

Study method: define the concept, give a small example, and mention one practical use or limitation.

Q1. What is Kotlin and why did Google adopt it as the preferred language for Android?

Easy

Answer: Kotlin is a modern, concise, statically typed programming language developed by JetBrains. Google declared Kotlin preferred for Android because of its null safety features, extension functions, coroutines for asynchronous programming, conciseness, and 100% interoperability with Java.

Interview tip: Use a short example and connect the answer to real project work.

Q2. Explain the Activity Lifecycle in Android.

Easy

Answer: An Activity represents a single focused screen. Its lifecycle callbacks are: onCreate() -> onStart() -> onResume() [Active state] -> onPause() -> onStop() -> onDestroy(). When navigating away, onPause() and onStop() are triggered.

Interview tip: Use a short example and connect the answer to real project work.

Q3. What is a Fragment and how does it differ from an Activity?

Easy

Answer: A Fragment represents a reusable modular portion of user interface within an Activity. It has its own lifecycle tied to its host Activity. Multiple Fragments can be combined in a single Activity to build adaptive UI layouts across phones and tablets.

Interview tip: Use a short example and connect the answer to real project work.

Q4. What is MVVM Architecture in Android and why is ViewModel used?

Medium

Answer: MVVM (Model-View-ViewModel) separates UI code (View) from business logic (ViewModel) and data (Model). ViewModel stores and prepares data for the View and survives configuration changes (like screen rotations), preventing unnecessary data re-fetching or memory leaks.

Interview tip: Use a short example and connect the answer to real project work.

Q5. What are Kotlin Coroutines and StateFlow/SharedFlow?

Medium

Answer: Kotlin Coroutines provide light-weight concurrency for asynchronous tasks (such as network calls or database operations) without blocking the main UI thread. StateFlow is a state-holder observable flow that emits current and updated state updates to UI collectors. SharedFlow is used for one-time events like navigation or toast messages.

Interview tip: Use a short example and connect the answer to real project work.

Q6. What is Jetpack Compose?

Medium

Answer: Jetpack Compose is Android's modern toolkit for building native UI using declarative Kotlin code. It replaces legacy XML layouts with composable functions (@Composable) that automatically re-render (recompose) when state changes.

Interview tip: Use a short example and connect the answer to real project work.

Q7. Explain Android Room Database and Retrofit library.

Hard

Answer: Room is an official Jetpack ORM persistent library over SQLite that provides compile-time verification of SQL queries and LiveData/Flow support. Retrofit is a type-safe HTTP client library by Square for consuming RESTful APIs efficiently using OkHttp and Gson/Moshi converters.

Interview tip: Use a short example and connect the answer to real project work.

Q8. How do you prevent Memory Leaks in Android applications?

Hard

Answer: Memory leaks occur when unused objects are held in memory by long-lived references. Prevention techniques include: 1) Using WeakReference for Context, 2) Using ViewModel instead of storing Activity references in static fields, 3) Unregistering listeners/receivers in onDestroy(), 4) Cancelling Coroutine Job scopes (viewModelScope) when views are destroyed, 5) Using LeakCanary to detect memory leaks.

Interview tip: Use a short example and connect the answer to real project work.

Quick revision checklist

  1. Explain the answer without reading.
  2. Write one small example.
  3. Review platform or version differences in official documentation.

logoblog

No comments:

Post a Comment

Please do not enter any spam link in the comment box.