wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Page 1

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is a function in JavaScript?

a)

A data type

b)

A loop

c)

A block of code used to perform a specific task

d)

A variable

2.

Which keyword is used to declare a function?

a)

var

b)

let

c)

function

d)

define

3.

What is a function expression?

a)

A function without name

b)

A function stored in a variable

c)

A function inside an object

d)

A function with parameters

4.

What are parameters in a function?

a)

Values passed while calling a function

b)

Variables used in function definition

c)

Output of a function

d)

Keywords

5.

What does the return statement do?

a)

Stops the program

b)

Prints output

c)

Sends a value back from a function

d)

Calls another function

6.

Which symbol is used in arrow functions?

a)

=>

b)

==

c)

<=

d)

!=

7.

How are arrays created in JavaScript?

a)

Using {}

b)

Using ()

c)

Using []

d)

Using <>

8.

Array index always starts from:

a)

1

b)

-1

c)

0

d)

Any number

9.

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

a)

pop()

b)

shift()

c)

push()

d)

unshift()

10.

Which method removes the first element of an array?

a)

pop()

b)

shift()

c)

slice()

d)

splice()

11.

What does array.length return?

a)

Index number

b)

Size in bytes

c)

Total number of elements

d)

Last element

12.

Which method converts a string to uppercase?

a)

toLowerCase()

b)

upper()

c)

toUpperCase()

d)

capitalize()

13.

What does indexOf() return if the value is not found?

a)

0

b)

null

c)

-1

d)

undefined

14.

Which method checks whether a string contains a word?

a)

match()

b)

includes()

c)

search()

d)

find()

15.

How are objects created in JavaScript?

a)

Using []

b)

Using ()

c)

Using {}

d)

Using <>

16.

What are object keys called?

a)

Variables

b)

Properties

c)

Methods

d)

Values

17.

Which notation is used to access object values?

a)

Dot notation only

b)

Bracket notation only

c)

Both dot and bracket notation

d)

None

18.

Which object is used to get current date and time?

a)

Time

b)

Clock

c)

Date

d)

Calendar

19.

What does Math.random() return?

a)

Random integer

b)

Random number between 0 and 1

c)

Random number between 1 and 10

d)

Random whole number

20.

Which DOM method selects an element by ID?

a)

getElementsByClassName()

b)

getElementsByTagName()

c)

querySelector()

d)

getElementById()