Select the valid fun () invocations:
(Choose two.)
Select the valid fun () invocations:
(Choose two.)
The function `fun` has one mandatory parameter `a` and one optional parameter `b` with a default value of 0. This means it is valid to call the function with one argument because `b` will automatically take the default value. Option B is valid because it provides a value for `a` while using the default value for `b`. Option D is also valid because it provides a positional argument that will be interpreted as `a`, with `b` taking the default value of 0. Conversely, Option A is invalid because it attempts to call the function using only the optional parameter `b` without providing a value for the mandatory parameter `a`. Option C is invalid due to incorrect syntax; positional arguments cannot come after keyword arguments.
b is an optional parameter so the answer is B and D
b is an optional parameter so the answer is B and D
B. fun (a=0) D. fun (1)
Those are the correct answers
A is not the correct answer since it needs a or it needs a and b. In A it only shows b which is not applicable to the machine
You would think it's C but it's not. This is becuase c has a syntax error of writing the b first and then a which is not the order.
The only hangup I had was on option C so here is an explanation for people like me: C attempts to pass positional argument 0 after keyword argument b=1, which is not allowed.
Why a is correct?
becoz the given input of b already equals 0, we need input for a so it will yield: a*b