WorksheetsPage 1
Total questions: 12
Worksheet time: 6mins
JavaScript events occur when:
Server loads
Browser closes
User interacts with webpage
Code is compiled
Which event occurs when a button is clicked?
onchange
onsubmit
onclick
onload
Which event triggers when input value changes and focus is lost?
onclick
onchange
onsubmit
onhover
Which event occurs when a form is submitted?
onclick
onchange
onsubmit
onfocus
Why is form validation important?
To decorate forms
To store data
To ensure correct and complete input
To increase page size
When does JavaScript validate form data?
When page loads
When server responds
When submit button is clicked
When browser closes
Which improves user experience?
Wrong data submission
No validation
Form validation
Empty fields
What is a JavaScript function?
A variable used to store data
A block of code used to perform a specific task
A data type
An HTML element
Which of the following is an example of a function expression?
function add(a, b) {}
add(a, b)
let add = function(a, b) {}
add = a + b
What is the difference between parameters and arguments?
Parameters are values, arguments are variables
Parameters are used while calling, arguments while defining
Parameters are variables in function definition, arguments are values passed
Both are the same
Which array method adds an element at the beginning of an array?
push()
pop()
shift()
unshift()
Which array method is used to remove the last element from an array in JavaScript?
push()
pop()
shift()
unshift()
