477). When are the keyboard events fired?
[A]When the user manually calls the button
[B]When the user clicks a key
[C]When the user calls the modifier
[D]When the user right clicks the mouse
Show Answer
Correct Answer: When the user clicks a key
Notes:
Answer: b
Explanation: The keydown and keyup are the keyboard events are fired when the user presses or releases a key on the keyboard. They are generated for modifier keys, function keys, and alphanumeric keys.
478). How does a user generate multiple keydown events?
[A]Repeating the same process
[B]Pressing multiple keys
[C]Pressing the key longer than usual
[D] Pressing the key multiple times
Show Answer
Correct Answer: Pressing the key longer than usual
Notes:
Answer: c
Explanation: If the user holds the key down long enough for it to begin repeating, there will be multiple keydown events before the keyup event arrives. Pressing the key for long time results in multiple calls to the function onkeypress.
479). Which property is used to specify the key type when pressed?
[A]keyCode
[B]keyType
[C]keyName
[D]keyProperty
Show Answer
Correct Answer: keyCode
Notes:
Answer: a
Explanation: The keyCode property returns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup event. The event object associated with these events has a numeric keyCode property that specifies which key was pressed.
480). For what value does the keyCode property persists even when a Shift key is pressed for adding punctuation character.
[A]Special characters
[B]Alphabets
[C]Alphanumeric
[D]Digits
Show Answer
Correct Answer: Digits
Notes:
Answer: d
Explanation: The number keys always generate keyCode values for the digit that appears on the key, even if you are holding down Shift in order to type a punctuation character.
481). Which of the following are not key event properties?
[A]Code key
[B]Alt Key
[C]Ctrl Key
[D]Shift Key
Show Answer
Correct Answer: Code key
Notes:
Answer: a
Explanation: altKey, ctrlKeY, shiftKey, and metaKey are key event object’s properties, which are set to true if the corresponding modifier key is held down when the event occurs. The keyCode values of ShiftKey, ctrlKey, altKey are respectively 16, 17 and 18.