0% found this document useful (0 votes)
34 views23 pages

MCQ

android examination free pdf
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
34 views23 pages

MCQ

android examination free pdf
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 23

1. What file contains essential information about the Android app?

A) build.gradle

B) AndroidManifest.xml

C) MainActivity.java

D) res/layout/activity_main.xml
Answer: B) AndroidManifest.xml

2. Which directory contains the app's resources?

A) src

B) res

C) assets

D) libs
Answer: B) res

3. Where do you define app permissions?

A) build.gradle

B) AndroidManifest.xml

C) strings.xml

D) styles.xml
Answer: B) AndroidManifest.xml

4. What is the purpose of the src directory?

A) To hold UI files

B) To contain source code

C) To store multimedia files

D) To define app permissions


Answer: B) To contain source code

5. Which of the following is NOT a valid resource type in the res folder?

A) drawable

B) layout
C) color

D) script
Answer: D) script

6. What is an Activity in Android?

A) A background task

B) A UI component for user interaction

C) A service for data processing

D) A broadcast receiver
Answer: B) A UI component for user interaction

7. Which method is called when an Activity is created?

A) onPause()

B) onStart()

C) onCreate()

D) onResume()
Answer: C) onCreate()

8. What is the purpose of Intent in Android?

A) To store data

B) To start activities or services

C) To display UI elements

D) To define app layout


Answer: B) To start activities or services

9. Which of the following is used to start a service?

A) startActivity()

B) startService()

C) startTask()

D) startIntent()
Answer: B) startService()

10. What type of Intent is used to start an Activity within the same application?
A) Implicit Intent

B) Explicit Intent

C) Broadcast Intent

D) Service Intent
Answer: B) Explicit Intent

11. What permission is required to access the internet?

A) android.permission.INTERNET

B) android.permission.ACCESS_NETWORK_STATE

C) android.permission.READ_EXTERNAL_STORAGE

D) android.permission.WRITE_EXTERNAL_STORAGE
Answer: A) android.permission.INTERNET

12. How can you define string resources?

A) In AndroidManifest.xml

B) In strings.xml

C) In build.gradle

D) In activity_main.xml
Answer: B) In strings.xml

13. What is the default folder for storing images?

A) drawable

B) mipmap

C) res

D) layout
Answer: A) drawable

14. Which layout arranges children in a single row or column?

A) ConstraintLayout

B) RelativeLayout

C) LinearLayout
D) FrameLayout
Answer: C) LinearLayout

15. What does the res/values directory typically contain?

A) UI layouts

B) String resources, colors, and styles

C) Image files

D) Native libraries
Answer: B) String resources, colors, and styles

16. Which element is used to display text?

A) Button

B) TextView

C) EditText

D) ImageView
Answer: B) TextView

17. Which layout is recommended for complex UIs?

A) LinearLayout

B) FrameLayout

C) ConstraintLayout

D) RelativeLayout
Answer: C) ConstraintLayout

18. What is the function of EditText?

A) To display static text

B) To allow user input

C) To create buttons

D) To show images
Answer: B) To allow user input

19. Which method is used to set the text of a TextView?

A) setTextView()
B) setText()

C) updateText()

D) changeText()
Answer: B) setText()

20. What layout allows for absolute positioning of views?

A) RelativeLayout

B) FrameLayout

C) AbsoluteLayout

D) ConstraintLayout
Answer: C) AbsoluteLayout (Note: AbsoluteLayout is deprecated)

21. What is a Content Provider used for?

A) To manage user permissions

B) To share data between applications

C) To create UI layouts

D) To define activity lifecycle


Answer: B) To share data between applications

22. Which class is used for shared preferences?

A) SharedPreferences

B) PreferencesManager

C) PrefUtils

D) DataStore
Answer: A) SharedPreferences

23. What method is used to save data in SharedPreferences?

A) save()

B) put()

C) edit()

D) commit()
Answer: C) edit() (with a call to commit() or apply())
24. Which of the following can NOT be used to persist data?

A) SQLite Database

B) Shared Preferences

C) Internal Storage

D) UI Thread
Answer: D) UI Thread

25. What does the getContentResolver() method return?

A) Access to system services

B) An instance of a Content Resolver

C) A reference to Shared Preferences

D) A handle to the database


Answer: B) An instance of a Content Resolver

26. Which library is commonly used for JSON parsing in Android?

A) Jackson

B) Gson

C) Json.org

D) All of the above


Answer: D) All of the above

