MCQs / Computer Science / Intents and Notifications
Intents and Notifications MCQs — Computer Science 38 multiple-choice questions on Intents and Notifications from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
1. To open your own app's settings page, which action is used? ACTIONSETTINGSAPP ACTIONMANAGE Settings.ACTIONAPPLICATIONDETAILSSETTINGS with a package: URI ACTIONCONFIG Answer: C) Settings.ACTIONAPPLICATIONDETAILSSETTINGS with a package: URI
Explanation: This settings action opens the App info screen for the package.
Discuss this question
2. Which intent declares only an action and data and lets Android choose the app? Pending intent Service intent Explicit intent Implicit intent Answer: D) Implicit intent
Explanation: Implicit intents are resolved through intent filters.
Discuss this question
3. Opening your app from a website link (deep link) uses a filter with: action VIEW, category BROWSABLE and https data category LAUNCHER only action CALL action SEND Answer: A) action VIEW, category BROWSABLE and https data
Explanation: Deep links use VIEW + BROWSABLE + data with scheme/host.
Discuss this question
4. If no app can handle an implicit intent, startActivity() throws: NullPointerException IOException SecurityException ActivityNotFoundException Answer: D) ActivityNotFoundException
Explanation: Catch ActivityNotFoundException to avoid a crash.
Discuss this question
5. A major benefit of calling built-in apps with implicit intents is that: The app becomes bigger It works only on emulators Your app reuses existing apps' features without implementing them and often without permissions It removes the need for a manifest Answer: C) Your app reuses existing apps' features without implementing them and often without permissions
Explanation: The other app (dialer, maps, camera) does the work.
Discuss this question
6. Which intent specifies the exact class of the component to start? Sticky intent Implicit intent Explicit intent Broadcast intent Answer: C) Explicit intent
Explanation: Explicit intents include the component name.
Discuss this question
7. Which importance level shows a heads-up pop-up with sound? IMPORTANCEMIN IMPORTANCEDEFAULT IMPORTANCELOW IMPORTANCEHIGH Answer: D) IMPORTANCEHIGH
Explanation: High importance makes sound and appears as heads-up.
Discuss this question
8. Which method shows the "Share via" chooser dialog? Intent.createChooser(intent, "Share via") showShareSheet() startChooserActivity() Intent.share() Answer: A) Intent.createChooser(intent, "Share via")
Explanation: createChooser wraps an intent so the user always picks an app.
Discuss this question
9. An activity must include which category in its intent filter to receive implicit intents from startActivity()? CATEGORYLAUNCHER CATEGORYHOME CATEGORYDEFAULT CATEGORYAPPMUSIC Answer: C) CATEGORYDEFAULT
Explanation: startActivity adds CATEGORYDEFAULT to implicit intents automatically.
Discuss this question
10. Which style shows a long piece of text when the notification is expanded? BigTextStyle ProgressStyle MediaStyle InboxStyle Answer: A) BigTextStyle
Explanation: BigTextStyle displays expanded long text.
Discuss this question
11. From Android 12, components with an intent filter must set: android:exported explicitly (true to receive outside intents) android:enabled="false" android:debuggable android:process Answer: A) android:exported explicitly (true to receive outside intents)
Explanation: Android 12 requires an explicit exported value.
Discuss this question
12. Which URI scheme shows a location in a maps app? tel: geo: content: smsto: Answer: B) geo:
Explanation: geo:lat,lng opens a map application.
Discuss this question
13. A PendingIntent allows: Sending SMS without permission Another app or the system to execute your intent later with your app's identity Running code on another phone Faster intents Answer: B) Another app or the system to execute your intent later with your app's identity
Explanation: PendingIntent is a token given to the notification manager, alarms or widgets.
Discuss this question
14. Which URI opens a web page using ACTIONVIEW? https://www.google.com geo:www.google.com mailto:www.google.com tel:www.google.com Answer: A) https://www.google.com
Explanation: An http/https URI with ACTIONVIEW opens a browser.
Discuss this question
15. Which call attaches the action performed when the notification is tapped? setPriority() setContentIntent(pendingIntent) setSmallIcon() setChannelId() Answer: B) setContentIntent(pendingIntent)
Explanation: setContentIntent sets the PendingIntent fired on tap.
Discuss this question
16. Which element is REQUIRED for every notification? Big picture Action button Large icon Small icon Answer: D) Small icon
Explanation: A notification without setSmallIcon() throws an error.
Discuss this question
17. To open the camera app to take a photo, the action used is: MediaStore.ACTIONIMAGECAPTURE ACTIONPICTURE ACTIONSHOOT ACTIONCAMERA Answer: A) MediaStore.ACTIONIMAGECAPTURE
Explanation: MediaStore.ACTIONIMAGECAPTURE launches the camera app.
Discuss this question
18. Intent filters are declared in: build.gradle MainActivity only strings.xml AndroidManifest.xml Answer: D) AndroidManifest.xml
Explanation: Filters are part of component declarations in the manifest.
Discuss this question
19. Since Android 12, creating a PendingIntent requires: Specifying FLAGIMMUTABLE or FLAGMUTABLE Root access A network connection A foreground service Answer: A) Specifying FLAGIMMUTABLE or FLAGMUTABLE
Explanation: Mutability flags are mandatory from API 31.
Discuss this question
20. Notification channels are required from Android: 10 8.0 (API 26) 13 5.0 Answer: B) 8.0 (API 26)
Explanation: Since Oreo, notifications without a channel are not shown.
Discuss this question
21. Which flag starts an activity in a new task, needed when starting from a non-activity context? FLAGIMMUTABLE FLAGSECURE FLAGKEEPSCREENON FLAGACTIVITYNEWTASK Answer: D) FLAGACTIVITYNEWTASK
Explanation: Starting an activity from a service or application context needs NEWTASK.
Discuss this question
22. Users can turn off one category of an app's notifications (e.g. promotions) because of: Toasts Notification channels PendingIntent flags Intent filters Answer: B) Notification channels
Explanation: Channels let users control each category separately.
Discuss this question
23. Which of these is NOT one of the three fundamental uses of intents? Starting an activity Delivering a broadcast Starting a service Compiling a layout Answer: D) Compiling a layout
Explanation: Intents start activities, start services and deliver broadcasts.
Discuss this question
24. Which three tests does Android perform during intent resolution? Permission, version, signature Size, colour, speed Memory, CPU, battery Action, category and data tests Answer: D) Action, category and data tests
Explanation: Implicit intents are matched against filters with the action, category and data tests.
Discuss this question
25. The AndroidX class used to build notifications compatible with all versions is: Notification.Builder only AlertDialog.Builder Toast.Builder NotificationCompat.Builder Answer: D) NotificationCompat.Builder
Explanation: NotificationCompat.Builder handles version differences.
Discuss this question
Page 1 of 2 Next
Practise Intents and Notifications MCQs
More Computer Science chapters