Computer Science
Assertion. A parameter having a default value in the function header is known as a default parameter.
Reason. The default values for parameters are considered only if no value is provided for that parameter in the function call statement.
Answer
(b)
Both Assertion and Reason are true but Reason is not the correct explanation of Assertion.
Explanation
A default parameter is a parameter in a function definition that has a predefined value. When we call a function with default parameters, if we don't provide a value for a parameter, the default value specified in the function header will be used instead.
Related Questions
Assertion. A variable declared inside a function cannot be used outside it.
Reason. A variable created inside a function has a function scope.
Assertion. A variable not declared inside a function can still be used inside the function if it is declared at a higher scope level.
Reason. Python resolves a name using LEGB rule where it checks in Local (L), Enclosing (E), Global (G) and Built-in scopes (B), in the given order.
Assertion. A function declaring a variable having the same name as a global variable, cannot use that global variable.
Reason. A local variable having the same name as a global variable hides the global variable in its function.
Assertion. If the arguments in a function call statement match the number and order of arguments as defined in the function definition, such arguments are called positional arguments.
Reason. During a function call, the argument list first contains default argument(s) followed positional argument(s).