Android development has become a cornerstone in mobile application design and implementation. Let’s test your knowledge of Android’s fundamental concepts with these 25 multiple-choice questions!
1. Which programming language is primarily used for Android app development?
Answer:
Explanation:
While Android app development can be done using a variety of languages, Kotlin is now the recommended language for Android app development, as stated by Google.
2. What is the main file used to define the appearance of an Android screen?
Answer:
Explanation:
The activity_main.xml file (or similarly named XML files) are layout files used to define the appearance or UI of an Android screen.
3. In Android, what is an "Activity"?
Answer:
Explanation:
In Android, an "Activity" represents a single screen with a user interface (UI).
4. Which tool is primarily used to develop Android applications?
Answer:
Explanation:
Android Studio is the official integrated development environment (IDE) for Android app development.
5. What does the term "APK" stand for in the Android ecosystem?
Answer:
Explanation:
APK stands for Android Package Kit. It is the file format used for distributing and installing applications on the Android operating system.
6. What does the R in R.id.some_id stand for?
Answer:
Explanation:
In Android, R stands for Resource. It's an auto-generated class that maps to resources like layouts, strings, and IDs.
7. Which component is NOT one of the four main app components in Android?
Answer:
Explanation:
While Intents play a crucial role in Android for message passing, the four main app components are Activity, Service, BroadcastReceiver, and ContentProvider.
8. What is the AndroidManifest.xml file used for?
Answer:
Explanation:
The AndroidManifest.xml file is essential for configuration. It declares app permissions, lists the app components, and contains other essential settings.
9. What is the core component that responds to system events in Android?
Answer:
Explanation:
A "Broadcast Receiver" in Android is used to respond to system-wide broadcast announcements (events). It can react to system events or custom events.
10. Which folder in an Android project primarily contains app icons and images?
Answer:
Explanation:
The /res/drawable directory is used to store various graphical assets like images and icons that the app uses.
11. Which layout type arranges UI elements linearly?
Answer:
Explanation:
LinearLayout arranges its children in a single direction, either horizontally or vertically.
12. How can you store small data persistently in Android?
Answer:
Explanation:
SharedPreferences allows Android developers to store and retrieve small sets of primitive data types persistently.
13. Which tool is used to create virtual Android devices for testing?
Answer:
Explanation:
Android Virtual Device (AVD) Manager is used to create and manage virtual Android devices.
14. What is an APK?
Answer:
Explanation:
APK stands for Android Package Kit. It's the package file format used to distribute and install apps on Android devices.
15. Which method is called when an Android app enters the foreground?
Answer:
Explanation:
The onResume() method is called when an app becomes active and enters the foreground.
16. Which file in Android is primarily used for defining UI elements?
Answer:
Explanation:
XML is primarily used in Android to define UI layouts and other resources.
17. What is the name of the Android build system?
Answer:
Explanation:
Android uses Gradle as its primary build system.
18. What does the Intent class do in Android?
Answer:
Explanation:
Intents are used for message passing in Android, including starting activities and services, and broadcasting messages.
19. Which component in Android is used to receive and react to broadcast messages?
Answer:
Explanation:
A BroadcastReceiver is an Android component that allows the system to deliver events outside of a regular app flow, such as when the device boots or when the system locale changes.
20. How can you reference colors in Android?
Answer:
Explanation:
While you can set colors directly using RGB or ARGB in Android, it's a best practice to define them in the colors.xml file and reference them by their resource ID.
21. What is the purpose of the Context class in Android?
Answer:
Explanation:
The Context class in Android provides access to application resources, such as themed values, and allows new application components to be launched.
22. What is the primary purpose of Fragments in Android?
Answer:
Explanation:
Fragments are modular sections of an activity, which represent a portion of the user interface and can be reused across multiple activities.
23. How do you ensure that certain code runs on the UI thread in an Android app?
Answer:
Explanation:
Activity.runOnUiThread() is a method provided by the Activity class to ensure that a certain piece of code runs on the UI thread.
24. Which of the following is the Android layout that allows stacking views on top of one another?
Answer:
Explanation:
FrameLayout is a simple layout used to stack child views on top of one another.
25. Which Android API provides a built-in SQLite database?
Answer:
Explanation:
The Room Persistence Library provides an abstraction layer over SQLite, making it easier for developers to interact with databases in Android.
26. Which tool in Android Studio helps developers identify performance bottlenecks?
Answer:
Explanation:
The Profiler in Android Studio provides real-time & visual data about memory, CPU, and network activity, helping to identify performance issues.
27. What component is responsible for displaying a short message on the screen?
Answer:
Explanation:
Toast in Android is used to display short-lived messages on the screen. It disappears after a set duration and does not require user interaction.
28. Which file typically holds string values in an Android project?
Answer:
Explanation:
The strings.xml file, located in the res/values directory, is typically used to define string values, making it easier to manage and localize textual content in the app.