Latest Google Maps API Development Interview Questions
Which control contains a Pegman icon that can be dragged onto a map?
A. Overview
B. Pan
C. StreetView
D. Zoom
Ans: C
What is the default map type?
A. ROADMAP
B. SATELLITE
C. HYBRID
D. STREETLEVEL
Ans: A
To remove the polyline “flightPath” from a map, which syntax would you use?
A. flightPath.setPolyline = 0;
B. flightPath.setDisplay(null);
C. flightPath.setMap(null);
D. flightPath.setPolyline = null;
Ans: C
How do you add traffic information to a map?
A. map.trafficLayer.setVisible(true);
B. map.addLayer(‘traffic’);
C. var trafficLayer = new google.maps.TrafficLayer(); trafficLayer.setMap(map);
D. var trafficLayer = new google.maps.TrafficLayer(); map.add(trafficLayer)
Ans: C
Which additional library must you load if you want to add a heatmap layer to your map?
A. weather
B. places
C. visualization
D. drawing
Ans: C
For best map display on mobile devices, set the width and height of the that contains the map to:
A. 600px
B. 100%
C. 80%
D. 50%
Ans: B
In the syntax to load the JavaScript Google Maps API, what does the parameter “sensor=true” indicate?
A. Use weather sensor at map location.
B. Use GPS locator to determine user’s location.
C. Locate landmarks near map location.
D. Show current location of street level camera.
Ans: B
If you want to monetize your map application with context-sensitive display advertising, which library should you use?
A. AdSense
B. Panoramio
C. Places
D. Shopping
Ans: A
What service can be used to obtain a LatLng from an address?
A. Geocoder
B. Geography
C. Distance
D. Directions
Ans: A
What overlay object can be used to contain information HTML content?
A. Bubble
B. Polygon
C. Marker
D. InfoWindow
Ans: D
When you create a new map, you must specify the initial zoom as a map option. What is the other required initial map option?
A. backgroundColor
B. tilt
C. styles
D. center
Ans: D
Street View provides a panoramic view of:
A. 360 degrees
B. 90 degrees
C. 45 degrees
D. 180 degrees
Ans: A
How do you add a click event listener to a google map?
A. map.listener.add(‘click’, clickFunction);
B. google.maps.listener.add(map, ‘click’, clickFunction);
C. google.maps.event.addListener(map, ‘click’, clickFunction);
D. map.addListener.add(‘click’, clickFunction);
Ans: C
Which of the following is not a common MapType?
A. ROADMAP
B. TERRAIN
C. ELEVATION
D. HYBRID
Ans: C
True or False: The JavaScript Google Maps API does not support reverse geocoding (translating a map location into an address).
A. False
B. True
Ans: A
Which of the following must you obtain to load the JavaScript Google Maps API for a non-business application?
A. Temporary application license
B. Enterprise application license
C. API key
D. Cryptographic key
Ans: C
True or False: When using the JavaScript Google Maps API, you normally specify a
HTML element as a container for the map.
A. False
B. True
Ans: B
True or False: When using the JavaScript Google Maps API, the MapType control appears by default on the map.
A. False
B. True
Ans: B
Which of the following travel modes is not supported when you are calculating directions?
A. TRANSIT
B. DRIVING
C. BICYCLING
D. FLYING
Ans: D
Which arguments must be passed to a LatLng object?
A. Height and width
B. Highway number and mile marker
C. Latitude and longitude
D. Address and ZIP code
Ans: C
True or False: You can use a custom map projection when implementing a custom map.
A. False
B. True
Ans: B
Taking an address and translating it into a geographic point is known as what?
A. Geolocating
B. Geoparsing
C. Geocaching
D. Geocoding
Ans: D
The Google Maps API for which of the following platforms is deprecated?
A. Android
B. JavaScript v3
C. Flash
D. iOS
Ans: C
True or False: You can only create one instance of the JavaScript Map class on a page.
A. True
B. False
Ans: B
Which of the following is not a built-in control that can be used on a map?
A. BirdsEyeView
B. Pan
C. MapType
D. StreetView
Ans: A
Which of the following functions can change the zoom level of the map.
A. map.setCenter
B. map.changeZoom
C. map.setZoom
D. map.zoom
Ans: C
True or False: If you want your JavaScript Google Maps API application to search for places, you must load an additional places library through the bootstrap request.
A. False
B. True
Ans: B
What type of object is the position property of MarkerOptions?
A. google.maps.LatLng
B. google.maps.point;
C. google.maps.LatLngBounds
D. google.maps.Sharpie
Ans: A
Which class is used to display text or images in a popup window attached to a marker?
A. MarkerOptions
B. InfoWindow
C. InfoOptions
D. MapOption
Ans: B
What function do you call to make the map contain specific bounds.
A. map.fitBounds(LatLngBounds);
B. map.setCenter(LatLng);
C. map.fitBounds(GeographicBounds);
D. map.panTo(LatLng);
Ans: A
What is the correct way to create a Google Maps API object that represents a point on a map?
A. new LatLng(lat:number, lng:number);
B. new IconPoint(lat:number,lng:number)
C. new PointCode(lat:number,lng:number)
D. new Geocode(lat:number,lng:number)
Ans: A
What function sets the HTML contained in an InfoWindow?
A. infoWindow.html(HTMLstring);
B. infoWindow.setContent(HTMLstring);
C. infoWindow.setHTML(HTMLstring);
D. infoWindow.innerHTML(HTMLstring);
Ans: B
What is the namespace on which event listeners must be registered to listen for Google Maps API events?
A. events.maps.google
B. google.api.mapevents
C. google.maps.event
D. google.mapevents
Ans: C
How can you add a marker to an existing map, named “myMap”?
A. marker.setMap(myMap); or var marker = new marker({position:latLng, map:myMap});
B. var marker = new marker({position:latLng, map:map});
C. map.add(marker);
D. marker.setMap(map);
Ans: A
What querystring parameter added to the maps api url will call a named function after the maps api loads?
A. function
B. loaded
C. callback
D. afterload
Ans: C
Which of the following is not an argument for the addListener() event handler?
A. object on which event occurred
B. bubbling phase of event
C. event for which the handler is listening
D. function to respond to event
Ans: B
What overlay object would you use to draw an enclosed shape on the map given an array of LatLng objects?
A. polyline
B. shape
C. marker
D. polygon
Ans: D
How can you determine if the current map viewport contains a specific point?
A. map.getBounds.Overlaps(LatLng)
B. map.getBounds().contains(LatLngBounds);
C. map.getBounds().contains(LatLng);
D. map.contains(LatLng);
Ans: C
Which of the following is not a valid base map type?
A. TERRAIN
B. STREETLEVEL
C. ROADMAP
D. SATELLITE
Ans: B
Which object defines a geographic rectangle on the map using two LatLng objects?
A. LatLngBounds
B. GeographicBounds
C. LatLng
D. Bounds
Ans: A
What property of MarkerOptions determines where a marker is placed on the map?
A. point
B. center
C. position
D. latLng
Ans: C
What MapOptions properties are required when creating a new map?
A. zoom
B. mapDiv
C. zoom and center
D. center
Ans: C
How can you expand a LatLngBounds object to ensure that it included additional points?
A. latLngBounds.add(newLatLng)
B. latLngBounds.extend(newLatLng)
C. latLngBounds.contain(newLatLng)
D. (none of these)
Ans: B
How can you retrieve an array of markers that have been added to the map?
A. var markers = map.markers;
B. var markers = map.getMarkers();
C. Overlays added to the map are not managed by the map and must be managed manually.
D. var markers = map.getOverlays(“marker”);
Ans: C
Which Map class method is used to animate the transition of the map center to a new LatLng?
A. panTo
B. panBy
C. newCenter
D. panCenter
Ans: A
What property of MarkerOptions allows you to set a custom image for a marker?
A. icon
B. picture
C. markerImage
D. image
Ans: A
What zoom level displays a map of the Earth fully zoomed out?
A. 0
B. 5
C. 20
D. 10
Ans: A
Which property of the DOM enables you to detect iPhone and Android devices?
A. navigator.userAgent
B. device.deviceType
C. navigator.mobile
D. navigator.deviceTyp
Ans: A
Which of the following is not a type of place search that can be performed with the Places Service?
A. Text
B. Multilevel
C. Nearby
D. Radar
Ans: B
How would you load the data contained in a KML file onto google map?
A. map.loadKml(stringUrl);
B. (none of these)
C. new KmlLayer({url:stringUrl, map:map});
D. map.addKml(stringUrl);
Ans: C
What class can be used to create custom overlays?
A. object
B. OverlayView
C. Marker
D. Overlay
Ans: B
If you create a marker but do not specify its map in the marker options, you can specify the map later by using this syntax:
A. marker.setMap(map)
B. map.setMarker(marker)
C. marker.setMarker(map)
D. map.markerOptions(marker)
Ans: A
When set to true, the draggable property of the DirectionsRenderer class enables a user to:
A. Drag the map to a new center point.
B. Drag the Directions control to a new location.
C. Alter a route by dragging the polyline for the route path.
D. Drag a marker to a new location.
Ans: C
Which class is used to draw an overlay of connected line segments?
A. Drawline
B. Polyline
C. LineOverlay
D. Polygon
Ans: B
Which of the following will call the testFunction function when the div named testDiv is clicked?
A. google.maps.event.addDomListener(testDiv, ‘click’, testFunction);
B. (none of these)
C. google.maps.event.addListener(testDiv, ‘click’, testFunction);
D. google.maps.onClick(testDiv, testFunction);
Ans: A
What is the maximum number of waypoints allowed in a non-business directions request?
A. 12
B. 4
C. 16
D. 8
Ans: D
Which of the following events are fired after the zoom has changed on the map?
A. bounds_changed
B. changed
C. center_changed
D. resize
Ans: A
How would you remove a marker from a map?
A. map.remove(marker);
B. marker.setVisible(false);
C. marker.setMap(null);
D. marker.destroy();
Ans: C
How would you resize the map after its containing element has been resized?
A. google.maps.event.trigger(map, ‘resize’);
B. map.setSize(newSize);
C. map.resize();
D. google.maps.event.trigger(map, ‘resizeMap’);
Ans: A
What property of MarkerOptions defines the rollover text for a marker?
A. markerText
B. rolloverText
C. toolTip
D. title
Ans: D
Which class is used to display the results of a directions query?
A. DirectionsRenderer
B. DirectionsRequest
C. DirectionsResult
D. DirectionsDisplay
Ans: A
Which object should you use to specify that you want to add controls to a map?
A. MapOptions
B. AddControls
C. ControlOptions
D. MapControls
Ans: A
Which of the following is not one of the additional libraries that you can load into a JavaScript Google Maps API application?
A. weather
B. adsense
C. geometry
D. topography
Ans: D
Which function will animate the map to a newly defined center point, provided the change is less than both the width and height of the map?
A. setCenter
B. setZoom
C. panToBounds
D. panTo
Ans: D
What class allows users to draw overlays on the map themselves?
A. OverlayControl
B. OverlayManager
C. DrawingManager
D. DrawingLibrary
Ans: C
Which of the following is not a valid ControlPosition?
A. Center_Bottom
B. Right_Center
C. Top_Right
D. Bottom_Center
Ans: A
What function returns a LatLng based on a pixel position?
A. getPositionOf
B. fromDivPixelToLatLng
C. fromPointToLatLng
D. fromPixelToLatLng
Ans: B
Which map pane should you add an OverlayView to if you want it to respond to click events?
A. overlayImage
B. overlayMouseTarget
C. mapPane
D. overlayLayer
Ans: B
True or False: Direction results from Toronto, Ontario to Milwaukee, Wisconsin will be displayed in miles by default.
A. False
B. True
Ans: A
True or False: MVC state changes pass arguments in their events.
A. True
B. False
Ans: B
What RectangleOptions property allows a rectangle to be resized by the user?
A. editable
B. clickable
C. resizable
D. draggable
Ans: A
How would you add a custom control to a map?
A. map.controls[ControlPosition].push(customControl);
B. map.controls[ControlPosition].add(customControl);
C. map.addControl(customControl, ControlPosition);
D. map.controls.add(customControl, ControlPosition);
Ans: A
Which class is used to create a new map type and apply styles to it?
A. MapType
B. MapTypeControlOptions
C. MapTypeStyler
D. StyledMapType
Ans: D
How can a marker be places so that it is certain to be placed above any other existing markers?
A. marker.setZIndex(google.maps.Marker.MAX_ZINDEX + 1);
B. marker.setZIndex(999);
C. map.addMarker(marker, google.maps.Marker.MAX_ZINDEX + 1);
D. marker.bringToFront();
Ans: A
What object represents a set of x, y coordinates on the map?
A. pixel
B. LatLngBounds
C. position
D. point
Ans: D
In what method of an OverlayView would you initialize html elements to be added to the map?
A. setMap
B. draw
C. onAdd
D. add
Ans: C
Which object is the most atomic unit of the route returned in response to a directions request?
A. DirectionRoute
B. DirectionStep
C. DirectionLeg
D. DirectionResult
Ans: B
How do you extend a LatLngBounds object to contain another LatLngBounds object?
A. latLngBounds.add(otherLatLngBounds);
B. latLngBounds.union(otherLatLngBounds);
C. (all of these will work)
D. latLngBounds.expand(otherLatLngBounds);
Ans: B
What method of an OverlayView would the overlay’s html elements be in?
A. add
B. onAdd
C. setMap
D. draw
Ans: D
How would you call the function testFunction only the first time the map is loaded?
A. google.maps.event.addListenerOnce(map, ‘idle’, testFunction);
B. google.maps.event.addListenerOnce(map, ‘load’, testFunction);
C. google.maps.event.addListener(map, ‘load’, testFunction);
D. google.maps.event.addListener(map, ‘idle’, testFunction);
Ans: A