Functions

Quiz by Kevin Moore

Feel free to use or edit a copy

includes Teacher and Student dashboards

### Measure skillsfrom any curriculum

Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.

• edit the questions
• save a copy for later
• start a class game
• automatically assign follow-up activities based on students’ scores
• assign as homework
• share a link with colleagues
• print as a bubble sheet

### Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

10 questions
• Q1

Functions can do all of the following except:

Allow writing without proper syntax

Stop the program from repeating

Simplify code

30s
• Q2

In Python, you define the __________ first, then call it underneath

return

main program

Print statement

subprogram

30s
• Q3

What is output by the following program?

def test():

print("Rainbow")

#MAIN

test()

print("Sunshine")

print("Storm.")

print(“Rainbow”) Sunshine Storm

Rainbow Sunshine Storm

Storm. Sunshine Rainbow

Sunshine Storm. Rainbow

30s
• Q4

Which of the following parameters is optional?

sample(a, b, c, d=9)

d

b

c

a

30s
• Q5

What is output by the following program?

def mult(a, b = 1, c = 1):

return(a * b * c)

print(mult(2, 5, 8))

80

0

10

2

30s
• Q6

What is output by the following program?

def sample(val):

val = val * 10

#MAIN

n = 4

sample(n)

print(n)

None of the above.  The code has an error - it is missing a parameter.

40

4

1

30s
• Q7

What is output by the following code?

def mystery(w):

if (w == w.upper()):

return "TRUE"

else:

return "FALSE"

print(mystery("What a wonderful day!"))

FALSE

TRUE

"What a wonderful day!"

What a wonderful day!

30s
• Q8

Consider the following program:

def sillyString(w):

return w.replace( "a", "oo")

#MAIN

fruit = input ("Enter a state: ")

print(sillyString(fruit))

What is the output if the user enters “california”?

california

None of the above.  The code has an error.

coolifornioo

coo

30s
• Q9

Functions are mainly used to ________________________.

input data into a program

represent numeric data

write output to the screen

organize longer programs

30s
• Q10

What is output by the following program?

def greeting(name):

print("Hello ", name.upper())

greeting("Bobby")

HELLO Bobby

None of the above.  The code has an error.

Hello bobby

Hello Bobby

30s

Teachers give this quiz to your class