wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Module 3 [Function & Arrays]

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

Output ?

a)

5

b)

10

c)

15

d)

Error

2.

Output ?

a)

10

b)

20

c)

Undefined

d)

Error

3.

Output ?

a)

[2,4,6]

b)

[4,4,4]

c)

[4,4,3]

d)

Error

4.

Output ?

a)

[2]

b)

[2,3]

c)

[1,2]

d)

Error

5.

Output ?

a)

5

b)

10

c)

15

d)

error

6.

Output ?

a)

10

b)

undefined

c)

no value

d)

Error

7.

What happens here ?

a)

[2,4,6]

b)

[1,2,3]

c)

undefined
(forEach returns undefined)

d)

Error

8.

Output ?

a)

[2,3,4]

b)

[1,2,3]

c)

undefined

d)

Error

9.
a)

[10, 15]

b)

[20, 25]

c)

25

d)

error

10.

Extremely tricky closure output:

a)

0 1 2

b)

3 3 3

c)

undefined undefined undefined

d)

Error

11.

Deep destructuring trap:

a)

30

b)

40

c)

undefined

d)

Error

12.

Changing reference in recursion:

a)

[6,4,2], [1,2,3]

b)

[6,4,2], []

c)

[1,2,3], []

d)

Error

13.

JSON parse/stringify trap:

a)

{"a":1,"b":null}

b)

{"a":1}

c)

{"a":1,"b":undefined,"c":{}}

d)

Error

14.

THIS binding confusion:

a)

20

b)

undefined

c)

Error

d)

Null

15.

Arrow vs normal function THIS trap:

a)

50

b)

undefined

c)

this.x

d)

Error

16.

Mutating nested objects with spread:

a)

1

b)

100

c)

undefined

d)

Error

17.

Reduce with no initial value:

a)

5

b)

undefined

c)

Error

d)

NaN

18.

typeof + null weird behavior

a)

null

b)

object

c)

undefined

d)

Error

19.

Map with key reference comparison

a)

hello

b)

undefined

c)

{}

d)

Error

20.

Function + Default Parameter Trap

a)

5

b)

10

c)

15

d)

Error

21.

Arrow Function THIS Binding

a)

10

b)

undefined

c)

Error

d)

null

22.

Optional Parameter + Falsy Trap

a)

20

b)

10

c)

0

d)

Error

23.

Rest Parameters + Reduce

a)

5

b)

0

c)

undefined

d)

Error

24.

Recursive Function Mutation

a)

[3,6,9], []

b)

[9,6,3], []

c)

[9,6,3], [1,2,3]

d)

Error

25.

forEach Return Trap

a)

[2,4,6]

b)

undefined

c)

[1,2,3]

d)

Error

26.

Complex Filter + Map

a)

[4,12]

b)

[4,8]

c)

[8,16]

d)

[4,8,12,16]

27.

Nested Object Shallow Copy

a)

1

b)

100

c)

undefined

d)

Error

28.

JSON.stringify Drop Values

a)

{"a":1,"b":null}

b)

{"a":1}

c)

{"a":1,"b":undefined,"c":"function"}

d)

{}

29.

Array Reduce Without Initial

a)

-40

b)

0

c)

-20

d)

-10

30.

Complex Destructuring

a)

20

b)

30

c)

undefined

d)

Error

31.

Map with Undefined Callback

a)

[1,2,3]

b)

[undefined,2,3]

c)

[2,3]

d)

Error

32.

JSON.parse Nested

a)

10

b)

"10"

c)

Undefined

d)

Error

33.

Optional Chaining

a)

5

b)

no

c)

undefined

d)

error

34.

Hoisting + Function Overwrite

a)

1

b)

2

c)

error

d)

Undefined

35.

Arrow Function + This Binding

a)

50

b)

20

c)

undefined

d)

error

36.

Default Parameter + Undefined Trap

a)

5

b)

10

c)

20

d)

15

37.

Optional Parameter + Falsy Condition

a)

20

b)

10

c)

0

d)

Error

38.

Rest Parameter + Reduce Edge Case

a)

0

b)

7

c)

undefined

d)

Error

39.

Recursive Function Mutates Original Array

a)

[2,4,6], [1,2,3]

b)

[6,4,2], []

c)

[6,4,2], [1,2,3]

d)

Error

40.

forEach Return Behavior

a)

[2,4,6]

b)

undefined

c)

[]

d)

Error

41.

Complex Filter + Map Sequence

a)

[5,15]

b)

[5,10,15,20]

c)

[1,3]

d)

[10,20]

42.

JSON.stringify Removes Keys

a)

{"a":1}

b)

{"a":1,"b":null}

c)

{"a":1,"c":"function"}

d)

Error

43.

Destructuring With Nested Object

a)

5

b)

10

c)

50

d)

Error

44.

Reduce Without Initial Value

a)

2

b)

1

c)

4

d)

0.5

45.

Map Logic With Missing Return

a)

[1,2,3]

b)

[undefined,2,3]

c)

[2,3]

d)

Error

46.

Spread Operator Is Shallow

a)

10

b)

200

c)

undefined

d)

Error

47.

Optional Chaining + Nullish Coalescing

a)

7

b)

undefined

c)

no value

d)

Error

48.

Function Overwriting Due to Hoisting

a)

A

b)

B

c)

Error

d)

undefined

49.

Functions + Default Parameter + Undefined Trap

a)

5 + 20 + 10 = 35

b)

5 + 20 + 5 = 30

c)

5 + undefined + undefined

d)

Error

50.

map + filter + mutation + side effect trap

a)

[2,4,6,8], [6,12]

b)

[2,4,6,8], [6,14]

c)

[2,4,6,8], [8,14]

d)

Error