JavaScript Questions & Answers – Handling Events

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Handling Events”.

1. The type that specifies what kind of event occurred is ____________
a) event type
b) even target
c) both event type and even target
d) interface
View Answer

Answer: a
Explanation: The event type is a string that specifies what kind of event occurred. The type “mousemove”, for example, means that the user moved the mouse.

2. Which is the object on which the event occurred or with which the event is associated?
a) event type
b) event target
c) both event type and even target
d) interface
View Answer

Answer: b
Explanation: The event target is the object on which the event occurred or with which the event is associated. When we speak of an event, we must specify both the type and the target. The target property of the Event interface is a reference to the object that dispatched the event.

3. In general, event handler is nothing but ____________
a) function
b) interface
c) event
d) handler
View Answer

Answer: a
Explanation: An event handler is in general, a function that handles or responds to an event. For example onclick, onkeypress, onload etc are event handler functions.
advertisement
advertisement

4. When will the browser invoke the handler?
a) Program begins
b) Any event occurs
c) Specified event occurs
d) Webpage loads
View Answer

Answer: c
Explanation: When an event of the specified type occurs on the specified target, the browser invokes the handler. For example onclick function is executed when mouse is clicked.

5. Which property specifies the property of the event?
a) Type
b) Target
c) Manner
d) Program
View Answer

Answer: a
Explanation: All event objects have a type property that specifies the event type. Event type is a string that specifies what kind of event occurred.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. The process by which the browser decides which objects to trigger event handlers on is ____________
a) Event Triggering
b) Event Listening
c) Event Handling
d) Event propagation
View Answer

Answer: d
Explanation: Event propagation is the process by which the browser decides which objects to trigger event handlers. Event propagation is a way to describe the “stack” of events that are fired in a web browser.

7. Which form of event propagation handles the registered container elements?
a) Event Propagation
b) Event Registration
c) Event Capturing
d) Default Actions
View Answer

Answer: c
Explanation: Event bubbling and capturing are two ways of event propagation in the HTML DOM API. With bubbling, the event is first captured and handled by the innermost element and then propagated to outer elements. With capturing, the event is first captured by the outermost element and propagated to the inner elements.
advertisement

8. The events that are directly tied to a specific input device are ____________
a) Device-independent input events
b) Device-dependent input events
c) User interface events
d) State change events
View Answer

Answer: b
Explanation: These are events that are directly tied to a specific input device, such as the mouse or keyboard) They include legacy event types such as “mousedown”, “mousemove”, “mouseup”, “keydown”, “keypress”, and “keyup” and also new touch specific events like “touchmove” and “gesturechange”.

9. The high-level events among the following events are ____________
a) User interface events
b) Device-independent events
c) Device-dependent events
d) Stage event change
View Answer

Answer: a
Explanation: UI events are higher-level events, often on HTML form elements that define a user interface for a web application. They include the focus event (when a text input field gains keyboard focus), the change event when the user changes the value displayed by a form element, and the submit event when the user clicks a Submit button in a form.
advertisement

10. The events that are not directly tied to a specific input device are _____________
a) User interface events
b) Device-independent events
c) Device-dependent events
d) Stage event change
View Answer

Answer: b
Explanation: These are input events that are not directly tied to a specific input device. The click event, for example, indicates that a link or button (or other document element) has been activated) This is often done via a mouse click, but it could also be done by keyboard or (on touch-sensitive devices) by gesture.

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.