wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

JavaScript Certification Quiz

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which keyword is used for debugging in JavaScript?

a)

warn

b)

error

c)

debugger

d)

log

2.

What is the purpose of the 'typeof' operator in JavaScript?

a)

To concatenate two strings

b)

To check if a variable is defined

c)

To determine the data type of a variable or constant

d)

To convert a string to a number

3.

Which operator is used for exponentiation in JavaScript?

a)

^

b)

**

c)

*

d)

/

4.

What will be the output of the following code snippet?

a)

6.28

b)

6

c)

3.14

d)

NaN

5.

Which method is used to add a new element to the end of an array in JavaScript?

a)

append

b)

insert

c)

push

d)

add

6.

What is the purpose of the 'Math.random()' function in JavaScript?

a)

To generate a random number between 0 and 1

b)

To find the square root of a number

c)

To calculate the absolute value of a number

d)

To round a number to the nearest integer

7.

Which event is triggered when a user clicks on an HTML element?

a)

onhover

b)

onmove

c)

onclick

d)

onpress

8.

What does the 'onsubmit' event represent in HTML forms?

a)

Event when the form is focused

b)

Event when the form is submitted

c)

Event when the form is reset

d)

Event when the form is loaded

9.

How can you handle exceptions in JavaScript?

a)

catch/throw

b)

try/except

c)

try/catch

d)

throw/finally

10.

Which method is used to locate an HTML element by its ID in JavaScript?

a)

getElementByName

b)

getElementById

c)

getElementByClass

d)

getElementByTag

11.

What is the purpose of the 'eval()' function in JavaScript?

a)

To find the square root of a number

b)

To evaluate a mathematical expression

c)

To convert a string to a number

d)

To round a number to the nearest integer

12.

Which operator is used to check if two values are equal in JavaScript?

a)

===

b)

!=

c)

==

d)

!==

13.

What is the correct way to declare a variable in JavaScript according ECMASCRIPT6?

a)

let x

b)

int x

c)

var x

d)

variable x

14.

Which method is used to create a new HTML element in JavaScript?

a)

addNode

b)

appendElement

c)

createElement

d)

createNode

15.

What is the purpose of the 'onchange' event in HTML forms?

a)

Event when the form value is changed

b)

Event when the form is submitted

c)

Event when the form is reset

d)

Event when the form is loaded

16.

What will be the output of the following code snippet?

a)

true

b)

false

c)

undefined

d)

NaN

17.

What will be the output of the following code snippet?

a)

mango

2

b)

mango

3

c)

apple

2

d)

apple

3

18.

What will be the output of the following code snippet?

a)

1

b)

2

c)

3

d)

undefined

19.

What will be the output of the following code snippet?

a)

10

b)

15

c)

5

d)

20

20.

What will be the output of the following code snippet?

a)

null

b)

object

c)

undefined

d)

number

21.

What will be the output of the following code snippet?

a)

[1, 2, 4, 5]

b)

[1, 2, 3, 5]

c)

[1, 2, 3, 4, 5]

d)

[1, 2, 4, 5, 6]

22.

What will be the output of the following code snippet?

a)

undefined

b)

null

c)

Hello

d)

test

23.

What will be the output of the following code snippet?

a)

array

b)

object

c)

undefined

d)

null

24.

What will be the output of the following code snippet?

a)

5.67

b)

5.68

c)

5.6789

d)

5.679

25.

What will be the output of the following code snippet?

a)

123

b)

NaN

c)

123abc

d)

undefined