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?

  1. Because email has a 160-character limit
  2. Because EditText stops at 160
  3. Because an SMS longer than 160 GSM characters is split into multiple messages
  4. 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:

  1. Using ACTIONSENDTO
  2. Using mailto:
  3. Using EXTRASUBJECT
  4. 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?

  1. SENDSMS
  2. None
  3. READSMS
  4. 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:

  1. IllegalStateException
  2. NetworkOnMainThreadException
  3. SecurityException
  4. ActivityNotFoundException

Answer: D) ActivityNotFoundException

Explanation: No matching activity causes ActivityNotFoundException.

Discuss this question

5. Which class validates the email format in the lab?

  1. Regex.EMAIL
  2. InputFilter.EMAIL
  3. Patterns.EMAILADDRESS
  4. 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?

  1. Intent(Intent.ACTIONDIAL, Uri.parse("smsto:03001234567"))
  2. SmsManager.open("03001234567")
  3. Intent(Intent.ACTIONSENDTO, Uri.parse("smsto:03001234567"))
  4. 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:

  1. Send the SMS automatically
  2. Clear the field
  3. Update a live character counter as the user types
  4. 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:

  1. Intent.EXTRASMS
  2. Intent.EXTRATEXT only
  3. "message"
  4. "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?

  1. To attach a file
  2. So that only email apps can handle the intent
  3. To send immediately
  4. 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?

  1. Intent.EXTRAMESSAGE
  2. Intent.EXTRATEXT
  3. Intent.EXTRABODY
  4. "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