27. How do you make an HTTP request in Android?

A) Using HttpURLConnection

B) Using AsyncTask

C) Using Retrofit

D) All of the above


Answer: D) All of the above

28. What is the method used to convert a JSON string to a Java object using Gson?

A) fromJson()

B) toJson()
C) parse()

D) readJson()
Answer: A) fromJson()

29. Which HTTP method is used to retrieve data?

A) POST

B) GET

C) PUT

D) DELETE
Answer: B) GET

30. What is the correct way to handle asynchronous tasks in Android?

A) Using Threads

B) Using AsyncTask

C) Using Handlers

D) All of the above


Answer: D) All of the above

31. Which class is used to display images in Android?

A) ImageDisplay

B) ImageView

C) ImageRenderer

D) PictureView
Answer: B) ImageView

32. What method would you use to start an animation?

A) startAnimation()

B) runAnimation()

C) animate()

D) beginAnimation()
Answer: A) startAnimation()

33. Which of the following is used for 2D graphics in Android?


A) OpenGL ES

B) Canvas

C) SurfaceView

D) All of the above


Answer: D) All of the above

34. What class is typically used for drawing on a Canvas?

A) Graphics

B) Paint

C) Bitmap

D) View
Answer: B) Paint

35. Which method is called to draw custom graphics in a View?

A) onDraw()

B) draw()

C) render()

D) paint()
Answer: A) onDraw()

36. What is an Animator in Android?

A) A class for managing UI elements

B) A tool for creating animations

C) A layout manager

D) A framework for network operations


Answer: B) A tool for creating animations

37. Which class is used to animate properties of a View?

A) AnimatorSet

B) ObjectAnimator

C) ViewPropertyAnimator
D) All of the above
Answer: D) All of the above

38. What is a Transition in Android?

A) A change in the state of an Activity

B) A type of animation between UI states

C) A method for data persistence

D) A way to manage background tasks


Answer: B) A type of animation between UI states

39. Which XML element defines a property animation?

A) <objectAnimator>

B) <animator>

C) <set>

D) <transition>
Answer: A) <objectAnimator>

40. Which method starts a layout transition?

A) startTransition()

B) beginDelayedTransition()

C) triggerTransition()

D) startLayoutAnimation()
Answer: B) beginDelayedTransition()

Advanced UI and Layouts

41. Which layout allows you to create responsive UIs?

A) LinearLayout

B) RelativeLayout

C) ConstraintLayout

D) TableLayout
Answer: C) ConstraintLayout

42. What is the purpose of a RecyclerView?


A) To create complex animations

B) To display large sets of data efficiently

C) To manage fragments

D) To handle network requests


Answer: B) To display large sets of data efficiently

43. Which adapter is used with RecyclerView?

A) ArrayAdapter

B) BaseAdapter

C) RecyclerView.Adapter

D) SimpleAdapter
Answer: C) RecyclerView.Adapter

44. What layout is used to align views relative to each other?

A) LinearLayout

B) RelativeLayout

C) FrameLayout

D) ConstraintLayout
Answer: B) RelativeLayout

45. What is the purpose of ViewGroup?

A) To manage background tasks

B) To define an interface

C) To hold child views and manage their layout

D) To handle network connections


Answer: C) To hold child views and manage their layout

46. What is a Fragment?

A) A standalone app component

B) A reusable UI component

C) A background service
D) A type of Intent
Answer: B) A reusable UI component

47. Which method is called to attach a fragment to an Activity?

A) onAttach()

B) attachFragment()

C) onCreate()

D) addFragment()
Answer: A) onAttach()

48. What is the primary purpose of the FragmentManager?

A) To manage UI threads

B) To handle database operations

C) To manage fragments in an Activity

D) To manage network calls


Answer: C) To manage fragments in an Activity

49. How do you replace one fragment with another?

A) fragment.replace()

B) fragmentTransaction.replace()

C) replaceFragment()

D) switchFragment()
Answer: B) fragmentTransaction.replace()

50. What is the benefit of using Navigation Components?

A) To manage background services

B) To simplify navigation in the app

C) To handle JSON parsing

D) To create animations
Answer: B) To simplify navigation in the app

Networking

51. Which library is commonly used for networking in Android?


A) Retrofit

B) Volley

C) OkHttp

D) All of the above


Answer: D) All of the above

52. What is the main purpose of Retrofit?

A) To handle database operations

B) To manage background tasks

C) To convert API responses into Java objects

