
Python Functions Quiz

Quiz
•
Education
•
12th Grade
•
Medium
Christopher Maguire
Used 2+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a function in Python?
A way to print output to the screen
A block of reusable code that performs a specific task
A special type of variable
A type of loop
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What keyword is used to define a function in Python?
function
define
def
fn
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this code print? def greet(): print("Hello, world!") greet()
greet()
"Hello, world!"
Nothing, because the function is not called
An error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the return statement in a function?
It outputs data to the console
It stops the function execution
It sends a value back to where the function was called
It prints the function name
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this function return? def add(a, b): return a + b result = add(3, 5) print(result)
3
5
8
Nothing, because return does not print
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? def multiply(x, y=2): return x * y print(multiply(4))
4
2
8
An error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true about function parameters and arguments?
Parameters are the actual values passed to a function
Arguments are the names defined in the function definition
Parameters are placeholders used in a function definition
Arguments and parameters are the same thing
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python

Quiz
•
1st Grade - Professio...
11 questions
Python - Class

Quiz
•
12th Grade - University
11 questions
Python - Data Types

Quiz
•
12th Grade - University
10 questions
Fingerprint Classification

Quiz
•
9th - 12th Grade
13 questions
Python Intermediate Quiz - 1

Quiz
•
8th Grade - Professio...
15 questions
PBO

Quiz
•
12th Grade
10 questions
KTTX Tin 10 bài 28, 29

Quiz
•
9th - 12th Grade
15 questions
Understanding Programming Concepts

Quiz
•
12th Grade
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
10 questions
Chaffey

Quiz
•
9th - 12th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
22 questions
6-8 Digital Citizenship Review

Quiz
•
6th - 8th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade