PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions
A function is defined to accept a variable number of positional arguments and return their sum. The code is:
def total(*args):
return sum(args)What is the result of `total(1, 2, 3)`?
⚠ Common exam trap
The trap here is thinking that the function returns the tuple of arguments, but it actually returns the computed sum.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
6
The *args parameter collects the positional arguments into a tuple. The sum function then adds the elements of that tuple. With arguments 1, 2, and 3, the sum is 6. Thus, the function returns 6.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
A tuple `(1, 2, 3)`
Why it's wrong here
The function returns the result of sum(args), not the tuple itself. While args is indeed the tuple (1, 2, 3), the sum function computes the total, which is 6. The return value is an integer, not a tuple.
- ✓
6
Why this is correct
The function uses *args to collect all positional arguments into a tuple. When called with 1, 2, 3, args becomes (1, 2, 3). The built-in sum function then adds these numbers, resulting in 6. This is the correct output.
- ✗
A TypeError is raised.
Why it's wrong here
The sum function accepts an iterable of numbers, and a tuple of integers is valid. Therefore, no TypeError occurs. The function executes successfully and returns the sum. The syntax *args is correct for collecting positional arguments.
- ✗
0
Why it's wrong here
This would be the result if no arguments were passed, because sum of an empty tuple is 0. However, the call provides three arguments, so args contains 1, 2, and 3. The sum is 6, not 0.
Go deeper
Related to this question
About these practice questions
One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.