



















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A comprehensive assessment mirroring Meta’s Android Developer curriculum, covering Kotlin fundamentals, Android Studio workflows, UI/UX development, Jetpack libraries, Git/GitHub integration, API consumption, asynchronous programming, local data storage, app debugging, testing, and deployment. Includes scenario-based questions on building scalable, accessible, and performance-optimized mobile applications.
Typology: Exams
1 / 91
This page cannot be seen from the preview
Don't miss anything!




















































































Question 1. Which component of Android Studio provides a visual representation of an app’s UI hierarchy? A) Project pane B) Layout Editor C) Logcat D) Terminal Answer: B Explanation: The Layout Editor displays XML or Compose UI hierarchies visually, allowing drag‑and‑drop design. Question 2. In Kotlin, which keyword is used to declare an immutable (read‑only) variable? A) var B) val C) const D) let Answer: B Explanation: val creates a read‑only reference; its value cannot be reassigned after initialization. Question 3. What is the primary purpose of a Git branch? A) To store remote repositories B) To track file permissions C) To isolate development work D) To compress repository size Answer: C
Explanation: Branches let developers work on separate features without affecting the main codebase. Question 4. Which Android lifecycle method is called when an activity becomes visible to the user? A) onCreate() B) onStart() C) onResume() D) onPause() Answer: B Explanation: onStart() is invoked after onCreate() and before the activity is visible; onResume() follows when it gains focus. Question 5. In Kotlin, what does the when expression replace from Java? A) if‑else ladder B) switch statement C) ternary operator D) try‑catch block Answer: B Explanation: when provides a more powerful and expressive alternative to Java’s switch. Question 6. Which Jetpack component is designed to survive configuration changes and hold UI‑related data? A) LiveData B) ViewModel C) Room
B) They block the UI thread C) They simplify asynchronous code with structured concurrency D) They require explicit lock management Answer: C Explanation: Coroutines allow asynchronous work without blocking threads and provide structured concurrency for easier management. Question 10. Which Android manifest element declares a screen orientation restriction for an activity? A) <uses‑feature> B) android:screenOrientation attribute on <activity> forces a specific orientation. Question 11. In Git, which command stages all modified files for a commit? A) git commit - a B) git add. C) git push origin D) git merge --all Answer: B Explanation: git add . stages changes in the current directory and subdirectories.
Question 12. Which Kotlin operator is used for safe calls on nullable references? A) !! B) ?. C) ?.[] D) :: Answer: B Explanation: ?. executes the call only if the reference is non‑null, returning null otherwise. Question 13. Which architectural pattern separates UI logic from business logic using a ViewModel and LiveData? A) MVC B) MVP C) MVVM D) Clean Architecture Answer: C Explanation: MVVM uses ViewModel to hold UI data and LiveData to observe changes. Question 14. Which Android component is primarily used to perform background work that must finish even if the app is closed? A) Service B) BroadcastReceiver C) ContentProvider D) AsyncTask Answer: A
Answer: B Explanation: ACTION_VIEW requests the system to display data (e.g., a URL) using the best suited app. Question 18. Which Kotlin standard library function returns the first element matching a predicate or null if none match? A) find() B) first() C) filter() D) any() Answer: A Explanation: find { predicate } returns the first matching element or null. Question 19. In Android, which permission is required to write to external storage on devices running Android 10 (API 29) or higher? A) READ_EXTERNAL_STORAGE B) WRITE_EXTERNAL_STORAGE (deprecated) C) MANAGE_EXTERNAL_STORAGE D) ACCESS_MEDIA_LOCATION Answer: C Explanation: MANAGE_EXTERNAL_STORAGE grants broad file access on Android 11+, replacing the older write permission. Question 20. Which of the following is NOT a valid way to create a Kotlin data class? A) data class User(val name: String, val age: Int) B) data class User(var name: String, var age: Int)
C) data class User(name: String, age: Int) D) data class User(val name: String = "John") Answer: C Explanation: Data classes must have at least one property declared in the primary constructor; missing val/var makes them regular parameters. Question 21. What is the purpose of the @Composable annotation in Jetpack Compose? A) Marks a class as a ViewModel B) Indicates a function defines UI elements C) Registers a BroadcastReceiver D) Declares a navigation graph node Answer: B Explanation: @Composable designates a function that emits UI in Compose. Question 22. Which Gradle plugin is essential for using Kotlin in an Android project? A) com.android.application B) kotlin-android C) java-library D) android-test Answer: B Explanation: kotlin-android enables Kotlin compilation for Android modules. Question 23. In Android, which method is called when a user presses the back button while an activity is on the top of the stack?
Question 26. Which of the following is a correct way to start an activity for a result using the new Activity Result API? A) startActivityForResult(intent, 100) B) registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result - > … } C) onActivityResult(requestCode, resultCode, data) D) launchActivity(intent) Answer: B Explanation: The new API uses registerForActivityResult with a contract and a callback. Question 27. In Kotlin, what does the by lazy delegate do? A) Creates a thread‑safe singleton B) Defers property initialization until first access C) Enables property delegation to another object D) Provides automatic JSON serialization Answer: B Explanation: by lazy { … } initializes the property lazily, only when accessed. Question 28. Which Android UI component is specifically designed for displaying a set of tabs? A) TabLayout B) BottomNavigationView C) DrawerLayout D) ViewPager Answer: A Explanation: TabLayout renders material‑design tabs; it is often paired with ViewPager2.
Question 29. Which command lists all remote branches in a Git repository? A) git branch - a B) git remote - v C) git branch - r D) git fetch --all Answer: C Explanation: git branch - r shows remote-tracking branches. Question 30. What is the primary purpose of the Android SharedPreferences API? A) Storing large binary files B) Persisting simple key‑value pairs C) Managing SQLite databases D) Caching network responses Answer: B Explanation: SharedPreferences provides lightweight storage for primitive data types. Question 31. Which Kotlin feature allows you to execute a block of code only when a value is non‑null, providing it as a variable inside the block? A) Elvis operator (?:) B) Safe cast (as?) C) let function D) run function Answer: C
Answer: B Explanation: @Inject marks a constructor, field, or method for dependency injection. Question 35. In Kotlin, which collection function returns a new list containing only distinct elements from the original? A) distinct() B) unique() C) filterNotNull() D) map() Answer: A Explanation: distinct() removes duplicate entries while preserving order. Question 36. Which Android component is designed to handle asynchronous, deferrable background tasks that need guaranteed execution? A) AsyncTask B) Service C) WorkManager D) IntentService Answer: C Explanation: WorkManager schedules tasks that survive process death and device reboots. Question 37. Which HTTP method is typically used to retrieve data from a RESTful API? A) POST B) GET
Answer: B Explanation: GET requests retrieve resources without side effects. Question 38. In React, which hook replaces the need for class‑based lifecycle methods such as componentDidMount? A) useState B) useEffect C) useContext D) useReducer Answer: B Explanation: useEffect runs side effects after render, mimicking lifecycle callbacks. Question 39. Which of the following statements about Kotlin’s sealed classes is true? A) They can be instantiated directly. B) They restrict subclassing to the same file. C) They support multiple inheritance. D) They are final by default. Answer: B Explanation: Sealed classes allow subclasses only within the same compilation unit (file). Question 40. What is the primary benefit of using Figma for UI/UX design in Android projects? A) Automatic code generation for Kotlin
A) git start B) git init C) git clone D) git create Answer: B Explanation: git init creates a new .git directory, starting version control. Question 44. What does the Android Context class primarily provide? A) UI rendering capabilities B) Access to application‑wide resources and services C) Network connectivity monitoring D) Database schema definition Answer: B Explanation: Context is a handle to system services, resources, and application‑level operations. Question 45. Which Kotlin collection operation transforms each element in a list and returns a new list of the results? A) filter() B) map() C) reduce() D) flatMap() Answer: B Explanation: map applies a transformation function to each element, producing a new list.
Question 46. In Android, which XML attribute is used to specify a view’s content description for accessibility? A) android:hint B) android:text C) android:contentDescription D) android:label Answer: C Explanation: contentDescription provides spoken feedback for screen readers. Question 47. Which of the following is a correct way to declare a Kotlin extension function on String that returns its first character? A) fun String.firstChar(): Char = this[0] B) fun firstChar(str: String): Char = str[0] C) extension fun String.firstChar(): Char = this[0] D) String.firstChar(): Char = this[0] Answer: A Explanation: Extension functions use the syntax fun ReceiverType.functionName(). Question 48. Which Android architecture component assists with handling large data sets in a RecyclerView efficiently? A) LiveData B) Paging 3 C) DataBinding D) Navigation Answer: B
D) Sets the default theme for the activity Answer: A Explanation: android:exported="true" allows external apps to start the activity via intents. Question 52. Which Git command discards all local changes and resets the working directory to match the latest commit? A) git revert HEAD B) git reset --hard HEAD C) git checkout. D) git clean - fd Answer: B Explanation: git reset --hard HEAD moves HEAD to the latest commit and overwrites the working tree. Question 53. In Kotlin, which visibility modifier makes a member visible only within the same file? A) private B) protected C) internal D) public Answer: C Explanation: internal restricts visibility to the same module; for file‑level, use private top‑level declarations. Question 54. Which Android UI pattern provides a temporary message at the bottom of the screen that can disappear automatically? A) Toast
B) AlertDialog C) Snackbar D) Notification Answer: C Explanation: Snackbar appears at the bottom, optionally with an action, and auto‑dismisses. Question 55. Which React hook is used to manage mutable values that persist across renders without causing re‑renders? A) useState B) useEffect C) useRef D) useMemo Answer: C Explanation: useRef returns a mutable ref object whose .current property persists. Question 56. What does the @Parcelize annotation in Kotlin simplify? A) JSON parsing B) Implementing the Parcelable interface C) Dependency injection D) Coroutines scope creation Answer: B Explanation: @Parcelize auto‑generates the Parcelable implementation needed for inter‑component data transfer.