Skip to main content

Fundamentals of Front End Development MCQs with Answers

Practice important Fundamentals of Front End Development MCQs with answers and explanations.

Multiple Choice Questions

Q1591: How do you make an element draggable in HTML5?
  • A: Set draggable="false"
  • B: Set draggable="true"
  • C: Add class "draggable"
  • D: Use JavaScript only
View Answer
B

Q1592: Which attribute specifies the data type and value of the dragged data?
  • A: ondragstart
  • B: dataTransfer.setData()
  • C: ondrop
  • D: draggable
View Answer
B

Q1593: What method must be called to allow a drop in HTML5 drag and drop?
  • A: event.preventDefault()
  • B: event.stopPropagation()
  • C: event.setData()
  • D: event.allowDrop()
View Answer
A

Q1594: What does the ondragover event specify?
  • A: Where the dragged data can be dropped
  • B: The type of data being dragged
  • C: The ID of the draggable element
  • D: The data to be set for dragging
View Answer
A

Q1595: What happens if you do not call event.preventDefault() in the ondragover event?
  • A: Dragged data can be dropped
  • B: Dragged data cannot be dropped
  • C: Dragging is disabled
  • D: The draggable element is deleted
View Answer
B

Q1596: Fill in the blank: The function ______ is called during the ondragstart event to specify what data should be dragged.
  • A: setData()
  • B: drag()
  • C: drop()
  • D: appendChild()
View Answer
B

Q1597: Fill in the blank: The method ______ retrieves the data that was set during the ondragstart event.
  • A: dataTransfer.getData()
  • B: event.preventDefault()
  • C: dataTransfer.setData()
  • D: event.stopPropagation()
View Answer
A

Q1598: Which method is used to append the dragged element to the drop target?
  • A: appendChild()
  • B: createElement()
  • C: insertBefore()
  • D: removeChild()
View Answer
A

Q1599: Fill in the blank: To handle the drop event, you need to call the ______ method to prevent default behavior.
  • A: dataTransfer.setData()
  • B: event.preventDefault()
  • C: dataTransfer.getData()
  • D: draggable.setAttribute()
View Answer
B

Q1600: What must be done to allow an element to be dropped into a target element?
  • A: Set target's draggable attribute to true
  • B: Call event.preventDefault() in ondragover
  • C: Set the drop target's data type
  • D: Add an ondrop event to the target element
View Answer
B

Test Your Knowledge

Take a timed quiz on Fundamentals of Front End Development

🚀 Start Quiz Now