
Functions and Outputs (Review)
Flashcard
•
Computers
•
11th Grade
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

10 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Which of the following programs will NOT cause an error?
say_hi("Margaret")
def say_hi(name):
print("hi " + name)
function say_hi(name):
print("hi " + name)
def say_hi(first_name="John", last_name="Doe"):
print("hi " + first_name + " " + last_name)
say_hi("Polly Pocket"))
def say_hi(first_name="John", last_name):
print("hi " + first_name + " " + last_name)
say_hi(‘Polly’, ‘Pocket’)
Back
say_hi("Margaret")
def say_hi(name):
print("hi " + name)
2.
FLASHCARD QUESTION
Front
Which of the programs below will print the following output? I would like a green balloon.
Back
def balloon_choice(color):
print("I would like a " + color + " balloon.")
balloon_choice("green")
3.
FLASHCARD QUESTION
Front
What will be the output of the following program?
a = 4
def print_something():
a = "code"
print(a * 3)
print_something()
Back
codecodecode
4.
FLASHCARD QUESTION
Front
What will be the output of the following program?
name = “Tracy”
def print_hello(name):
name = "Turtle"
print(“hello ” + name)
print_hello(name)
Back
hello Turtle
5.
FLASHCARD QUESTION
Front
What would this program print?
def mystery(num, pattern):
result = ""
for i in range(num):
result = result + pattern
return result
print(mystery(3, "<>"))
Back
<> <> <>
6.
FLASHCARD QUESTION
Front
Which of the following options is NOT a valid Python function definition? # computes the surface area of a cube of side length 10 def surface_area(): return 2*(100 + 100 + 100), # computes the surface area of a rectangular prism def surface_area(length, width=10, height): return 2*(length width + width height + height * length), # computes the surface area of a rectangular prism def surface_area(length, width, height): return 2*(length width + width height + height * length), # computes the surface area of a rectangular prism def surface_area(length, width, height=10): return 2*(length width + width height + height * length)
Back
# computes the surface area of a rectangular prism def surface_area(length, width=10, height): return 2*(length width + width height + height * length)
7.
FLASHCARD QUESTION
Front
What will be printed when the program below is run?
def add_two(x):
return x + 2
def multiply_by_three(x):
return x * 3
def my_function(x):
return add_two(x) + multiply_by_three(x)
print(my_function(12))
Back
50
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?