MCQs / Computer Science / Maps and Consuming Web Services over HTTP
Maps and Consuming Web Services over HTTP MCQs — Computer Science (page 2) 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.
26. Gson's @SerializedName annotation is used when: The JSON is an array Encrypting data The field is a number The JSON field name differs from the Kotlin property name Answer: D) The JSON field name differs from the Kotlin property name
Explanation: It maps differently named JSON keys to properties.
Discuss this question
27. In MVVM, network calls should be placed in a: Layout XML Activity's onCreate only Repository used by a ViewModel BroadcastReceiver Answer: C) Repository used by a ViewModel
Explanation: Repository + ViewModel separates data access from UI and survives rotation.
Discuss this question
28. The baseUrl given to Retrofit.Builder must: Use http only Be an IP address Contain a query string End with a slash (/) Answer: D) End with a slash (/)
Explanation: Retrofit requires the base URL to end with /.
Discuss this question
29. Which HTTP method is used to READ data? POST PUT DELETE GET Answer: D) GET
Explanation: GET retrieves resources.
Discuss this question
30. Which library is commonly used to load images from URLs into ImageViews? Room WorkManager Glide / Coil Retrofit Answer: C) Glide / Coil
Explanation: Glide and Coil download, cache and display images.
Discuss this question
31. To draw a route line on a Google Map, use: addCircle addMarker setMapType addPolyline Answer: D) addPolyline
Explanation: Polylines connect a list of LatLng points.
Discuss this question
32. An open-source alternative map library for Android is: MapKit Firebase Maps osmdroid (OpenStreetMap) Core Location Answer: C) osmdroid (OpenStreetMap)
Explanation: osmdroid and MapLibre use open map data.
Discuss this question
33. Why should the API key be restricted to your package name and SHA-1 fingerprint? So other apps cannot misuse your key and your billing To make the map faster It is required for map intents To enable satellite view Answer: A) So other apps cannot misuse your key and your billing
Explanation: Key restrictions prevent unauthorised use.
Discuss this question
34. In Retrofit, an HTTP API is described as a: JSON file Layout XML SQL table Kotlin/Java interface with annotated methods Answer: D) Kotlin/Java interface with annotated methods
Explanation: Each interface method represents an endpoint.
Discuss this question
35. Which HTTP method normally CREATES a new resource? POST DELETE GET HEAD Answer: A) POST
Explanation: POST submits data to create a resource.
Discuss this question
36. Checking whether the device has a network connection uses: TelephonyManager only LocationManager ConnectivityManager with NetworkCapabilities WifiManager.disable() Answer: C) ConnectivityManager with NetworkCapabilities
Explanation: ConnectivityManager reports active network capabilities.
Discuss this question
37. Which call adds a pin at a position? map.addMarker(MarkerOptions().position(latLng).title("Campus")) map.setMarker(latLng) map.addPin(latLng) map.drawPoint(latLng) Answer: A) map.addMarker(MarkerOptions().position(latLng).title("Campus"))
Explanation: MarkerOptions configures a marker added with addMarker.
Discuss this question
38. Status code 500 indicates: The resource was created Redirect Client typing error An internal server error Answer: D) An internal server error
Explanation: 5xx codes are server-side errors.
Discuss this question
39. Status code 404 means: Unauthorized Server error Success Not Found Answer: D) Not Found
Explanation: 404 indicates the requested resource does not exist.
Discuss this question
Previous Page 2 of 2
Practise Maps and Consuming Web Services over HTTP MCQs
More Computer Science chapters