CBSE Class 12 Computer Science Question 34 of 103

Working with Functions — Question 10

Back to all questions
10
Question

Question 10

Which of the following function calls can be used to invoke the below function definition ?
def test(a, b, c, d)

  1. test(1, 2, 3, 4)
  2. test(a = 1, 2, 3, 4)
  3. test(a = 1, b = 2, c = 3, 4)
  4. test(a = 1, b = 2, c = 3, d = 4)
Answer

test(1, 2, 3, 4)
test(a = 1, b = 2, c = 3, d = 4)

Reason

  1. The function call test(1, 2, 3, 4) passes four positional arguments 1, 2, 3, and 4 to the function.
  2. The function call test(a = 1, b = 2, c = 3, d = 4) passes four keyword arguments, explicitly stating the parameter names (a, b, c, d) and their corresponding values.