D) To create animations
Answer: C) To convert API responses into Java objects

53. What does a Callback interface do in networking?

A) Handles user inputs

B) Manages UI updates

C) Notifies when a network request is completed

D) Parses JSON data


Answer: C) Notifies when a network request is completed

54. Which HTTP status code indicates success?

A) 404

B) 500

C) 200

D) 403
Answer: C) 200

55. What is the role of a Service in Android?

A) To provide a user interface

B) To perform long-running operations in the background

C) To manage database interactions


D) To handle navigation
Answer: B) To perform long-running operations in the background

56. Which method is used to encrypt sensitive data in Android?

A) encryptData()

B) SecureRandom()

C) Cipher.getInstance()

D) hashData()
Answer: C) Cipher.getInstance()

57. What should you avoid storing in SharedPreferences?

A) User preferences

B) Sensitive information

C) Simple configuration settings

D) App settings
Answer: B) Sensitive information

58. Which file is used to declare application permissions?

A) build.gradle

B) strings.xml

C) AndroidManifest.xml

D) styles.xml
Answer: C) AndroidManifest.xml

59. What does ProGuard do in Android?

A) Optimizes code

B) Obfuscates code

C) Reduces APK size

D) All of the above


Answer: D) All of the above

60. Which storage method is best for storing large files?

A) Shared Preferences
B) Internal Storage

C) External Storage

D) SQLite Database
Answer: C) External Storage

Advanced Topics

61. What is Android Jetpack?

A) A new programming language

B) A suite of libraries and tools for Android development

C) A cloud storage solution

D) A type of Android device


Answer: B) A suite of libraries and tools for Android development

62. Which library is used for dependency injection in Android?

A) Dagger

B) Retrofit

C) Gson

D) OkHttp
Answer: A) Dagger

63. What is LiveData in Android?

A) A class for managing UI threads

B) A lifecycle-aware data holder

C) A method for network requests

D) A type of Fragment
Answer: B) A lifecycle-aware data holder

64. What is the purpose of ViewModel in Android?

A) To manage UI-related data in a lifecycle-conscious way

B) To handle user input

C) To manage background tasks


D) To create custom views
Answer: A) To manage UI-related data in a lifecycle-conscious way

65. What does Room provide in Android?

A) A database abstraction layer

B) A networking library

C) A UI framework

D) A library for animations


Answer: A) A database abstraction layer

Testing and Debugging

66. Which tool is commonly used for UI testing in Android?

A) Espresso

B) JUnit

C) Robolectric

D) Mockito
Answer: A) Espresso

67. What is the purpose of Unit Testing in Android?

A) To test the UI

B) To test individual components of the code

C) To manage network requests

D) To handle background tasks


Answer: B) To test individual components of the code

68. Which framework is used for mocking in Android tests?

A) Mockito

B) Espresso

C) JUnit

D) Robolectric
Answer: A) Mockito

69. What does the Android Debug Bridge (ADB) do?


A) Manages network requests

B) Provides command-line access to the device

C) Handles user inputs

D) Manages background services


Answer: B) Provides command-line access to the device

70. Which method is used to log messages in Android?

A) logMessage()

B) Log.i()

C) Log.d()

D) Both B and C
Answer: D) Both B and C

App Lifecycle

71. What is the first method called when an Activity starts?

A) onStart()

B) onCreate()

C) onResume()

D) onPause()
Answer: B) onCreate()

72. What is the purpose of onPause()?

A) To save UI state

B) To prepare the Activity for stopping

C) To start new Activities

D) To finish the Activity


Answer: B) To prepare the Activity for stopping

73. What does the onDestroy() method signify?

A) The Activity is about to be created

B) The Activity is being destroyed


C) The Activity is resuming

D) The Activity is paused


Answer: B) The Activity is being destroyed

74. When is onStop() called?

A) When the Activity is no longer visible

B) When the Activity is starting

C) When the Activity is being created

D) When the Activity is paused


Answer: A) When the Activity is no longer visible

75. Which method is used to handle configuration changes?

A) onSaveInstanceState()

B) onRestoreInstanceState()

C) onConfigurationChanged()

D) onCreate()
Answer: C) onConfigurationChanged()

76. What is the purpose of Android Studio?

A) To manage device settings

B) To develop Android applications

C) To create websites

D) To manage network connections


Answer: B) To develop Android applications

77. What is Gradle used for in Android?

A) To compile Java code

B) To manage project dependencies and build configuration

C) To design UI layouts

