PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions
A function is defined as: def min_max(nums): return min(nums), max(nums). What type of value does it return?
⚠ Common exam trap
The PCEP exam often tests the misconception that multiple return values are returned as a list or that parentheses are required to create a tuple, but in Python, it is the comma that defines a tuple, not the parentheses.
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
✓
A tuple
The function `min_max` uses `return min(nums), max(nums)`, which is a comma-separated list of expressions. In Python, when multiple values are returned separated by commas, they are automatically packed into a tuple. Therefore, the function returns a tuple containing the minimum and maximum values.
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
Why this is correct
Correct: Multiple return values without brackets form a tuple.
- ✗
A set
Why it's wrong here
Sets use curly braces, but the comma syntax returns a tuple.
- ✗
A dictionary
Why it's wrong here
Dictionaries require key-value pairs.
- ✗
A list
Why it's wrong here
The return statement with commas creates a tuple, not a list.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 498 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on PCEP
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A function returns a tuple. Which code correctly unpacks the tuple? def min_max(numbers): return min(numbers), max(numbers) result = min_max([3, 1, 2])
medium- A.a = result[0]; b = result[1]
- ✓ B.(a, b) = result
- ✓ C.a, b = result
- D.a = result[1]; b = result[0]
Why B: Both options B and C correctly unpack the tuple. Option B uses explicit parentheses, while option C uses the implicit form — both are valid tuple unpacking syntax in Python. Option A unpacks via indexing (not tuple unpacking), and option D incorrectly swaps the values.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.