Computer Science
For a function header as follows :def Calc(X,Y = 20):
Which of the following function calls will give an error ?
- Calc(15, 25)
- Calc(X = 15, Y = 25)
- Calc(Y = 25)
- Calc(X = 25)
Python Functions
6 Likes
Answer
Calc(Y = 25)
Reason — The function call statement must match the number and order of arguments as defined in the function definition. Here, the X
positional argument is missing.
Answered By
2 Likes
Related Questions
Which of the following function calls can be used to invoke the below function definition ?
def test(a, b, c, d)
- test(1, 2, 3, 4)
- test(a = 1, 2, 3, 4)
- test(a = 1, b = 2, c = 3, 4)
- test(a = 1, b = 2, c = 3, d = 4)
Which of the following function calls will cause Error while invoking the below function definition ?
def test(a, b, c, d)
- test(1, 2, 3, 4)
- test(a = 1, 2, 3, 4)
- test(a = 1, b = 2, c = 3, 4)
- test(a = 1, b = 2, c = 3, d = 4)
What is a variable defined outside all the functions referred to as ?
- A static variable
- A global variable
- A local variable
- An automatic variable
What is a variable defined inside a function referred to as
- A static variable
- A global variable
- A local variable
- An automatic variable