Call a procedure with correct arguments and use its return value
Distinguish between procedures that return values vs only display output
Trace code that calls multiple procedures in sequence
Identify what happens when a procedure has no return statement
📈
Exam Impact: Procedure calls are foundational to BI3 algorithm questions and required in the Create Task for the abstraction rubric row.
💡 Why This Matters
You call len() dozens of times without knowing its implementation. That's the power of procedures: use the result, ignore the internals.
Arguments, Parameters, Return Values
Calling a procedure means providing inputs (arguments) and receiving an output (return value).
def square(n):
return n * n
result = square(7) # 49
print(result)
print(square(3)+square(4)) # 25
PROCEDURE square(n)
{
RETURN n * n
}
result <- square(7)
DISPLAY(result)
Return vs Display-Only
Exam trap:result = print("hello") assigns None. print() displays but returns nothing. To use a value in a calculation, the function MUST have a RETURN statement.
Practice Problems
🔎 Practice MCQ
What does this code print?
def double(x):
return x * 2
print(double(5) + double(3))
⚠️ Predict your answer BEFORE clicking.
🔎 Practice MCQ
Procedure: PROCEDURE greet(name) { DISPLAY("Hello "+name) }. After val <- greet("Alex"), what is val?
⚠️ Predict your answer BEFORE clicking.
🔎 Practice MCQ
Which code correctly computes and prints the area of a circle with radius 5? I. def area(r): return 3.14*r*r then print(area(5)) II. def area(r): print(3.14*r*r) then x=area(5)+1 III. def area(r): return 3.14*r*r then area(5)
⚠️ Predict your answer BEFORE clicking.
🎮 Game
Procedure Call Evaluator
Trace procedure calls and predict return values. 8 questions.
0
Correct
1/8
Question
0
Streak 🔥
🤔 Evaluate:
0/8
correct
💻 Python Code Editor
Practice Problems
Write Python and check your answer. Paste into Replit for complex programs.
Problem 1 of 3
Write double(n) that returns n*2. Print double(7). Expected: 14
Hint: return n * 2
Problem 2 of 3
Write bigger(a,b) that returns the larger number. Print bigger(5,9). Expected: 9
Hint: if a > b: return a else: return b
Problem 3 of 3
Spot the bug: should print 25 but prints None. def square(n): print(n*n) result = square(5) print(result)
Hint: Replace print(n*n) with return n*n. Must RETURN for result to hold the value.
Frequently Asked Questions
A parameter is the variable name in the definition: def square(n) -- n is the parameter. An argument is the actual value passed when calling: square(7) -- 7 is the argument.
None is Python's 'no value'. Functions without return, or with bare return, return None. Using None in arithmetic raises TypeError.
Yes. double(square(3)) calls square first (returns 9) then passes 9 to double (returns 18).
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed.
Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Typically responds within 24 hours
✓
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.