19
QuizMultiple Choice

Resources for Programmers — Unit test

Question 19 • Introduction to Information Technology - EL3701

A function, writeamount, is defined:def writeamount ( name, amount = 0 ): print “Name : ”, name; print “Amount: ”, amount; return;When users do not enter the amount they paid, the system automatically assumes they paid nothing. This functionality is an example of a

Answer
A
default argument.
B
subroutine.
C
keyword argument.
D
return statement.

Explanation

The function sets `amount = 0` in its parameter list. If a user calls it without supplying an amount, Python uses that default value, so the function assumes they paid nothing. This is a default argument; a keyword argument is an argument supplied by naming its parameter when calling the function.

AI-written and checked against the verified answer.

Previous
Next