Test Series - html

Test Number 36/72

Q: Which of the following property is common in all drag events?
A. drag effects
B. drag data
C. dataTransfer
D. dragenter
Solution: The feedback given by the user using drag and drop operation is done by drag effects. Drag data includes all the data needed for drag operation. The dataTransfer property of all drag events holds data about the drag and drop operation. When draggable element enters a drop target then dragenter event is occurred.
Q: _____________ in textboxes and selections on web pages is done automatically, so you do not need to handle dragging yourself.
A. Dragging HTML and XML
B. Dragging Text
C. Dragging Files
D. Dragging Links
Solution: Although the process is automatic, it is recommended that you always add data of the text/plain type as a fallback for applications or drop targets that do not support other types, unless there is no logical text alternative. Always add the plain text type last as it is the least specific.
Q: Calling the ______________ method during both a dragenter and dragover event will indicate that a drop is allowed at that location.
A. drop
B. drag
C. preventDefault
D. dataTransfer
Solution: The drop event is fired on the element where the drop occurred at the end of the drag operation. When element is being dragged, drag event has happened. Calling the preventDefault method during both a dragenter and dragover event will indicate that a drop is allowed at that location. However, you will commonly wish to call the preventDefault method only in certain situations, for example, only if a link is being dragged. The dataTransfer property of all drag events holds data about the drag and drop operation.
Q: Which of the following property is used to determine which drag operation was desired?
A. dragend
B. getData
C. dropEffect
D. captureData
Solution: When the user finishes dragging an element, dragend is occurred. During the drop event, you should retrieve that data that was dropped from the event and insert it at the drop location. One can use the dropEffect property to determine which drag operation was desired.
Q: ______________ should include data of two types; the first should be the URL using the type text/uri-list, and the second is the URL using the text/plain type.
A. Dragging HTML and XML
B. Dragging Text
C. Dragging Files
D. Dragging Links
Solution: Dragging Links should include data of two types; the first should be the URL using the type text/uri-list, and the second is the URL using the text/plain type.
Q: A listener for the dragenter and dragover events are used to indicate valid drop targets, that is, places where dragged items may be dropped.
A. True
B. False
C. 0
D. .
Solution: The dragover event is fired as the mouse is moving over an element when a drag is occurring. Much of the time, the operation that occurs during a listener will be the same as the dragenter event. When draggable element enters a drop target then dragenter event is occurred.
Q: _____________ and elements in a document may be dragged using the application/x-moz-node type.
A. Dragging HTML and XML
B. Dragging Text
C. Dragging Nodes
D. Dragging Links
Solution: Dragging Nodes and elements in a document may be dragged using the application/x-moz-node type.
Q: Which method is used to get user’s position?
A. getCurrentPosition()
B. getDirectPosition()
C. post()
D. getDirection
Solution: For getting user’s position we used getCurrentPosition() method. Syntax is navigator.geolocation.getCurrentPosition(showPosition). It is supported by most of the browsers like Chrome, Firefox, Internet Explorer, Opera etc.
Q: What does showPosition() returns?
A. only latitude
B. only longitude
C. both latitude and longitude
D. direction
Solution: 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.
Q: What does getCurrentPosition() returns?
A. latitude
B. longitude
C. direction
D. coordinates
Solution: 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.

You Have Score    /10