MCQs / Computer Science / Lab: Opening SMS and Email Apps
Lab: Opening SMS and Email Apps MCQs — Computer Science 10 multiple-choice questions on Lab: Opening SMS and Email Apps 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 does the counter warn when the message exceeds 160 characters? Because email has a 160-character limit Because EditText stops at 160 Because an SMS longer than 160 GSM characters is split into multiple messages Because SMS cannot exceed 160 characters at all Answer: C) Because an SMS longer than 160 GSM characters is split into multiple messages
Explanation: Longer texts are sent as multipart SMS.
Discuss this question
2. The To field remains empty in Gmail. The most likely mistake is: Using ACTIONSENDTO Using mailto: Using EXTRASUBJECT Passing a single String instead of a String array to EXTRAEMAIL Answer: D) Passing a single String instead of a String array to EXTRAEMAIL
Explanation: EXTRAEMAIL expects an array of addresses.
Discuss this question
3. Opening the SMS app with an intent requires which permission? SENDSMS None READSMS INTERNET Answer: B) None
Explanation: The user's SMS app sends the message, so no permission is needed.
Discuss this question
4. If no email app is installed, startActivity() throws: IllegalStateException NetworkOnMainThreadException SecurityException ActivityNotFoundException Answer: D) ActivityNotFoundException
Explanation: No matching activity causes ActivityNotFoundException.
Discuss this question
5. Which class validates the email format in the lab? Regex.EMAIL InputFilter.EMAIL Patterns.EMAILADDRESS EmailUtils Answer: C) Patterns.EMAILADDRESS
Explanation: android.util.Patterns.EMAILADDRESS provides an email matcher.
Discuss this question
6. Which code opens the Messages app addressed to 03001234567? Intent(Intent.ACTIONDIAL, Uri.parse("smsto:03001234567")) SmsManager.open("03001234567") Intent(Intent.ACTIONSENDTO, Uri.parse("smsto:03001234567")) Intent(Intent.ACTIONVIEW, Uri.parse("mailto:03001234567")) Answer: C) Intent(Intent.ACTIONSENDTO, Uri.parse("smsto:03001234567"))
Explanation: ACTIONSENDTO with smsto: targets SMS apps.
Discuss this question
7. doAfterTextChanged is used in the lab to: Send the SMS automatically Clear the field Update a live character counter as the user types Open the keyboard Answer: C) Update a live character counter as the user types
Explanation: It runs after each text change.
Discuss this question
8. The extra that pre-fills the SMS text is: Intent.EXTRASMS Intent.EXTRATEXT only "message" "smsbody" Answer: D) "smsbody"
Explanation: Messaging apps read the "smsbody" extra.
Discuss this question
9. Why is Uri.parse("mailto:") set as the data of the email intent? To attach a file So that only email apps can handle the intent To send immediately To open the browser Answer: B) So that only email apps can handle the intent
Explanation: mailto: restricts handlers to email clients.
Discuss this question
10. Which extra sets the email body? Intent.EXTRAMESSAGE Intent.EXTRATEXT Intent.EXTRABODY "smsbody" Answer: B) Intent.EXTRATEXT
Explanation: EXTRATEXT carries the body text.
Discuss this question
Practise Lab: Opening SMS and Email Apps MCQs
More Computer Science chapters