Android
Android Interview Questions and Answers
Q1. Why data class require at least one parameter in primary construction?
Data class requires at least one parameter in primary constructor to ensure each instance of the class is unique.
Primary constructor parameters are used to initialize properties in data class.
Data classes are designed to hold data, so having at least one parameter ensures uniqueness of instances.
Without parameters, instances of data class would be identical and defeat the purpose of data class.
Q2. How view model works under the hood?
View model in Android is a class that stores and manages UI-related data in a lifecycle-conscious way.
View model survives configuration changes and is not destroyed when the UI is destroyed.
It is used to separate the UI controller logic from the UI layout.
View model is typically used with LiveData to update the UI when the data changes.
It helps in organizing and handling data for the UI efficiently.
Q3. Explain about android architecture Oops concept of Java
Android architecture consists of four layers: Linux kernel, native libraries, Android runtime, and application framework. OOP concepts in Java include inheritance, polymorphism, encapsulation, and abstraction.
Android architecture includes Linux kernel, native libraries, Android runtime, and application framework
OOP concepts in Java are inheritance, polymorphism, encapsulation, and abstraction
Example of inheritance in Java: class B extends class A
Example of polymorphism in Jav...read more
Q4. What is Activity life cycle
Activity life cycle refers to the series of states an activity goes through from creation to destruction.
Activity is created with onCreate() method
Activity is started with onStart() method
Activity is resumed with onResume() method
Activity is paused with onPause() method
Activity is stopped with onStop() method
Activity is destroyed with onDestroy() method
Q5. What is Coroutines?
Coroutines are a way to perform asynchronous programming in a sequential manner in Android development.
Coroutines allow developers to write asynchronous code that looks like synchronous code.
They are lightweight and efficient compared to traditional threading.
Coroutines can be used for tasks like network calls, database operations, and long-running tasks.
Example: Using coroutines to fetch data from a remote server and update the UI when the data is received.
Android Jobs
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month