wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Parameters and Return Review

Total questions: 19

Worksheet time: 11mins

Name
Class
Date
1.

What is the parameter?

a)

hasVowel

b)

str

c)

lower

d)

true

e)

false

2.

What is the name of the function?

a)

hasVowel

b)

str

c)

lower

d)

true

e)

false

3.

What is the argument for pigify?

a)

updateScreen

b)

statement

c)

text

d)

str

e)

list

4.

8 % 2 =

a)

0

b)

1

c)

2

d)

3

5.

5 % 2 =

a)

0

b)

1

c)

2

d)

3

6.

7 % 3 =

a)

0

b)

1

c)

2

d)

3

7.

Which code segment results in "true" being returned if a number is odd? Replace "MISSING CONDITION" with the correct code segment.

a)

num % 2 == 0;

b)

num % 0 == 2;

c)

num % 1 == 0;

d)

num % 2 == 1;

8.

Numbers is a/an ___

a)

parameter

b)

argument

c)

list

d)

function

e)

loop

9.

What is the name of the procedure?

a)

numList

b)

addNum

c)

subractNum

d)

changeNums

e)

numbers

10.

How many parameters does changeNums have?

a)

0

b)

1

c)

2

d)

3

11.

What will be printed to the console after this program runs?

a)

[12, -1, 0, 6, 5]

b)

[9, 1, 2, 3, 7]

c)

[7, 4, 5, 1, 10]

d)

nothing will be printed

12.

num1 and num2 are called

a)

lists

b)

parameters

c)

arguments

d)

functions

13.

Which function calls would provide the most helpful test of this function?

Remember: With tests, you are attempting to figure out all the possible ways the function could be broken.

a)

findMin(-5, 1)

findMin(2,8)

findMin(0,10)

b)

findMin(7,4)

findMin(8,1)

findMin(6,0)

c)

findMin(4,4)

findMin(-7,7)

findMin(2,3)

d)

findMin(0,2)

findMin(1,-4)

findMin(5,5)

14.

According to the API for moveElement, how many strings need to be input as arguments?

a)

0

b)

1

c)

2

d)

3

15.

Procedural abstraction means you can use functions without understanding the code behind them.

a)

True

b)

False

16.

All functions that have parameters also have a return.

a)

True

b)

False

17.

Algorithms are made up of sequencing, selection, and iteration.

a)

True

b)

False

18.

Using libraries can shorten a programs development time

a)

True

b)

False

19.

The return command of a function should always be placed outside the function definition.

a)

True

b)

False