Advertisements
Advertisements
Question
Assertion (A): If the arguments in function call statement match the number and order of arguments as defined in the function definition, such arguments are called positional arguments.
Reasoning (R): During a function call, the argument list first contains default argument(s) followed by the positional argument(s).
Options
Both A and R are true and R is the correct explanation for A.
Both A and R are true and R is not the correct explanation for A.
A is True but R is False.
A is false but R is True.
Solution
A is True but R is False.
Explanation:
If the arguments in a function call match the number and order of arguments as defined in the function definition, such arguments are called positional arguments.
During a function call, the argument list should first contain the positional argument(s) followed by default argument(s).
Thus,
- The assertion is true.
- The reasoning is false.
So, the correct answer is A is True but R is False.
APPEARS IN
RELATED QUESTIONS
Observe the following program carefully, and identify the error:
def findValue( vall = 1.1, val2, val3):
final = (val2 + val3)/ vall
print(final)
findvalue() #function call
Differentiate between the following with the help of an example:
Argument and Parameter
Predict the output of the following code:
def Changer (P, Q=10):
P=P/Q
Q=P%Q
return P
A=200
B=20
A=Changer(A,B)
print(A,B,sep='$')
B=Changer(B)
print(A,B sep='$', end='# # #')