wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Page 1

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.

JavaScript events occur when:

a)

Server loads

b)

Browser closes

c)

User interacts with webpage

d)

Code is compiled

2.

Which event occurs when a button is clicked?

a)

onchange

b)

onsubmit

c)

onclick

d)

onload

3.

Which event triggers when input value changes and focus is lost?

a)

onclick

b)

onchange

c)

onsubmit

d)

onhover

4.

Which event occurs when a form is submitted?

a)

onclick

b)

onchange

c)

onsubmit

d)

onfocus

5.

Why is form validation important?

a)

To decorate forms

b)

To store data

c)

To ensure correct and complete input

d)

To increase page size

6.

When does JavaScript validate form data?

a)

When page loads

b)

When server responds

c)

When submit button is clicked

d)

When browser closes

7.

Which improves user experience?

a)

Wrong data submission

b)

No validation

c)

Form validation

d)

Empty fields

8.

What is a JavaScript function?

a)

A variable used to store data

b)

A block of code used to perform a specific task

c)

A data type

d)

An HTML element

9.

Which of the following is an example of a function expression?

a)

function add(a, b) {}

b)

add(a, b)

c)

let add = function(a, b) {}

d)

add = a + b

10.

What is the difference between parameters and arguments?

a)

Parameters are values, arguments are variables

b)

Parameters are used while calling, arguments while defining

c)

Parameters are variables in function definition, arguments are values passed

d)

Both are the same

11.

Which array method adds an element at the beginning of an array?

a)

push()

b)

pop()

c)

shift()

d)

unshift()

12.

Which array method is used to remove the last element from an array in JavaScript?

a)

push()

b)

pop()

c)

shift()

d)

unshift()