MCQs / Computer Science / Lab: Implicit Intents – Browser and Dialer

Lab: Implicit Intents – Browser and Dialer MCQs — Computer Science

12 multiple-choice questions on Lab: Implicit Intents – Browser and Dialer 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. Which inputType opens the numeric phone keypad?

  1. date
  2. phone
  3. text
  4. textEmailAddress

Answer: B) phone

Explanation: inputType="phone" displays the dial pad keyboard.

Discuss this question

2. Which inputType shows a keyboard suitable for web addresses?

  1. textUri
  2. textPassword
  3. phone
  4. number

Answer: A) textUri

Explanation: textUri shows / and .com keys.

Discuss this question

3. Why is startActivity() wrapped in try/catch in this lab?

  1. To log the URL
  2. To avoid a crash (ActivityNotFoundException) if no app can handle the intent
  3. To speed up the app
  4. To ask for permissions

Answer: B) To avoid a crash (ActivityNotFoundException) if no app can handle the intent

Explanation: Catching the exception lets the app show a friendly message instead of crashing.

Discuss this question

4. Why does the lab add "https://" when the user types only "www.hec.gov.pk"?

  1. To make the text longer
  2. To call the website
  3. To store it in SharedPreferences
  4. Because a URI without a scheme may not be recognised as a web link

Answer: D) Because a URI without a scheme may not be recognised as a web link

Explanation: The http/https scheme tells Android to open a browser.

Discuss this question

5. Which call makes the share chooser appear every time?

  1. Intent.createChooser(send, "Share via")
  2. send.setChooser(true)
  3. startChooser()
  4. Toast.makeText(...)

Answer: A) Intent.createChooser(send, "Share via")

Explanation: createChooser forces the app picker dialog.

Discuss this question

6. Which URI shows a labelled place in a maps app?

  1. geo:33.6844,73.0479?q=33.6844,73.0479(Our Campus)
  2. https:geo:campus
  3. map://campus
  4. tel:33.68,73.04

Answer: A) geo:33.6844,73.0479?q=33.6844,73.0479(Our Campus)

Explanation: geo: with a q parameter and label in brackets drops a marker.

Discuss this question

7. Which URI is used with ACTIONDIAL?

  1. geo:03001234567
  2. tel:03001234567
  3. sms:03001234567
  4. https:03001234567

Answer: B) tel:03001234567

Explanation: The tel: scheme passes the phone number.

Discuss this question

8. Which intent opens the website typed by the user?

  1. Intent(Intent.ACTIONVIEW, Uri.parse(url))
  2. Intent(Intent.ACTIONDIAL, Uri.parse(url))
  3. Intent(this, Browser::class.java)
  4. Intent(Intent.ACTIONSEND, url)

Answer: A) Intent(Intent.ACTIONVIEW, Uri.parse(url))

Explanation: ACTIONVIEW with an http(s) URI is handled by browsers.

Discuss this question

9. etUrl.error = "Enter a website" will:

  1. Show a red error icon and message on the EditText
  2. Close the app
  3. Open the browser
  4. Clear the field

Answer: A) Show a red error icon and message on the EditText

Explanation: setError displays an error indicator on the field.

Discuss this question

10. On Android 13+, before posting a notification the app must obtain:

  1. POSTNOTIFICATIONS
  2. ACCESSFINELOCATION
  3. INTERNET
  4. CALLPHONE

Answer: A) POSTNOTIFICATIONS

Explanation: POSTNOTIFICATIONS is a runtime permission from API 33.

Discuss this question

11. To place a call immediately without user confirmation you must use:

  1. ACTIONVIEW
  2. ACTIONSENDTO
  3. ACTIONDIAL
  4. ACTIONCALL with the CALLPHONE runtime permission

Answer: D) ACTIONCALL with the CALLPHONE runtime permission

Explanation: Direct calls need the dangerous CALLPHONE permission.

Discuss this question

12. Which statement about ACTIONDIAL is TRUE?

  1. It needs CALLPHONE permission
  2. It opens the dialer with the number and the user decides to call
  3. It sends an SMS
  4. It works only on tablets

Answer: B) It opens the dialer with the number and the user decides to call

Explanation: ACTIONDIAL requires no permission because the user presses Call.

Discuss this question

Practise Lab: Implicit Intents – Browser and Dialer MCQs

More Computer Science chapters