Courseiva

200-901 Software Development and Design Practice Question

A Python function is designed to fetch device data from multiple sources. It uses *args to accept variable number of API endpoints and **kwargs for optional parameters like timeout. Which function definition correctly implements this?

⚠ Common exam trap

Cisco often tests the distinction between *args (variable positional arguments) and **kwargs (variable keyword arguments), and the trap here is that candidates confuse the syntax or order, thinking **endpoints can appear before *options or that a simple parameter name like options can accept keyword arguments without the double asterisk.

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 fetch_devices(*endpoints, **options):

It uses *endpoints to accept a variable number of positional arguments (the API endpoint strings) and **options to accept any number of keyword arguments (like timeout=30). This matches the requirement for a function that can handle multiple sources with optional parameters, following Python's standard *args/**kwargs pattern.

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 fetch_devices(**endpoints, *options):

    Why it's wrong here

    Python requires *args before **kwargs in a definition; reversing them raises a syntax error, so the function cannot accept variable positional endpoints. It is tempting because both parameter forms are present and the intent matches the requirement, and it would be correct if written as def fetch_devices(*endpoints, **options).

  • ✗

    def fetch_devices(endpoints, **options):

    Why it's wrong here

    Positional parameters before **options means endpoints captures only one argument, so multiple API endpoints cannot be passed variably. The *args syntax is what collects them into a tuple. This definition suits a fixed single endpoint plus keyword options, not the variable-endpoint requirement.

  • ✓

    def fetch_devices(*endpoints, **options):

    Why this is correct

    The signature `def fetch_devices(*endpoints, **options)` satisfies both stem constraints: `*endpoints` collects positional API endpoint arguments into a tuple, while `**options` gathers keyword arguments such as `timeout` into a dictionary. This is the only syntax Python permits for combining arbitrary positional and keyword parameters in one definition.

  • ✗

    def fetch_devices(*endpoints, options):

    Why it's wrong here

    Placing options after *endpoints without ** makes it a positional parameter, so keyword arguments like timeout raise TypeError. The ** prefix is required to collect arbitrary keyword arguments into a dictionary. This form would suit a required positional argument following variable positional ones, not optional named parameters.

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 →

How Courseiva writes practice questions · Editorial policy

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.