wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Advanced JavaScript

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Functions cannot be passed as parameters

a)

True

b)

False

2.

Callback functions are used like this

a)

True

b)

False

3.

Callback functions are more of a restriction in JS than an advantage

a)

True

b)

False

4.

Which of the following functions doesn't take a callback function as one of its parameters?

a)

.addEventListener()

b)

.reduce()

c)

.splice()

d)

.filter()

5.

What is the correct explanation of this code?

a)

sayHi is a function that returns a string that goes into a console.log to get info

b)

sayHi is a function that returns a string and will be executed in 1s

c)

sayHi is a function that returns a string and gets executed in 1000ms but nothing will be printed out because we don't have console.log

6.

A function can be called a limited number of times

a)

True

b)

False

7.

Is Array.map a high order function?

a)

Yes

b)

No

8.

What will be logged?

a)

["J", "D","A","M"]

b)

"JDAM"

c)

["John,"Doe","Ali","Mariam"]

d)

["JDAM"]

9.

What will be logged?

a)

10

b)

[10,10,10,10]

c)

[1,3,5,7]

d)

16

10.

Array.map takes a function as a param, and this function can only take 1 param which is the current element in the array

a)

True

b)

False

11.

What is logged?

a)

"HAPPY"

b)

["Hello"]

c)

["H","A","P","P","Y"]

d)

"HELLO"

12.

Which of the following is true about the spread (...) operator? (Choose all that are true)

a)

Spread syntax can be used when all elements from an object or array need to be included in a new array or object

b)

The spread operator looks and functions exactly the same as a rest operator

c)

It takse in an iterable object (like array) and expands it into individual elements.

d)

It is only used to make copies of arrays and objects values.

13.

What will be logged?

a)

[ 'A', 'BC', 'D', 'E' ]

b)

[ 'A', 'B', 'CD', 'E' ]

c)

[ 'A', 'BCD', 'E' ]

d)

[ 'A', 'B', 'C', 'D', 'E' ]

14.

What is logged?

a)

[ 'bread', 'carrot', 'potato', 'chicken', 'apple', 'orange' ]

b)

[ 'carrot', 'potato', 'apple', 'orange' ]

c)

{bread: ['carrot', 'potato'], chicken: ['apple', 'orange']}

15.

A function definition's last parameter can be prefixed with ... (three U+002E FULL STOP characters), which will cause all remaining (user supplied) parameters to be placed within a standard JavaScript Array

a)

True

b)

false

16.

It is not necessary for the Rest parameter to be the last formal parameter

a)

True

b)

False

17.

What is logged?

a)

a one

b two

manyMoreArgs ["three", "four", "five", "six"]

b)

a undefined

b undefined

manyMoreArgs ["one", "two", "three", "four", "five", "six"]

c)

a one

b two

manyMoreArgs undefined

18.

What is logged?

a)

{

  name: "Muhanned",

  age: 29,

  hasCar: true,

  hobbies: ["coding", "playing music", "gaming"],

}

b)

{

  name: "Kutay",

  age: 27,

  hasCar: true,

  hobbies: ["coding", "playing music", "gaming"],

}

c)

Throws an error message

d)

{

  hasCar: true,

  hobbies: ["coding", "playing music", "gaming"],

}

19.

What is logged?

a)

[10, 20, 30, 40, 50]

b)

[30, 40, 50]

c)

150

d)

[]

20.

What is logged?

a)

[1, 2, 3]

b)

[3, 2, 1]

c)

[2, 3, 1]

d)

[1, 3, 2]