Computer Science
What is a variable defined inside a function referred to as
- A static variable
- A global variable
- A local variable
- An automatic variable
Python Functions
1 Like
Answer
A local variable
Reason — A local variable is a variable declared in a function-body and it can be used only within this function and the other blocks contained under it.
Answered By
1 Like
Related Questions
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)
What is a variable defined outside all the functions referred to as ?
- A static variable
- A global variable
- A local variable
- An automatic variable
Carefully observe the code and give the answer.
def function1(a): a = a + '1' a = a * 2 >>>function1("hello")
- indentation Error
- cannot perform mathematical operation on strings
- hello2
- hello2hello2
What is the result of this code ?
def print_double(x): print(2 ** x) print_double(3)
- 8
- 6
- 4
- 10