Which event is triggered when a web page finishes loading?
A). A. onload
B). B. onsubmit
C). C. onmouseover
D). D. onclick
What is the purpose of parameters in a JavaScript function?
A). A. To return a value from the function
B). B. To define the function's name
C). C. To store variables within the function
D). D. To accept inputs into the function
What is the primary purpose of JavaScript functions?
A). A. To style web pages
B). B. To provide structure to HTML elements
C). C. To create reusable code blocks
D). D. To define CSS styles for HTML
Which event is triggered when a user clicks on an HTML element?
A). A. onhover
B). B. onsubmit
C). C. onload
D). D. onclick
How can you attach multiple event listeners to the same HTML element in JavaScript without overwriting existing ones?
A). A. By using the attachEvent() method
B). B. By using the addEventListener() method with the replace parameter
C). C. By assigning multiple functions directly to the element's event attributes (e.g., onclick, onmouseover)
D). D. By using the addEventListener() method multiple times for the same event
What is the purpose of the oninput event in HTML?
A). A. To track changes in form inputs
B). B. To detect mouse movements
C). C. To determine when an element is loaded
D). D. To handle form submissions
What is the purpose of the onclick attribute in HTML elements?
A). A. To define styles for HTML elements
B). B. To attach event listeners for mouse clicks
C). C. To insert JavaScript code directly into HTML
D). D. To create animations for HTML elements
In JavaScript, what is the purpose of the addEventListener() method?
A). A. To create inline event handlers
B). B. To attach event listeners to HTML elements
C). C. To remove event listeners from HTML elements
D). D. To bind event handlers to parent elements
Which method is used to attach an event listener to an HTML element in JavaScript?
A). A. appendEvent()
B). B. addEventListener()
C). C. attachEvent()
D). D. bindEvent()
Which method is used to remove an event listener from an HTML element in JavaScript?
A). A. removeEventListener()
B). B. detachEvent()
C). C. removeEvent()
D). D. clearEventListener()