MCQs > IT & Programming > Android MCQs > Basic Android MCQs

Basic Android MCQ

1. If you need your app code to inspect information about the current build, which class should you use?

Answer

Correct Answer: BuildConfig

Note: This Question is unanswered, help us to find answer for this one

2. You need to provide your users with certain features of your app on-demand or as instant experiences through Google Play. Which type of module should you create?

Answer

Correct Answer: Dynamic feature module

Note: This Question is unanswered, help us to find answer for this one

3. What is the current recommended way to handle long-running background tasks?

Answer

Correct Answer: WorkManager

Note: This Question is unanswered, help us to find answer for this one

4. To shrink your code in release builds, what tool does Android Studio use?

Answer

Correct Answer: R8

Note: This Question is unanswered, help us to find answer for this one

5. Which attribute of the element is used to specify the minimum API Level required for the application to run?

Answer

Correct Answer: Android:minSdkVersion

Note: This Question is unanswered, help us to find answer for this one

6. What is the use of AndroidManifest.xml file?

Answer

Correct Answer: It describes the component of the application

Note: This Question is unanswered, help us to find answer for this one

7. You have created an AboutActivity class that displays details about your app. Which code snippet allows you to launch your activity?

Answer

Correct Answer: Intent(this, AboutActivity::class.java).also { intent -> startActivity(intent) }

Note: This Question is unanswered, help us to find answer for this one

8. What should you use to display a large, scrolling list of elements?

Answer

Correct Answer: Recycler View

Note: This Question is unanswered, help us to find answer for this one

9. Which component is not an entry point through which the system or a user can enter your app?

Answer

Correct Answer: Fragment

Note: This Question is unanswered, help us to find answer for this one

10. What is not a benefit of externalizing app resources such as image and string from a code?

Answer

Correct Answer: It allows you to have more performant applications because the code and resources are separated.

Note: This Question is unanswered, help us to find answer for this one

11. Which statement, in build.gradle file, correctly denotes that the corresponding module is an Android library module?

Answer

Correct Answer: Apply plugin: 'com.android.library'

Note: This Question is unanswered, help us to find answer for this one

12. When attempting to build your project, what might the following error indicate? Conversion to Dalvik format filed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

Answer

Correct Answer: You have exceeded the total number of methods that can be referenced within a single DEX file.

Note: This Question is unanswered, help us to find answer for this one

13. Given an APK named app-internal-debug.apk produced from the build process, which statement is likely to be true?

Answer

Correct Answer: This APK is created from the debug build type and internal product flavor.

Note: This Question is unanswered, help us to find answer for this one

14. When should you use the androidTest directory to store your test classes?

Answer

Correct Answer: When the tests need to run on real or virtual devices.

Note: This Question is unanswered, help us to find answer for this one

15. What folder should you use for your app's launcher icons?

Answer

Correct Answer: /mipmap

Note: This Question is unanswered, help us to find answer for this one

16. Why do developers often put app initialization code in the Application class?

Answer

Correct Answer: The Application class is instantiated before any other class when the process for the application is created.

Note: This Question is unanswered, help us to find answer for this one

17. You need to upgrade to the latest version of the Android Gradle plugin. Which file should you modify?

Answer

Correct Answer: Root_project_dir/build.gradle.

Note: This Question is unanswered, help us to find answer for this one

18. Which layout is best for large, complex hierarchies?

Answer

Correct Answer: ConstraintLayout

Note: This Question is unanswered, help us to find answer for this one

19. What is _not_ a good way to reuse Android code?

Answer

Correct Answer: Prefer to build activities instead of fragments.

Note: This Question is unanswered, help us to find answer for this one

20. Which source set is _not_ available to you by default when Android Studio creates a new project?

Answer

Correct Answer: Main

Note: This Question is unanswered, help us to find answer for this one

21. You have built code to make a network call and tested that it works in your development environment. However, when you publish it to the Play console, the networking call fails to work. What will not help you troubleshoot this issue?

Answer

Correct Answer: Using the profiler tools in Android Studio to detect anomalies in CPU, memory, and network usage

Note: This Question is unanswered, help us to find answer for this one

22. You want to allow users to take pictures in your app. Which is not an advantage of creating an appropriate intent, instead of requesting the camera permission directly?

Answer

