wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Guided Notes: Functions that Return Values

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

A ________________ is a block of code designed to perform a specific task.

a)

function

b)

variable

c)

loop

d)

array

2.

Some functions don’t just do something—they give something back. This is called a ________________ ________________.

a)

return value or return function

b)

void value or void function

c)

static function

d)

helper function

3.

You use a ________________ ________________ to tell the function what value to send back when it's done.

a)

return statement

b)

print statement

c)

input statement

d)

break statement

4.

In the function example above, a + b is the ________________ ________________.

a)

return value

b)

function name

c)

parameter list

d)

argument

5.

When you call add(3, 4), the function will return ________________.

a)

7

b)

12

c)

34

d)

1

6.

If you want to use the result of a return function, you can store it in a ________________:

a)

variable

b)

loop

c)

operator

d)

constant

7.

The return statement is different from a print statement because it sends a value _______________ of the function instead of just showing it on the screen.

a)

outside

b)

inside

c)

to the screen

d)

to the variable

8.

In the lesson, the "Practice Turn!" activity helped you practice using return values by writing and calling functions that return _______________.

a)

values

b)

loops

c)

errors

d)

variables

9.

Sometimes, one function can be called _______________ another function. This is useful for breaking down a big task into smaller steps.

a)

inside

b)

before

c)

after

d)

outside

10.

Using return values helps keep your code clean, organized, and easy to _______________.

a)

maintain

b)

ignore

c)

break

d)

complicate

11.

A function should return a value instead of just printing it because:

a)

it allows the value to be used elsewhere in the program.

b)

it makes the output more colorful.

c)

it increases the speed of the function.

d)

it prevents the function from being called again.

12.

If a function is supposed to return something but doesn’t include a return statement, what could happen?

a)

The function returns undefined or nothing.

b)

The function will throw a syntax error.

c)

The function will automatically return zero.

d)

The function will return the last variable used.

13.

Calling one function inside another helps you solve more complex problems by:

a)

Breaking down tasks into smaller, manageable parts.

b)

Making the code run slower.

c)

Increasing the number of errors in the program.

d)

Limiting the use of variables.

14.

Returning a value from a function is useful because:

a)

It allows the function to provide a result that can be used elsewhere in the program.

b)

It makes the function run faster.

c)

It prevents the function from being called again.

d)

It automatically saves the program.

15.

If a function does not return a value when one is expected, what happens?

a)

An error or undefined value may occur.

b)

The function will always return 0.

c)

The program will automatically assign a random value.

d)

The function will return the value of the last variable used.

16.

Breaking a problem into smaller pieces helps in programming by:

a)

making the problem easier to solve and manage

b)

increasing the complexity of the problem

c)

making debugging more difficult

d)

reducing code readability