wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JS array & object

Total questions: 37

Worksheet time: 9hrs 15mins

Name
Class
Date
1.

Given: Five diggers dig 5m of a ditch in 5 hours. How many diggers will it take to dig 100m of a ditch in 100 hours?

a)

5

b)

1

c)

100

d)

10

2.

Which array methods return a new array?

a)

some

b)

map

c)

filter

d)

forEach

e)

none of the above

3.

Which of the array methods will remove and return the first element of the array?

a)

pop

b)

push

c)

shift

d)

unshift

e)

none of the above

4.

Which of the array methods will remove and return the last element of the array?

a)

pop

b)

push

c)

shift

d)

unshift

e)

none of the above

5.

Which of the array methods or properties will return the length of the new/existing array?

a)

pop

b)

push

c)

length

d)

unshift

e)

none of the above

6.

Which array methods pass 4 arguments to the callback function?

a)

reduce

b)

map

c)

reduceRight

d)

forEach

e)

none of the above

7.

What will the 'fill' method return? [1, 2, 3, 4, 5, 6].fill(0, 2, 3)\left[1,\ 2,\ 3,\ 4,\ 5,\ 6\right].fill\left(0,\ 2,\ 3\right)  

a)

[0, 2, 3, 0, 2, 3]

b)

[1, 2, 0, 4, 5, 6]

c)

[1, 2, 0, 1, 2, 0]

d)

[4, 5, 5, 1, 2, 3]

8.

If the second argument in the reduce method is not specified, then?

a)

will display an ReferenceError: 'argument' is not defined

b)

will display a SyntaxError: 'x' is a reserved identifier

c)

will display the first element of the array as an initial accumulator

d)

will take 'undefined' as the initial accumulator

e)

return 'undefined' as a function result

9.

Which array methods will return a string as a result?

a)

slice()

b)

toString()

c)

join('')

d)

splice()

e)

concat()

10.

Which array methods will return a boolean as a result?

a)

every()

b)

some()

c)

indexOf()

d)

includes()

e)

copyWithin()

11.

Which method can be used to create a new array?

a)

of()

b)

reverse()

c)

find()

d)

from()

e)

sort()

12.

Which array methods will return the cell value if the condition is met?

a)

of()

b)

includes()

c)

find()

d)

indexOf()

e)

lastIndexOf()

13.

Which array methods will return the position of the cell if the condition is met?

a)

of()

b)

lastIndexOf()

c)

find()

d)

indexOf()

e)

includes()

14.

Which array methods modify the original array?

a)

slice()

b)

splice()

c)

reverse()

d)

some()

e)

pop()

15.

You can check whether an array (consisting of strings) contains a given string using the following method?

a)

findIndex()

b)

lastIndexOf()

c)

includes()

d)

find()

e)

indexOf()

16.

Which array methods return a new array with all the elements that satisfy the callback condition?

a)

findIndex()

b)

every()

c)

filter()

d)

find()

e)

forEach()

17.

What will it return? [1,2,3,4,5,6].slice(2,3)[1,2,3,4,5,6].slice\left(2,3\right)  

a)

3

b)

['3']

c)

[2, 3]

d)

[2, 3, 2, 3, 2, 3]

e)

[3]

18.

What will return console.log?

a)

{"name": "John", "visits": true, "isAdmin": true}

b)

{"name": "John", "visits": true, "isAdmin": false}

c)

{"isAdmin": true}

d)

{"name": "John"}

19.

Which methods will return an array?

a)

Object.valueOf()

b)

Object.entries()

c)

Object.keys()

d)

Object.values()

20.

Which methods set property descriptors?

a)

Object.is()

b)

Object.freeze()

c)

Object.defineProperty()

d)

Object.hasOwnProperty()

e)

Object.getOwnPropertyDescriptors()

21.

What descriptors can be defined or modified properties of an object?

a)

configurable

b)

enumerable

c)

value

d)

writable

e)

readable

22.

Number in JS as a default stored in:

a)

64bits

b)

32bits

c)

16bits

d)

8bits

23.

Which of the items will display [object Object], if const obj = {} ?

a)

console.log(obj.valueOf())

b)

console.log(obj.toString())

c)

console.log(obj.toLocaleString())

d)

console.log(obj.isPrototypeOf())

24.

What will the code below output to the console? let result = "ten" × 2; console.log(result == NaN)let\ result\ =\ "ten"\ \times\ 2;\ console.\log\left(result\ ==\ NaN\right)  

a)

true

b)

false

c)

null

d)

undefined

25.

What will the below code output to the console? let arr1=new Array(3); console.log(arr1[0]);let\ arr1=new\ Array(3);\ console.\log(arr1[0]);  

a)

true

b)

"3"

c)

null

d)

undefined

e)

3

26.

What will the code below output to the console?

a)

true

b)

false

c)

null

d)

undefined

e)

NaN

27.

What will the code below output to the console?

a)

1

b)

5

c)

6

d)

20

e)

Uncaught ReferenceError: obj is not defined

28.

What will the code below output to the console?

a)

true

b)

false

c)

undefined

d)

"global"

e)

Uncaught ReferenceError: globalVar is not defined

29.

What will the code below output to the console?

a)

"52"

b)

52

c)

7

d)

5undefined

e)

Uncaught ReferenceError: j is not defined

30.

What will the code below output to the console?

a)

true

b)

false

c)

null

d)

undefined

e)

Uncaught ReferenceError: obj is not defined

31.

What will console.log output?

a)

"257"

b)

14

c)

7

d)

3

e)

Uncaught ReferenceError: x is not defined

32.

What will the code below output to the console?

a)

true

b)

false

c)

null

d)

undefined

e)

Uncaught ReferenceError: test2 is not defined

33.

What will the code below output to the console?

a)

10

b)

10undefind

c)

19

d)

undefindundefind

e)

Uncaught ReferenceError: j is not defined

34.

What will the code below output to the console?

a)

6

b)

undefindundefind

c)

42

d)

24

e)

Uncaught ReferenceError: answer is not defined

35.

What will the code below output to the console?

a)

6 5

b)

5 5

c)

undefined 5

d)

Uncaught TypeError: mers.currentGear is not a function

36.

What will the code below output to the console?

a)

Bruce Wayne Bruce Wayne

b)

Bruce Wayne Clark Kent

37.

Which methods make the object unavailable?

a)

Object.is()

b)

Object.freeze()

c)

Object.defineProperty()

d)

Object.hasOwnProperty()

e)

Object.getOwnPropertyDescriptors()