Correct Answer: You have full control over the user experience. The app that handles the camera intent will respect your design choices.

Note: This Question is unanswered, help us to find answer for this one

23. When should you store files in the /assets directory?

Answer

Correct Answer: When you need access to the original file names and file hierarchy

Note: This Question is unanswered, help us to find answer for this one

24. Why might you need to include the following permission to your app?

Answer

Correct Answer: To monitor the network state of the devices so that you don't attempt to make network calls when the network is unavailable

Note: This Question is unanswered, help us to find answer for this one

25. You want to provide a different drawable for devices that are in landscape mode and whose language is set to French. which directory is named correctly?

Answer

Correct Answer: Drawable-fr-land

Note: This Question is unanswered, help us to find answer for this one

26. What tag should you use to add a reusable view component to a layout file?

Answer

Correct Answer:

Note: This Question is unanswered, help us to find answer for this one

27. Given the test class below, which code snippet would be a correct assertion?

Answer

Correct Answer: AssertNotNull(resultAdd)

Note: This Question is unanswered, help us to find answer for this one

28. You need to retrieve a list of photos from an API. Which code snippet defines an HTML GET request in Retrofit?

Answer

Correct Answer: @GET("photo") fun listPhotos() : Call

Note: This Question is unanswered, help us to find answer for this one

29. To persist a small collection of key-value data, what should you use?

Answer

Correct Answer: SharedPereferences

Note: This Question is unanswered, help us to find answer for this one

30. You need to get a list of devices that are attached to your computer with USB debugging enable. Which command would execute using the Android Debug Bridge?

Answer

Correct Answer: Adb devices

Note: This Question is unanswered, help us to find answer for this one

31. How would you retrieve the value of a user's email from SharedPreferences while ensuring that the returned value is not null?

Answer

Correct Answer: GetDefaultSharedPreferances(this).getString(EMAIL,

Note: This Question is unanswered, help us to find answer for this one

32. IF the main thread is blocked for too long, the system displays the _ dialog?

Answer

Correct Answer: Application Not Responding

Note: This Question is unanswered, help us to find answer for this one

33. Given the definition below. how would you get access a TextView with an ID of text_home contained in thr layout file of a Fragment class?

Answer

Correct Answer: Root.findViewById(R.id.text_home)

Note: This Question is unanswered, help us to find answer for this one

34. What allows you to properly restore a user's state when an activity is restarted?

Answer

Correct Answer: All of these answers

Note: This Question is unanswered, help us to find answer for this one

35. Why do you use the AndroidJUnitRunner when running UI tests? Notice: AndroidJUnitRunner lets us run JUnit3/4-style tests on Android Devices

Answer

Correct Answer: The test runner facilitates loading your test package and the app under test onto a device or emulator, runs the test, and reports the results.

Note: This Question is unanswered, help us to find answer for this one

36. You need to remove an Event based on it;s id from your API, Which code snippet defines that request in Retrofit?

Answer

Correct Answer: @DELETE("events/{id}") fun deleteEvent(@Path("id") id: Long): Call
@DELETE("events/{id}") fun deleteEvent(@Path("id") id: Long): Call

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

37. When will an activity's onActivityResult()be called?

Answer

Correct Answer: When calling finish() in the target activity

Note: This Question is unanswered, help us to find answer for this one

38. What is the benifit of using @VisibleForTesting annotation?

Answer

Correct Answer: To denote that a class, methos, or field has its visibility relaxed to make code testable

Note: This Question is unanswered, help us to find answer for this one

39. You want to include about and setting modules in your project. Which files accurately reflects their inclusion?

Answer

Correct Answer: In settings.gradle:include ':app',':about' ':settings'

Note: This Question is unanswered, help us to find answer for this one

40. You launch your app, and when you navigate to a new screen it crashes, Which action will NOT help you diagnose the issue?

Answer

Correct Answer: Add a Thread.sleep() call before you start the new activity.

Note: This Question is unanswered, help us to find answer for this one

41. Which XML attribute should be used to make an Image View accessible?

Answer

Correct Answer: Android:contentDescription

Note: This Question is unanswered, help us to find answer for this one

42. To add features, components, and permissions to your Android app, which file needs to be edited?

Answer

Correct Answer: AndroidManifest.xml

Note: This Question is unanswered, help us to find answer for this one