HTML Questions and Answers Part-27

1. What does showPosition() returns?
a) only latitude
b) only longitude
c) both latitude and longitude
d) direction

Answer: c
Explanation: showPosition() method returns both latitude and longitude of user. Syntax is navigator.geolocation.getCurrentPosition(showPosition); The value of latitude and longitude returned will be in decimal.

2. What does getCurrentPosition() returns?
a) latitude
b) longitude
c) direction
d) coordinates

Answer: d
Explanation: Coordinates of object is return by getCurrentPosition() method. getCurrentPosition() function accepts three parameters i.e. success, position and error. When data is fetched successfully success callback will be invoked. Lagitude, longitude, direction etc are the properties to be returned.

3. Which of the following technique is not for the mobile browser to identify the location of a user?
a) GPS
b) IP based position
c) WIFI based position
d) A-GPS

Answer: b
Explanation: Geolocation API uses the various techniques to identify the location of a user. In desktop browser uses IP bases position technique or WIFI. Mobile browser uses A-GPS, WIFI based position or GPS.

4. Success callback function evoke only when ___________
a) user accepts to share location information
b) always evoke
c) gps is accessible
d) only by mobile browser

Answer: a
Explanation: There is a privacy for sharing of user’s location and the callback function is evoke only when a user accepts to share his location. Its input parameter is a position of the object. If this function fails then error callback function will be evoked.

5. What timestamp property denotes?
a) time at which WIFI is used
b) the time at which data of the location is retrieved
c) the time at which callback function is evoked
d) current time

Answer: b
Explanation: The time at which data of the location is retrieved denoted by timestamp property. This also provides the date. Timestamp is a read-only property.

6. Which of the following is not the property of the ‘cords’ object?
a) Accuracy
b) Altitude
c) AltitudeAccuracy
d) enableHighAccuracy

Answer: d
Explanation: cords object has properties like Latitude, longitude, altitude, accuracy, AltitudeAccuracy, speed, heading. Cords.speed defines speed in meters per second. Cords.heading defines degrees clockwise from North.

7. Which parameter gives an accuracy of longitude and latitude?
a) Accuracy
b) AltitudeAccuracy
c) enableHighAccuracy
d) Extra accuracy

Answer: a
Explanation: Accuracy of latitude and longitude coordinates is given by ‘accuracy’. It is in meters. Cords.altitudeAccuracy gives altitude accuracy of the position of the object. enableHighAccuracy is a Boolean variable which gives the most accurate position.

8. Which of the following property does not has always a return?
a) coords.longitude
b) coords.latitude
c) coords.accuracy
d) coords.altitude

Answer: d
Explanation: coords.latitude is the latitude in decimal number, coords.longitude is the value of longitude in decimal number, coords.altitude returns the value above mean sea level in meters if and only is return is available there.

9. Which property is like the GPS in car?
a) watchPosition()
b) clearWatch()
c) getCurrentPosition()
d) showPosition()

Answer: a
Explanation: Current position of the user is returned by watchPosition(). It update the position os th user as the user moves just like the GPS installed in a car. WatchPosition() method is stopped by clearWatch() method. E.g. if(navigator.geolocation){navigator.watchPosition(showPosition);}

10. Which is not the case of invoking for error callback function?
a) user denies to share the information of a location
b) location information is unavailable
c) request timed out
d) when we are using WIFI

Answer: d
Explanation: Error callback function takes the Position Error object as its input parameter. The function is invoked by an unknown error occurred or if the user has denied sharing the information of the location or if the request timed out or if location information is unavailable.