wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Introduction to JavaScript

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

Which of the following is not a number data type in JavaScript?

a)

-50

b)

20.04

c)

-1292.38101

d)

"123"

2.

How do comments look like in JavaScript?

a)

//

b)

@@

c)

&&

d)

**

3.

Can you change the value of a const?

a)

Yes

b)

No

4.

How many options can a boolean variable have?

a)

1

b)

2

c)

3

d)

4

5.

Can variables change their type in JavaScript?

a)

Yes

b)

No

6.

Which of the following is an invalid string?

a)

"Hello"

b)

`Hello`

c)

"Hello'

d)

'Hello'

7.

What is the index of the letter G in 'VIBGYOR'?

a)

1

b)

2

c)

3

d)

4

8.

Which string method makes text uppercase in JavaScript?

a)

.toUpperCase()

b)

.TOUPPERCASE()

c)

.UpperCase()

d)

.ToUpperCase()

9.

What does the string method .trim() do?

a)

Removes all text

b)

Removes all whitespace

c)

Removes a specific part of the text

d)

Replaces whitespaces

10.

What is the output of "Hello".indexOf('l')

a)

3

b)

4

c)

-1

d)

2

11.

Maximum number of arguments String.slice() method can take in JS?

a)

3

b)

2

c)

1

d)

0

12.

Select the output for 100 + "Hello"

a)

"100Hello"

b)

Error

c)

"100 Hello"

d)

"100+Hello"

13.

Select the output for Hello World + 100

a)

Error

b)

"Hello World100"

c)

"Hello World 100"

d)

"HelloWorld100"

14.

Which of the following is a template literal string?

a)

`Hello`

b)

"Hello"

c)

'Hello'

d)

"${Hello}"

15.

What is the output for: `You bought ${qty} apples` if qty = 5?

a)

"You bought ${qty} apples"

b)

"You bought 5 apples"

c)

Error

d)

"You bought apples"

16.

What is a null variable?

a)

Unknown variable

b)

Variable assigned a value of null

c)

Variable without a name

d)

Variable without a data type

17.

What is an undefined variable?

a)

Variable without a value

b)

Variable assigned a value of null

c)

Variable without a name

d)

Variable without a data type

18.

What is the value of Math.pow(4,6)?

a)

1024

b)

2048

c)

4096

d)

24

19.

Which of the following is a Math.random() output?

a)

0.6625590695007806

b)

1

c)

1.5590695007806

d)

All of the above

20.

What is the output of parseInt('Carat 24 Diamond')?

a)

24

b)

"Carat 24 Diamond"

c)

"24"

d)

NaN