MCQs / Computer Science / Intents and Notifications

Intents and Notifications MCQs — Computer Science (page 2)

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.

26. Sharing plain text with any app uses:

  1. ACTIONDIAL with tel:
  2. ACTIONSEND with type "text/plain" and EXTRATEXT
  3. ACTIONVIEW with geo:
  4. ACTIONMAIN with LAUNCHER

Answer: B) ACTIONSEND with type "text/plain" and EXTRATEXT

Explanation: ACTIONSEND is the standard share action.

Discuss this question

27. A notification is shown:

  1. Outside the app's UI, e.g. in the status bar and notification drawer
  2. Only in Logcat
  3. Only inside the app's activity
  4. Only on a desktop

Answer: A) Outside the app's UI, e.g. in the status bar and notification drawer

Explanation: Notifications appear in system UI areas.

Discuss this question

28. ACTIONCALL (calling directly) requires which permission?

  1. No permission
  2. INTERNET
  3. READCONTACTS
  4. CALLPHONE

Answer: D) CALLPHONE

Explanation: Placing a call directly is dangerous and needs CALLPHONE at run time.

Discuss this question

29. From Android 13, an app must request which runtime permission to show notifications?

  1. SHOWALERTS
  2. NOTIFYUSER
  3. STATUSBAR
  4. POSTNOTIFICATIONS

Answer: D) POSTNOTIFICATIONS

Explanation: POSTNOTIFICATIONS is a runtime permission on API 33+.

Discuss this question

30. Posting a new notification with the same ID as an existing one will:

  1. Crash the app
  2. Delete all notifications
  3. Create a duplicate
  4. Update the existing notification

Answer: D) Update the existing notification

Explanation: Same ID replaces/updates the notification.

Discuss this question

31. Extra data is attached to an intent as a:

  1. Fragment
  2. Cursor
  3. JSON file
  4. Bundle of key–value pairs (extras)

Answer: D) Bundle of key–value pairs (extras)

Explanation: putExtra stores values in the intent's extras Bundle.

Discuss this question

32. An Intent in Android is a:

  1. Database query
  2. Layout file
  3. Messaging object used to request an action from another component
  4. Type of thread

Answer: C) Messaging object used to request an action from another component

Explanation: Intents carry requests between components and apps.

Discuss this question

33. Notifications sent from a server to many phones use:

  1. Firebase Cloud Messaging (push notifications)
  2. Toasts
  3. Intent filters
  4. SharedPreferences

Answer: A) Firebase Cloud Messaging (push notifications)

Explanation: FCM delivers push messages to Android devices.

Discuss this question

34. Which method actually displays the notification?

  1. notify(id, notification)
  2. build()
  3. show()
  4. post()

Answer: A) notify(id, notification)

Explanation: NotificationManager(Compat).notify posts the notification.

Discuss this question

35. setAutoCancel(true) means:

  1. The notification is removed when the user taps it
  2. The notification can never be removed
  3. It disables sound
  4. It cancels the app

Answer: A) The notification is removed when the user taps it

Explanation: Auto-cancel dismisses the notification on tap.

Discuss this question

36. Which action opens the dialer with a number but does NOT place the call?

  1. ACTIONANSWER
  2. ACTIONCALL
  3. ACTIONDIAL
  4. ACTIONSEND

Answer: C) ACTIONDIAL

Explanation: ACTIONDIAL shows the dialer; the user presses call.

Discuss this question

37. Which extra holds the subject when composing an email?

  1. EXTRATITLE
  2. EXTRAHEADER
  3. EXTRAEMAILSUBJECTTEXT
  4. EXTRASUBJECT

Answer: D) EXTRASUBJECT

Explanation: Intent.EXTRASUBJECT is the subject line.

Discuss this question

38. To make your app appear in the share sheet for text, its filter needs:

  1. action DIAL and scheme tel
  2. action MAIN and category LAUNCHER
  3. action SEND, category DEFAULT and mimeType text/plain
  4. action VIEW and scheme geo

Answer: C) action SEND, category DEFAULT and mimeType text/plain

Explanation: This filter matches text share intents.

Discuss this question

Previous Page 2 of 2

Practise Intents and Notifications MCQs

More Computer Science chapters