Solved MCQ on Handling Events in Client Side JavaScript set-8

1) ........... include legacy event types such as "mousedown", "mousemove", "mouseup", "keydown", "keypress","keyup","touchmove" and "gesturechange" events.

A. Device dependent input events

B. Device independent input events

C. User interface events

D. State change events


2) ............ are not triggered directly by user activity, but by network or browser activity, and indicate some kind of lifecycle.

A. Device dependent input events

B. Device independent input events

C. User interface events

D. State change events


3) ............ include the focus event, the change event when the user changes the value and the submit event when the user clicks a submit button.

A. Device dependent input events

B. Device independent input events

C. User interface events

D. State change events


4) ........... allows the same event handler function to be registered more than once. When an event of the specified type occurs, the registered function will be invoked as many times as it was registered.

A. addEvent()

B. addMultipltEvent()

C. attachEvent()

D. reattachEvent()


5) Which of the following statements about the arguments of addEventListener() is/are True.

i) The first argument to addEventListener() is the event type for which the handler is being registered.

ii) The second argument to addEventListener() is the function that should be invoked when the specified type of event occurs.

iii) The third argument to addEventListener() is a numerical value.

A. i and ii only

B. i and iii only

C. ii and iii only

D. All i, ii and iii



6) When an event occurs on an object, all of the handlers registered for that type of event are invoked, in the order in which they were .........

A. occurred

B. registered

C. invoked

D. initialized


7) Invoking .......... more than once on the same object with the same arguments has no effect, the handler function remains registered only once, and repeated invocation does not alter the order in which handlers are invoked.

A. addEvent()

B. addMultipltEvent()

C. attachEvent()

D. addEventListener()


8) State which of the following statements are True or False about the rules of invocation order for event handler in JavaScript.

i) Handlers registered by setting an object property of HTML attribute, if any are always invoked first.

ii) Handlers registered with addEventListner() are invoked in the order in which they were registered.

iii) Handlers registered with attachEvent() may be invoked in any order and the code should not depend on sequential invocation.

A. i-True, ii-True, iii-False

B. i-True, ii-False, iii-False

C. i-True, ii-True, iii-True

D. i-False, ii-False, iii-True


9) .......... is universally supported also it works in all browsers including IE, and works for all handlers, regardless of how they are registered.

A. Event bubbling

B. Event handling

C. Event capturing

D. Event registering


10) ............, only works with event handlers registered with addEventListner() when the third argument is True.

A. Event bubbling

B. Event handling

C. Event capturing

D. Event registering



11) In browsers that support addEventListner(), we can also cancel the default action for an event by invoking the ........... method of the event object.

A. preventBrowsers()

B. preventDefault()

C. preventPropagation()

D. preventEvent()


12) The .............. event is fired when the document has been loaded and parsed and any deferred scripts have been executed.

A. DOMContent()

B. DOMContentLoad()

C. DOMLoaded()

D. DOMContentLoaded()


13) .......... is a user interface for transferring data between a "drag source" and "drop target" that may be in the same application or in different applications.

A. Drag-and-drop

B. User-drag-and-drop

C. Drag source-and-drop target

D. Source-drag-and-drop-target


14) Which of the following statements are True about the APIs for Implementing Drag-and-drop.

i) They have to tie into the underlying OS so that they can work between unrelated applications.

ii) They must provide a way for a drag source to specify the icon or image to be dragged.

iii) They must provide event-based notification to both the drag source and drop target of the progress of the Drag-and-drop interaction.

A. i and ii only

B. i and iii only

C. ii and iii only

D. All i, ii and iii


15) ......... objects have altKey, ctrlKey, metaKey and shiftKey properties, which are set to True if the corresponding modifier key is held down when the event occurs.

A. Key down

B. Key event

C. Key up

D. Key press

Answers


1) A. Device dependent input events
2) D. State change events
3) C. User interface events
4) C. attachEvent()
5) A. i and ii only
6) B. registered
7) D. addEventListener()
8) C. i-True, ii-True, iii-True
9) A. Event bubbling
10) C. Event capturing
11) B. preventDefault()
12) D. DOMContentLoaded()
13) A. Drag-and-drop
14) D. All i, ii and iii
15) B. Key event

For more Multiple Choice Questions (MCQs): Click Here