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
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
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
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.
4. When will the browser invoke the handler?
a) Program begins
b) Any event occurs
c) Specified event occurs
d) Webpage loads
View Answer
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
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.
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
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
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.
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
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
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.
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
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.
- Practice MCA MCQs
- Check Programming Books
- Practice Information Science MCQs
- Apply for Computer Science Internship
- Practice Programming MCQs