Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Functions and Objects

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

What type of function is this?

a)

Function Expression

b)

Function Declaration

c)

Arrow Function

d)

Not a function

2.

Why do we write functions?

a)

To make our code more reusable

b)

To make our code easier to understand

c)

To avoid repeating our code

d)

All of these

3.

What type of function is this?

a)

Function Expression

b)

Function Declaration

c)

Arrow Function

d)

Not a function

4.

Why do we use parameters in functions?

a)

To create a lot of functions

b)

To make is easier for the user to input values when playing a game.

c)

To be able to go back and fix error in the code and make it easier to debug.

d)

Parameters allow a function to perform tasks without knowing the specific input values ahead of time.

5.

What type of function is this?

a)

Arrow Function

b)

Function Declaration

c)

Not a function

d)

Function Expression

6.

Which one of these is the correct way to store an object in a variable?

a)

let person = {age=31, hair='brown'};

b)

let person = {age: 31, hair: 'brown'};

c)

let person = {age:31 hair:'brown'};

d)

let person = {let age=31, lethair='brown'};

7.

Which of these objects have 3 properties?

a)

let person = {age: 31, hair: 'brown'};

b)

let person = {age: 31};

c)

let person = {age: 31, hair: 'brown', eyes: 'blue'};

d)

let person = {hair: ['brown', 'blonde', 'pink']};

8.

We're storing an object in a variable named 'cafe' with the property 'drinks'. Which line of code would change that property's value?

a)

cafe[drink] = 'coffee';

b)

cafe.drink = 'coffee';

c)

cafe_drink = 'coffee';

d)

let cafel.drink = 'coffee';

9.

Which of these is a valid line of JavaScript that stores an array of objects in a variable?

a)

let films = [{title: 'Die Hard', actor: 'Bruce Willis'}];

b)

let films = [{title='Die Hard', actor='Bruce Willis'}];

c)

let films = {[title: 'Die Hard', actor: 'Bruce Willis']};

d)

let films = [title: 'Die Hard', actor: 'Bruce Willis'];

10.

What is the output of this function?

a)

9

b)

10

c)

11

d)

12