D) To handle networking
Answer: B) To manage project dependencies and build configuration

78. What file is used to manage dependencies in an Android project?


A) AndroidManifest.xml

B) build.gradle

C) settings.gradle

D) proguard-rules.pro
Answer: B) build.gradle

79. Which Android component is used to receive broadcast messages?

A) Service

B) Activity

C) BroadcastReceiver

D) ContentProvider
Answer: C) BroadcastReceiver

80. What is the purpose of an IntentService?

A) To perform background operations

B) To handle user interactions

C) To manage UI updates

D) To display notifications
Answer: A) To perform background operations

81. Which tool is used to analyze app performance?

A) Android Profiler

B) Logcat

C) ADB

D) None of the above


Answer: A) Android Profiler

82. What is the best practice for managing memory in Android?

A) Use static variables

B) Avoid memory leaks by using WeakReferences

C) Store all data in memory


D) Use unnecessary large images
Answer: B) Avoid memory leaks by using WeakReferences

83. What is the purpose of the StrictMode class?

A) To manage network requests

B) To enforce best practices for background tasks

C) To optimize memory usage

D) To monitor UI updates
Answer: B) To enforce best practices for background tasks

84. Which method helps in recycling views in a ListView?

A) onCreate()

B) getView()

C) onBindViewHolder()

D) onRecycleView()
Answer: B) getView()

85. What is a memory leak in Android?

A) When memory is not allocated correctly

B) When objects are still referenced after they are no longer needed

C) When an app crashes

D) None of the above


Answer: B) When objects are still referenced after they are no longer needed

86. Which method is called when the Activity is about to go into the background?

A) onPause()

B) onStop()

C) onDestroy()

D) onCreate()
Answer: A) onPause()

87. What is the main advantage of using Data Binding?

A) Reduces boilerplate code


B) Enhances app performance

C) Simplifies networking

D) Optimizes memory usage


Answer: A) Reduces boilerplate code

88. What is the purpose of the @BindView annotation?

A) To declare a layout resource

B) To bind UI components to their corresponding fields

C) To manage background threads

D) To define an activity's lifecycle


Answer: B) To bind UI components to their corresponding fields

89. Which component is best suited for handling background tasks that need to run
even if the app is not visible?

A) Activity

B) Service

C) Fragment

D) BroadcastReceiver
Answer: B) Service

90. Which of the following is NOT a feature of Kotlin for Android development?

A) Null safety

B) Extension functions

C) Java interoperability

D) No support for lambdas


Answer: D) No support for lambdas

91. Which lifecycle method is called when the Activity comes back to the
foreground?

A) onResume()

B) onStart()

C) onCreate()
D) onPause()
Answer: A) onResume()

92. What does the @Nullable annotation indicate in Android?

A) The variable can never be null

B) The variable can be null

C) The variable must be initialized

D) None of the above


Answer: B) The variable can be null

93. What is the primary use of the ViewModelProvider?

A) To create new Activities

B) To create ViewModels for the Activity or Fragment

C) To manage UI layouts

D) To handle network requests


Answer: B) To create ViewModels for the Activity or Fragment

94. What is the purpose of the @BindingAdapter annotation?

A) To bind UI components to data sources

B) To manage network operations

C) To create animations

D) To handle user inputs


Answer: A) To bind UI components to data sources

95. What is the primary benefit of using Coroutines in Android?

A) To manage UI threads

B) To simplify asynchronous programming

C) To handle database operations

D) To create custom views


Answer: B) To simplify asynchronous programming

96. Which API is recommended for background tasks in Android?

A) AsyncTask
B) Thread

C) WorkManager

D) Service
Answer: C) WorkManager

97. What is the primary role of the Manifest file in an Android application?

A) To store UI layouts

B) To declare app components and permissions

C) To manage dependencies

D) To define animations
Answer: B) To declare app components and permissions

98. Which method is used to obtain the application context?

A) getApplicationContext()

B) getContext()

C) getActivity()

D) obtainContext()
Answer: A) getApplicationContext()

99. What is the purpose of the @Component annotation in Dagger?

A) To define a module

B) To define an entry point for dependency injection

C) To manage Activity lifecycle

D) To handle networking
Answer: B) To define an entry point for dependency injection

100. Which of the following is true about RecyclerView?

A) It is faster than ListView for large data sets

B) It does not support ViewHolders

C) It cannot be customized

D) It requires less memory than ListView


Answer: A) It is faster than ListView for large data sets

You might also like