PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions
A developer is writing a function that accepts a variable number of arguments and needs to handle them as a tuple. Which two of the following statements about tuples and function arguments are true? (Choose two.)
⚠ Common exam trap
The trap here is mixing up *args and **kwargs, or assuming that tuples are mutable and can be modified inside a function.
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
✓
Inside a function, the *args parameter collects extra positional arguments into a tuple.
The *args parameter collects extra positional arguments into a tuple, and the * operator can unpack a tuple into positional arguments in a function call. These two features are often used together to create flexible functions. The **kwargs parameter collects keyword arguments into a dictionary, not a tuple, and tuples are immutable, so their contents cannot be changed. Understanding these behaviors is essential for working with variable argument lists in Python.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Tuples are mutable, so the arguments collected by *args can be modified inside the function.
Why it's wrong here
Tuples are immutable; their elements cannot be changed after creation. The args tuple collected by *args is a regular tuple, so it cannot be modified. Attempting to assign to an element, such as args[0] = 5, will raise a TypeError. This immutability ensures that the collected arguments remain constant within the function.
- ✗
A tuple cannot be passed to a function as a single argument if the function expects multiple parameters.
Why it's wrong here
A tuple can be passed as a single argument, but if the function expects multiple parameters, the tuple will be bound to the first parameter unless unpacked with *. To pass the tuple's elements as separate arguments, you must use the * operator. Without unpacking, the function receives the tuple as one object, which may not match the expected parameters.
- ✓
Inside a function, the *args parameter collects extra positional arguments into a tuple.
Why this is correct
When a function is defined with *args, any additional positional arguments passed to the function are gathered into a tuple named args. This allows the function to accept an arbitrary number of arguments. The tuple is immutable, so the collected arguments cannot be modified in place. This is a standard Python feature for flexible function signatures.
- ✓
A tuple can be unpacked into positional arguments when calling a function using the * operator.
Why this is correct
The * operator can be used to unpack a tuple (or any iterable) into positional arguments in a function call. For example, if t = (1, 2), then f(*t) is equivalent to f(1, 2). This allows passing a tuple's elements as separate arguments. It is a convenient way to call functions when arguments are already in a sequence.
- ✗
The **kwargs parameter collects extra keyword arguments into a tuple.
Why it's wrong here
The **kwargs parameter collects extra keyword arguments into a dictionary, not a tuple. Each keyword argument becomes a key-value pair in the dictionary. This is different from *args, which collects positional arguments into a tuple. Confusing the two is a common mistake, but kwargs is always a dictionary.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 482 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 →
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.