MCQs / Computer Science / Messaging: SMS and Email
Messaging: SMS and Email MCQs — Computer Science 31 multiple-choice questions on Messaging: SMS and Email 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. Why should an app NOT contain an SMTP username and password to send emails? Android blocks all SMTP Emails cannot have subjects They can be extracted from the APK and misused SMTP is slower than SMS Answer: C) They can be extracted from the APK and misused
Explanation: Secrets in apps can be reverse engineered; use a backend server instead.
Discuss this question
2. Which extra sets the email subject? EXTRATEXT EXTRASUBJECT EXTRATITLE EXTRAHEADER Answer: B) EXTRASUBJECT
Explanation: EXTRASUBJECT holds the subject line.
Discuss this question
3. Which extra is used to attach a file to an email? EXTRADATA EXTRAATTACH EXTRASTREAM (with a content URI) EXTRAFILE Answer: C) EXTRASTREAM (with a content URI)
Explanation: EXTRASTREAM carries the attachment's URI.
Discuss this question
4. On Android 12 (API 31) and above, the recommended way to get SmsManager is: SmsManager.getDefault() only getSystemService(SmsManager::class.java) TelephonyManager.getSms() new SmsManager() Answer: B) getSystemService(SmsManager::class.java)
Explanation: getDefault() is deprecated from API 31.
Discuss this question
5. Which extra key pre-fills the SMS text in the Messages app? "smsbody" "textmessage" Intent.EXTRAEMAIL Intent.EXTRASUBJECT Answer: A) "smsbody"
Explanation: The messaging app reads the "smsbody" extra.
Discuss this question
6. INTERNET permission is: Only for system apps Restricted by Play policy A normal permission granted at install time A dangerous runtime permission Answer: C) A normal permission granted at install time
Explanation: Normal permissions are granted automatically.
Discuss this question
7. Two emulators can send SMS to each other using: Bluetooth The emulator console port number (e.g. 5554) as the phone number Their IP addresses Their package names Answer: B) The emulator console port number (e.g. 5554) as the phone number
Explanation: Each emulator's port works as its phone number.
Discuss this question
8. The sentIntent and deliveryIntent of sendTextMessage are of type: Uri Intent Bundle PendingIntent Answer: D) PendingIntent
Explanation: They are PendingIntents broadcast by the system later.
Discuss this question
9. Which URI scheme is used with ACTIONSENDTO to open an SMS app? geo: tel: mailto: smsto: Answer: D) smsto:
Explanation: smsto: (or sms:) targets messaging apps.
Discuss this question
10. A receiver registered in code (registerReceiver) is called a: Sticky receiver Manifest receiver Static receiver Dynamic (context-registered) receiver Answer: D) Dynamic (context-registered) receiver
Explanation: Context-registered receivers live while their context is active.
Discuss this question
11. Which approach sends an SMS WITHOUT needing any permission? A BroadcastReceiver ContentResolver.insert() An implicit intent that opens the Messages app SmsManager.sendTextMessage() Answer: C) An implicit intent that opens the Messages app
Explanation: The SMS intent lets the user's Messages app send it after the user confirms.
Discuss this question
12. Which method checks whether a permission is already granted? shouldShowRequestPermissionRationale() requestPermissions() ContextCompat.checkSelfPermission() grantUriPermission() Answer: C) ContextCompat.checkSelfPermission()
Explanation: checkSelfPermission returns PERMISSIONGRANTED or PERMISSIONDENIED.
Discuss this question
13. An SMS written in Urdu (Unicode) can hold up to: 300 characters 70 characters 140 characters 160 characters Answer: B) 70 characters
Explanation: UCS-2 Unicode reduces the limit to 70 characters.
Discuss this question
14. From which Android version must dangerous permissions be requested at run time? 6.0 (API 23) 12 4.4 9 Answer: A) 6.0 (API 23)
Explanation: Runtime permissions started in Marshmallow.
Discuss this question
15. Which intent opens ONLY email apps? ACTIONDIAL with tel: ACTIONSENDTO with a mailto: URI ACTIONSEND with type text/plain ACTIONVIEW with https: Answer: B) ACTIONSENDTO with a mailto: URI
Explanation: mailto: with SENDTO is handled only by email clients.
Discuss this question
16. In sendTextMessage(destination, scAddress, text, sentIntent, deliveryIntent), passing null for scAddress means: Use the default SMS centre Do not send Send as email Send to all contacts Answer: A) Use the default SMS centre
Explanation: null uses the phone's default service centre.
Discuss this question
17. shouldShowRequestPermissionRationale() returns true when: The user previously denied and the app should explain why it needs the permission The app is first installed The permission is granted The device has no SIM Answer: A) The user previously denied and the app should explain why it needs the permission
Explanation: It signals that an explanation should be shown before asking again.
Discuss this question
18. Why should the Send button be disabled after it is tapped? To close the app To request permission To save the layout To give feedback and prevent sending duplicate messages Answer: D) To give feedback and prevent sending duplicate messages
Explanation: Disabling or changing the button shows progress and avoids double sends.
Discuss this question
19. SmsManager.RESULTERRORRADIOOFF usually means: No SIM balance Message too long Wrong number format The phone is in airplane mode / radio is off Answer: D) The phone is in airplane mode / radio is off
Explanation: The cellular radio was turned off.
Discuss this question
20. Which component receives the SENT and DELIVERED broadcasts? Service only Fragment BroadcastReceiver ContentProvider Answer: C) BroadcastReceiver
Explanation: A BroadcastReceiver's onReceive handles the result.
Discuss this question
21. ACTIONSEND (instead of SENDTO) shows: Only the browser No apps All apps that can share the given MIME type Only email apps Answer: C) All apps that can share the given MIME type
Explanation: ACTIONSEND is a general share action.
Discuss this question
22. Which method splits a long text into parts? breakText() divideMessage() substringSms() splitSms() Answer: B) divideMessage()
Explanation: divideMessage returns a list of parts for sendMultipartTextMessage.
Discuss this question
23. SMS messages are routed through the operator's: SMSC (Short Message Service Centre) Web server SMTP server DNS server Answer: A) SMSC (Short Message Service Centre)
Explanation: The SMSC stores and forwards SMS messages.
Discuss this question
24. A single SMS using the standard GSM 7-bit alphabet can hold up to: 160 characters 1000 characters 255 characters 70 characters Answer: A) 160 characters
Explanation: GSM-7 encoding allows 160 characters per SMS.
Discuss this question
25. Which API lets an app read a one-time password SMS without SMS permissions? TelephonyManager SmsManager SMS User Consent / SMS Retriever API ContactsContract Answer: C) SMS User Consent / SMS Retriever API
Explanation: Google Play services APIs retrieve OTP messages without READSMS.
Discuss this question
Page 1 of 2 Next
Practise Messaging: SMS and Email MCQs
More Computer Science chapters