Font size
WorksheetsAndroid Activity Worksheet
Total questions: 40
Worksheet time: 20mins
What is an Activity in Android?
A background process
An application component representing a single screen with a user interface
A data storage unit
A service class
What method is used to start another activity in Android?
startIntent()
runActivity()
startActivity()
beginActivity
Which class is used to describe an operation to be performed in Android?
Bundle
Intent
ActivityManager
Manifest
Which type of Intent starts a specific activity?
Explicit Intent
Implicit Intent
Broad Intent
Service Intent
Which method allows sending data between activities?
Intent
BroadcastReceiver
Service
ContentProvider
To start an activity and expect a result, which method is used?
startIntent()
startActivityForResult()
startResult()
requestActivity()
What is the purpose of the Android manifest?
To list app permissions
To declare activities and components
To manage app data
Both A and B
Which function retrieves an integer extra from an intent?
getIntExtra()
getData()
getBundle()
getInfo()
Which of the following is NOT a type of intent?
Explicit Intent
Implicit Intent
Remote Intent
Broadcast Intent
What is the first step in creating a new activity?
Write a Java class
Define layout in XML
Add intent filter
Register it in manifest
What is stored in a Bundle?
Database schema
Key-value pairs of data
Layout information
Image resources
What happens when a new activity starts?
The previous one is destroyed
It is pushed to the activity stack
The system halts
None of the above
Which callback receives data from another activity?
onResult()
onActivityResult()
onReturn()
onReceiveData()
What type of navigation uses the device’s back button?
Up navigation
Back navigation
Down navigation
Parent navigation
Which method sets the result to be returned to the parent activity?
setDataResult()
setActivityResult()
setResult()
sendResult()
Which of the following best defines “Extras” in Intents?
Additional methods
Key-value data passed between activities
Backup data storage
UI elements
What lifecycle state is entered when an activity becomes invisible?
onStop()
onDestroy()
onCreate()
The “Main Activity” in an app is:
The launcher activity
The service handler
The intent receiver
The app’s database
Which component manages the Android back stack?
ActivityManager
FragmentManager
IntentService
RuntimeLoader
Which method assigns focus to a specific view?
setFocusable()
requestFocus()
gainFocus()
setFocus()
Which class is the base for all UI components in Android?
Activity
View
Layout
Widget
What does the EditText class provide?
Displaying images
Multiple lines of text input
Animation control
Navigation options
What input type conceals typed characters?
textAutoCorrect
textPassword
textEmailAddress
textCapSentences
Which view responds to user tapping or pressing?
TextView
Button
EditText
Spinner
What is a Floating Action Button (FAB)?
A circular, raised button for a primary action
A navigation drawer
A system icon
A dialog component
What is the difference between a checkbox and a radio button?
A. Checkboxes allow multiple selections; radio buttons allow only one
B. Both allow multiple selections
C. Radio buttons are for text input
D. Checkboxes are for numeric input
Which view group is used to organize radio buttons?
LinearLayout
RadioGroup
GridLayout
FrameLayout
What is a Spinner used for?
Numeric calculation
Displaying text
Selecting one value from a list
Showing alerts
What does an adapter do in a Spinner?
Converts data into a viewable format
Handles clicks
Loads layout
Stores string arrays
Which dialog type allows the user to pick a date?
AlertDialog
DatePickerDialog
TimePickerDialog
OptionDialog
Which class helps detect touch gestures?
MotionEvent
GestureDetectorCompat
TouchEvent
InputManager
Which method sets the listener when a view’s focus changes?
setFocusListener()
setOnFocusChangeListener()
onFocusChanged()
getFocusListener()
What is the function of onClickListener?
To handle touch gestures
To handle button click events
To manage layouts
To display menus
Which input control allows only one selection from a dropdown list?
Toggle
Spinner
CheckBox
RadioGroup
What method retrieves the current focused view?
getCurrentFocus()
findFocus()
getViewFocus()
locateFocus()
What is a fragment?
A reusable portion of UI within an activity
A database table
A layout file
A resource string
What gesture is recognized as a long press?
Fling
Drag
Long touch
Scroll
Which file defines the order of focus among input controls?
manifest.xml
layout XML
gradle.build
Which file is used for layout in Android development?
manifest.xml
layout XML
gradle.build
(No option provided)
How can a button’s click be handled in XML?
android:onClick attribute
setClick() method
handleTap attribute
callOnClick() method
