MCQs / Computer Science / Lab: Showing a Location on Google Maps
Lab: Showing a Location on Google Maps MCQs — Computer Science 12 multiple-choice questions on Lab: Showing a Location on Google Maps 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. In onMapReady, which call centres the map on a position at zoom 15? map.center = pos map.zoomTo(pos, 15) map.camera(15) map.moveCamera(CameraUpdateFactory.newLatLngZoom(pos, 15f)) Answer: D) map.moveCamera(CameraUpdateFactory.newLatLngZoom(pos, 15f))
Explanation: CameraUpdateFactory creates the camera update.
Discuss this question
2. Which Android Studio template creates a ready map screen? Navigation Drawer Views Activity Empty Views Activity Login Views Activity Google Maps Views Activity Answer: D) Google Maps Views Activity
Explanation: The Google Maps template sets up SupportMapFragment and the key placeholder.
Discuss this question
3. toDoubleOrNull() is used so that: The keyboard closes The app requests location permission The number is rounded Invalid text returns null instead of crashing Answer: D) Invalid text returns null instead of crashing
Explanation: It safely converts strings to Double.
Discuss this question
4. Why does the lab fall back to a https://www.google.com/maps/... URL? To save battery Because geo: URIs need a key To use satellite view To open the map in a browser if the Google Maps app is not installed Answer: D) To open the map in a browser if the Google Maps app is not installed
Explanation: The universal Maps URL works in any browser.
Discuss this question
5. setPackage("com.google.android.apps.maps") on the intent ensures that: No app opens The browser opens An API key is used The Google Maps app specifically handles the intent Answer: D) The Google Maps app specifically handles the intent
Explanation: setPackage limits the intent to that app.
Discuss this question
6. To restrict a Maps API key to your app you need the package name and the app's: versionCode launcher icon SHA-1 certificate fingerprint minSdk Answer: C) SHA-1 certificate fingerprint
Explanation: Android key restrictions use package name + SHA-1.
Discuss this question
7. Which longitude value is INVALID? 0 190.5 -122.4 73.0479 Answer: B) 190.5
Explanation: Longitude must be between -180 and 180.
Discuss this question
8. Where should the Maps API key be stored to avoid committing it to GitHub? The layout file strings.xml in the public repository The app name local.properties (read through the Secrets Gradle Plugin) Answer: D) local.properties (read through the Secrets Gradle Plugin)
Explanation: local.properties is excluded from version control by default.
Discuss this question
9. osmdroid is a good option in this lab because it: Shows only satellite images Is Google's official SDK Works without internet in all cases Displays OpenStreetMap maps without a Google API key or billing Answer: D) Displays OpenStreetMap maps without a Google API key or billing
Explanation: osmdroid uses free OpenStreetMap tiles.
Discuss this question
10. In geo:33.7295,73.0372?z=16, the value 16 is the: Marker colour Zoom level Number of results Latitude Answer: B) Zoom level
Explanation: z sets the zoom level.
Discuss this question
11. Which inputType allows decimals and negative numbers for coordinates? phone textUri number numberDecimalnumberSigned Answer: D) numberDecimalnumberSigned
Explanation: Coordinates need a decimal point and may be negative.
Discuss this question
12. Which URI starts driving navigation in Google Maps? maps:navigate geo:drive?33.7,73.0 google.navigation:q=33.7,73.0&mode=d https://drive.google.com Answer: C) google.navigation:q=33.7,73.0&mode=d
Explanation: google.navigation: with mode=d starts driving navigation.
Discuss this question
Practise Lab: Showing a Location on Google Maps MCQs
More Computer Science chapters