android banner

Android Multiple Choice Questions (MCQs) and Answers

Master Android with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Android concepts. Begin your placement preparation journey now!

Q31

Q31 Android Studio throws a 'Gradle sync failed' error. What is the most probable cause?

A

Gradle is not installed

B

The project files are missing

C

The Gradle version is incompatible or network issues

D

The AndroidManifest is corrupted

Q32

Q32 What is an Activity in Android?

A

A component that allows background services

B

A component that represents a single screen with a user interface

C

A component to handle database queries

D

A background process handler

Q33

Q33 What is an Intent in Android?

A

A message passing mechanism between components

B

A method for managing lifecycle states

C

A tool to manage UI layouts

D

A debugging tool

Q34

Q34 Which method is used to launch a new Activity in Android?

A

startActivity()

B

launchIntent()

C

startApp()

D

openActivity()

Q35

Q35 What is the purpose of the onCreate() method in an Android Activity?

A

To manage user permissions

B

To perform operations when the Activity is first created

C

To close the Activity

D

To handle background services

Q36

Q36 How do you pass data between two Activities in Android?

A

Using a Service

B

Using an Intent

C

Using a Fragment

D

Using a Content Provider

Q37

Q37 Which lifecycle method is called when an Activity becomes visible to the user?

A

onStart()

B

onCreate()

C

onResume()

D

onPause()

Q38

Q38 Which method is used to send data back from an Activity to its parent?

A

setResult()

B

finishActivity()

C

sendIntent()

D

returnResult()

Q39

Q39 How do you retrieve data from an Intent in the receiving Activity?

A

getIntent().getData()

B

getIntent().getExtras()

C

startIntent().getData()

D

getExtrasFromIntent()

Q40

Q40 How do you create an implicit Intent to open a web page in Android?

A

Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);

B

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://example.com"));

C

Intent intent = new Intent(Intent.ACTION_SEARCH);

D

Intent intent = new Intent(Intent.ACTION_MAIN);

Q41

Q41 An Activity crashes after being started. What is the first place to check for possible issues?

A

MainActivity.java

B

AndroidManifest.xml

C

Gradle build file

D

Logcat

Q42

Q42 What could cause an Activity to not appear when you try to start it?

A

The Activity is not declared in the AndroidManifest.xml

B

The device's battery is low

C

The layout file is missing

D

The app has no internet access

Q43

Q43 An Intent fails to pass data between two Activities. What is the most likely cause?

A

The wrong key was used in the putExtra() method

B

The Intent is declared in the manifest

C

The Activities are not visible

D

The device is in airplane mode

Q44

Q44 Which layout is the simplest for arranging UI components in a single row or column in Android?

A

RelativeLayout

B

ConstraintLayout

C

LinearLayout

D

FrameLayout

Q45

Q45 Which layout allows positioning of UI elements relative to each other or parent?

A

FrameLayout

B

ConstraintLayout

C

TableLayout

D

GridLayout

Q46

Q46 What is the purpose of the 'wrap_content' attribute in Android layouts?

A

To match the parent's width or height

B

To make the view as large as its parent

C

To make the view just large enough to fit its content

D

To hide the view

Q47

Q47 Which layout is best suited for creating overlapping UI components?

A

FrameLayout

B

TableLayout

C

LinearLayout

D

GridLayout

Q48

Q48 What does the 'match_parent' value for layout width or height signify?

A

The view will expand to fill the parent

B

The view will be hidden

C

The view will wrap around its content

D

The view will be centered

Q49

Q49 In a ConstraintLayout, which attribute is used to define the connection between two UI components?

A

layout_alignParent

B

layout_constraintEnd_toEndOf

C

layout_relativeTo

D

layout_connect

Q50

Q50 How do you set the margin of a Button in XML?

A

android:layout_margin="16dp"

B

layout_margin="16dp"

C

android:margin="16dp"

D

view_margin="16dp"

Q51

Q51 How do you set a background color for a TextView in XML?

A

android:background="@color/colorPrimary"

B

android:layout_backgroundColor="@color/colorPrimary"

C

android:backgroundColor="blue"

D

android:background="@colorPrimary"

Q52

Q52 How do you align a Button to the center of its parent in a RelativeLayout?

A

android:layout_centerInParent="true"

B

android:layout_alignParentCenter="true"

C

android:layout_alignInCenter="true"

D

android:layout_center="true"

Q53

Q53 A TextView is not visible in the app, although it is present in the layout file. What is the most likely cause?

A

The TextView has no ID

B

The TextView's text color is the same as the background

C

The TextView is not initialized

D

The TextView is in a FrameLayout

Q54

Q54 A Button is not aligned as expected in a ConstraintLayout. What is the most likely cause?

A

The Button's constraints are not properly set

B

The Button has no text

C

The Button has no ID

D

The Button is disabled

Q55

Q55 An app crashes when trying to inflate a custom view layout. What is a common cause?

A

Incorrect view ID

B

Layout file not found

C

The layout is missing required attributes

D

The app has no permissions

Q56

Q56 Which Android widget is used to display a scrollable list of items?

A

TextView

B

ListView

C

Button

D

ImageView

Q57

Q57 What is the function of the Spinner widget in Android?

A

To display text

B

To display a list of selectable options

C

To trigger background services

D

To display images

Q58

Q58 What does the CheckBox widget allow users to do?

A

Select a single option

B

Select multiple options

C

Open a new activity

D

Submit a form

Q59

Q59 Which widget is used to create a button that can trigger a user action?

A

TextView

B

Button

C

ImageButton

D

SeekBar

Q60

Q60 What is the purpose of the Android ProgressBar widget?

A

To display text

B

To display the progress of an operation

C

To show a list of items

D

To select multiple options

ad verticalad vertical
ad