Q. Which of the following property specifies the string of text that was entered?

  • (A) message
  • (B) data
  • (C) string
  • (D) text
πŸ’¬ Discuss
βœ… Correct Answer: (B) data
Explanation: A textinput event handler has a data property that specifies the string of text that was entered.

Q. Which of the following is defined by the specification?

  • (A) dataMethod
  • (B) input
  • (C) inputMethod
  • (D) inputdataMethod
πŸ’¬ Discuss
βœ… Correct Answer: (C) inputMethod
Explanation: The specification defines an inputMethod property on the event object and a set of constants representing different kinds of text input (keyboard, paste or drop, handwriting or voice recognition, and so on).

Q. Which two events will have the generated text for key events?

  • (A) key and char
  • (B) char and text
  • (C) text and key
  • (D) key and value
πŸ’¬ Discuss
βœ… Correct Answer: (A) key and char
Explanation: For key events that generate printable characters, key and char will be equal to the generated text.

Q. Which of the following are the drag and drop events?

  • (A) drop
  • (B) dragstart
  • (C) both drop and dragstart
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) both drop and dragstart
Explanation: The API defines the following seven event types :

Q. Which property holds a DataTransfer object that contains information about the data being transferred and the formats in whichh it is available?

  • (A) dataTransfer
  • (B) transferData
  • (C) dataExchange
  • (D) exchangeData
πŸ’¬ Discuss
βœ… Correct Answer: (A) dataTransfer
Explanation: The property, dataTransfer, holds a DataTransfer object that contains information about the data being transferred and the formats in which it is available.

Q. Which API allows scripts in a document from one server to exchange messages with scripts?

  • (A) Cross-Document Messaging API
  • (B) Web application API
  • (C) Both Cross-Document Messaging API & Web application API
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) Cross-Document Messaging API
Explanation: The Cross-Document Messaging API allows scripts in a document from one server to exchange messages with scripts in a document from another server. This works around the limitations of the same-origin policy in a secure way. Each message that is sent triggers a message event on the Window of the receiving document.

Q. When are the mouse events generated?

  • (A) When user clicks the mouse over a document
  • (B) When user moves over a document
  • (C) All of the mentioned
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) When user clicks the mouse over a document
Explanation: Mouse events are generated when the user moves or clicks the mouse over a document. These events are triggered on the most deeply nested element that the mouse pointer is over, but they bubble up through the document.

Q. The properties that specify the position and button state of the mouse are

  • (A) clientX and clientY
  • (B) clientY and clientX
  • (C) altKey and ctrlKey
  • (D) metaKey and shiftKey
πŸ’¬ Discuss
βœ… Correct Answer: (A) clientX and clientY
Explanation: The clientX and clientY properties specify the position of the mouse in window coordinates.

Q. Which of the following keys are set to true when the keyboard modifier keys are held down?

  • (A) altKey
  • (B) ctrlKey
  • (C) metaKey
  • (D) all of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (D) all of the mentioned
Explanation: The altKey, ctrlKey, metaKey, and shiftKey properties are set to true when the corresponding keyboard modifier keys are held down.

Q. How to detect and respond to mouse drags?

  • (A) Registering a mouseover handler
  • (B) Releasing a mousedown handler
  • (C) Registering a mousedown handler
  • (D) None of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (C) Registering a mousedown handler
Explanation: By registering a mousedown handler that registers a mousemove handler, you can detect and respond to mouse drags. Doing this properly involves being able to capture mouse events so that you continue to receive mousemove events even when the mouse has moved out of the element it started in.