Skip to content
Question 46 of 97

Q.State True or False: While defining a function in Python, the positional parameters in the function header must always be written after the default parameters.

Odisha ChseCBSE Class XII Board 2024Subjective· 1mImportance★★★★★
47% · 46/97 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The statement is False. In Python, positional (non-default) parameters must always be written before parameters that have default values; otherwise Python raises a SyntaxError.

Concept

When a function is called, Python matches arguments to parameters from left to right. A parameter with a default value is optional, while a plain positional parameter is mandatory. If a mandatory parameter came after an optional one, Python could not tell whether a single supplied value was meant for the optional parameter or the mandatory one, so the language forbids that ordering.

Correct order

def calculate_area(length, width=10):   # valid: positional first, default after
    return length * width

Calling calculate_area(5) gives length=5, width=10; calculate_area(5, 20) gives length=5, width=20.

The order the statement claims …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.