Worksheets1-26-2026 Chapter 5 Review Questions
Total questions: 25
Worksheet time: 16mins
Name
Class
Date
1.
What does the following function return?
a)
The smaller number
b)
The larger number
c)
The sum of the numbers
d)
Nothing
2.
What is the purpose of the return statement in a function?
a)
Displays output on the screen
b)
Ends the program
c)
Sends a value back to where the function was called
d)
Defines a variable
3.
How many parameters does the following function have?
a)
1
b)
2
c)
3
d)
0
4.
What is printed when the following code runs?
a)
True
b)
False
c)
9
d)
Error
5.
What are arguments in a function?
a)
Variables created inside a function
b)
Values passed into a function when it is called
c)
Values returned by a function
d)
Comments inside the function
6.
Where can a local variable be used?
a)
Anywhere in the program
b)
Only inside the function where it was created
c)
Inside all functions
d)
Only inside loops
7.
A function can return more than one value using multiple return statements.
a)
True
b)
False
8.
What is the output of the following code?
a)
A
b)
B
c)
C
d)
85
9.
How many arguments are required to call this function?
a)
0
b)
1
c)
2
d)
3
10.
Which line correctly calls the function below?
a)
greet()
b)
greet("Alex")
c)
greet = "Alex"
d)
def greet("Alex")
11.
Which type of error causes a program to run but produce incorrect results?
a)
Syntax error
b)
Runtime error
c)
Logic error
d)
Name error
12.
Which keyword is used to test code that may cause an error?
a)
error
b)
test
c)
try
d)
check
13.
What type of Exceptrion occurs when a variable is used before it is defined?
a)
TypeError
b)
NameError
c)
ValueError
d)
SyntaxError
14.
What happens if a Python program contains a syntax error?
a)
It runs but gives wrong output
b)
It crashes while running
c)
It will not run at all
d)
Python fixes it automatically
15.
Which error is detected while the program is running?
a)
Syntax error
b)
Runtime error
c)
Logic error
d)
Comment error
16.
Which option correctly shows a multi-line comment in Python?
a)
// comment
b)
/* comment */
c)
# comment #
d)
" " " comment " " "
17.
Which symbol is used to create a single-line comment?
a)
//
b)
#
c)
/*
d)
" " "
18.
What does Python do with comments when running code?
a)
Executes them
b)
Prints them
c)
Ignores them
d)
Converts them to strings
19.
What variables are parameters?
a)
num1, num2
b)
n1, n2
c)
answer
d)
difference()
20.
How many parameters does this function have?
a)
1
b)
2
c)
3
d)
5
21.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
22.
Consider the line of code:
Label('Go Team', 200, 100)
What is 'Go Team' ?
a)
argument
b)
parameter
c)
function name
23.
What is a parameter in a function?
a)
input value to a function for the function’s execution
b)
a variable used to send information to a function
c)
the name of the function
d)
the name of the main program calling the function
24.
What is the first step in using a function in your code?
a)
Calling the function
b)
Defining the function
c)
Declaring the function
d)
Initializing the function
25.
Which of the following is the correct way to call a function?
a)
def distance ( ):
b)
distance
c)
distance ( )
d)
distance ( ):
100 %
