MCQs / Computer Science / Maps and Consuming Web Services over HTTP

Maps and Consuming Web Services over HTTP MCQs — Computer Science

39 multiple-choice questions on Maps and Consuming Web Services over HTTP 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. geo:0,0?q=33.6844,73.0479(Faisal Mosque) will:

  1. Send an SMS
  2. Show a marker labelled Faisal Mosque at the coordinates
  3. Call a phone number
  4. Open the camera

Answer: B) Show a marker labelled Faisal Mosque at the coordinates

Explanation: The q parameter with a label in brackets drops a labelled marker.

Discuss this question

2. Retrofit is developed by:

  1. JetBrains
  2. Google
  3. Square
  4. Meta

Answer: C) Square

Explanation: Retrofit and OkHttp are Square's libraries.

Discuss this question

3. Latitude values range from:

  1. −90 to +90
  2. 0 to 100
  3. −180 to +180
  4. 0 to 360

Answer: A) −90 to +90

Explanation: Latitude measures north–south from −90 to +90 degrees.

Discuss this question

4. Which converter turns JSON into Kotlin objects in Retrofit?

  1. SQLite
  2. ContentResolver
  3. GsonConverterFactory (or Moshi/kotlinx converter)
  4. LayoutInflater

Answer: C) GsonConverterFactory (or Moshi/kotlinx converter)

Explanation: Converter factories (de)serialise JSON.

Discuss this question

5. The Android class that converts an address to coordinates (and back) is:

  1. Projection
  2. Geocoder
  3. MapView
  4. LocationManager

Answer: B) Geocoder

Explanation: Geocoder performs forward and reverse geocoding.

Discuss this question

6. Which permission does an app need to access the internet?

  1. ACCESSFINELOCATION
  2. READEXTERNALSTORAGE
  3. BINDINTERNET
  4. INTERNET

Answer: D) INTERNET

Explanation: android.permission.INTERNET is a normal permission.

Discuss this question

7. Which callback provides the GoogleMap object when it is ready?

  1. onResume()
  2. onMapLoaded only
  3. onCreate()
  4. onMapReady(googleMap)

Answer: D) onMapReady(googleMap)

Explanation: getMapAsync(this) eventually calls onMapReady.

Discuss this question

8. Performing a network request on the main thread causes:

  1. SecurityException
  2. Faster loading
  3. NetworkOnMainThreadException
  4. A notification

Answer: C) NetworkOnMainThreadException

Explanation: Android forbids network calls on the UI thread.

Discuss this question

9. A web service is:

  1. A layout file
  2. Software on a server that apps call over the network (usually HTTP) to get or send data
  3. A type of Android service that plays music
  4. A database on the phone

Answer: B) Software on a server that apps call over the network (usually HTTP) to get or send data

Explanation: Mobile apps act as clients of web services.

Discuss this question

10. Which code moves the camera to a location at zoom 15?

  1. map.goTo(15)
  2. map.camera = latLng
  3. map.zoom(15)
  4. map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15f))

Answer: D) map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15f))

Explanation: CameraUpdateFactory creates camera updates.

Discuss this question

11. Which built-in Java class can make HTTP requests without libraries?

  1. SharedPreferences
  2. HttpURLConnection
  3. SQLiteOpenHelper
  4. TextWatcher

Answer: B) HttpURLConnection

Explanation: HttpURLConnection is part of java.net.

Discuss this question

12. Which Retrofit annotation adds ?userId=1 to the URL?

  1. @Field
  2. @Query
  3. @Path
  4. @Body

Answer: B) @Query

Explanation: @Query adds query parameters.

Discuss this question

13. Which URI starts turn-by-turn navigation in Google Maps?

  1. tel:33.68,73.04
  2. google.navigation:q=33.68,73.04
  3. maps://drive
  4. geo:nav:33.68,73.04

Answer: B) google.navigation:q=33.68,73.04

Explanation: google.navigation: opens navigation mode.

Discuss this question

14. Since Android 9, plain HTTP (non-HTTPS) traffic is:

  1. Faster than HTTPS
  2. Blocked by default (cleartext traffic not permitted)
  3. Required by Play
  4. Always allowed

Answer: B) Blocked by default (cleartext traffic not permitted)

Explanation: Apps must use HTTPS or explicitly allow cleartext.

Discuss this question

15. Which map type shows satellite images with road labels?

  1. MAPTYPETERRAIN
  2. MAPTYPENORMAL
  3. MAPTYPEHYBRID
  4. MAPTYPENONE

Answer: C) MAPTYPEHYBRID

Explanation: Hybrid combines satellite imagery with labels.

Discuss this question

16. In a geo: URI, the parameter z=15 sets the:

  1. Zoom level (1 = world, about 20 = buildings)
  2. Time zone
  3. Latitude
  4. Altitude in metres

Answer: A) Zoom level (1 = world, about 20 = buildings)

Explanation: z controls the initial zoom.

Discuss this question

17. While data is downloading, a good app shows:

  1. Nothing
  2. A progress indicator, and an error/Retry message if it fails
  3. A blank white screen
  4. The splash screen forever

Answer: B) A progress indicator, and an error/Retry message if it fails

Explanation: Loading, error and empty states improve user experience.

Discuss this question

18. Status code 401 means:

  1. Not found
  2. Created
  3. OK
  4. Unauthorized (missing or invalid credentials)

Answer: D) Unauthorized (missing or invalid credentials)

Explanation: 401 requires authentication.

Discuss this question

19. The Maps SDK API key is placed in the manifest inside a:

  1. uses-permission element
  2. meta-data element named com.google.android.geo.APIKEY
  3. activity element
  4. string resource only

Answer: B) meta-data element named com.google.android.geo.APIKEY

Explanation: The key is read from the com.google.android.geo.APIKEY meta-data.

Discuss this question

20. Which Retrofit annotation replaces id in users/id?

  1. @Path("id")
  2. @Query("id")
  3. @Body
  4. @Header("id")

Answer: A) @Path("id")

Explanation: @Path substitutes URL path segments.

Discuss this question

21. To embed a Google Map inside an activity you use:

  1. ListView
  2. WebView only
  3. ImageView
  4. SupportMapFragment (or MapView)

Answer: D) SupportMapFragment (or MapView)

Explanation: SupportMapFragment hosts an interactive GoogleMap.

Discuss this question

22. In Kotlin, withContext(Dispatchers.IO) ... is used to:

  1. Restart the activity
  2. Create a notification
  3. Update the UI
  4. Run blocking network/disk code on a background thread

Answer: D) Run blocking network/disk code on a background thread

Explanation: Dispatchers.IO is optimised for I/O work off the main thread.

Discuss this question

23. Which approach shows a location WITHOUT an API key?

  1. An implicit intent with a geo: URI that opens the Google Maps app
  2. Places API
  3. Google Maps SDK with SupportMapFragment
  4. Directions API

Answer: A) An implicit intent with a geo: URI that opens the Google Maps app

Explanation: Map intents hand the work to the Maps app and need no key.

Discuss this question

24. Which org.json class represents "name": "Ali" ?

  1. JSONArray
  2. JSONString
  3. JSONObject
  4. JsonReader only

Answer: C) JSONObject

Explanation: A JSON object maps keys to values.

Discuss this question

25. In JSON, square brackets [ ] denote:

  1. An array
  2. A string
  3. An object
  4. A comment

Answer: A) An array

Explanation: Arrays use [ ]; objects use .

Discuss this question

Page 1 of 2 Next

Practise Maps and Consuming Web Services over HTTP MCQs

More Computer Science chapters