MAD Viva Questions and Answers (Android with Java)
1. What is Android?
Android is an open-source operating system based on the Linux kernel, primarily used for mobile
devices like smartphones and tablets.
2. What is an Activity in Android?
An Activity represents a single screen with a user interface, like a window or a page in an app.
3. What is the AndroidManifest.xml file?
It is a configuration file that contains essential information about the app, such as its components
and permissions.
4. What is the use of Intent in Android?
Intent is used to start a new activity or service, or to deliver a broadcast.
5. What is the difference between Implicit and Explicit Intent?
Explicit Intent specifies the component to start, while Implicit Intent does not; the system determines
the appropriate component.
6. What is a Service in Android?
A Service is a component that runs in the background to perform long-running operations without a
user interface.
7. What is the life cycle of an Activity?
The main stages are: onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy().
8. What is the use of onSaveInstanceState()?
It allows you to save data during a configuration change like screen rotation.
9. What is a Fragment?
A Fragment represents a reusable portion of the UI in an activity.
10. How do you store data in Android?
You can use SharedPreferences, SQLite database, internal storage, or external storage.
11. What is SharedPreferences?
It is a way to store small amounts of key-value pair data.
12. What is an AsyncTask in Android?
AsyncTask allows you to perform background operations and publish results on the UI thread.
13. What is RecyclerView?
RecyclerView is a flexible view used for displaying large sets of data efficiently.
14. What is the role of the Gradle build system in Android?
Gradle compiles the app and manages dependencies.
15. What is the difference between dp, sp, and px?
dp (density-independent pixels), sp (scale-independent pixels for fonts), px (pixels) are units used
for layout dimensions and font sizes.
16. What is the use of Toast in Android?
Toast is used to display brief messages to the user.
17. What is the use of Logcat?
Logcat is used to view log messages from your Android device or emulator.
18. What is a BroadcastReceiver?
It is used to respond to broadcast messages from other applications or the system.
19. What are permissions in Android?
Permissions are required to access protected features like camera, internet, or storage.
20. What is the difference between LinearLayout and RelativeLayout?
LinearLayout arranges elements in a single direction (vertical or horizontal), while RelativeLayout
positions elements relative to each other.