200-901 Software Development and Design Practice Question
In Python, which of the following is a valid way to define a function that accepts a variable number of positional arguments?
⚠ Common exam trap
Cisco often tests the distinction between `*args` (positional) and `**kwargs` (keyword) and may include syntactically invalid options like `args*` to catch candidates who misremember the asterisk placement.
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
✓
def func(*args):
In Python, the `*args` syntax in a function definition allows the function to accept a variable number of positional arguments. The asterisk (`*`) collects all extra positional arguments into a tuple named `args`, enabling flexible argument handling.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
def func(args):
Why it's wrong here
A single parameter named args accepts exactly one positional argument, so passing two or more raises a TypeError. Variable positional arguments require the star syntax, which packs extras into a tuple. This is tempting because 'args' is the conventional name for that tuple, but the name alone carries no special meaning; only the asterisk does.
- ✗
def func(args*):
Why it's wrong here
The asterisk must precede the parameter name, so 'args*' is a syntax error at definition time. The valid form is '*args', which collects surplus positional arguments into a tuple. This is tempting because it keeps the familiar 'args' identifier and merely misplaces the star, a common slip when the star's position is not yet firmly memorised.
- ✗
def func(**kwargs):
Why it's wrong here
Double asterisks collect keyword arguments into a dictionary, so '**kwargs' captures named arguments, not positional ones. Positional collection needs a single '*args'. This is tempting because '**kwargs' is the standard idiom for arbitrary arguments, and it would be correct if the question asked about accepting a variable number of keyword arguments.
- ✓
def func(*args):
Why this is correct
Prefixing a parameter with an asterisk, as in *args, collects any number of extra positional arguments into a tuple named args. This is Python's defined syntax for variadic positional parameters, distinct from **kwargs, which gathers keyword arguments into a dictionary.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 975-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.