Computer Science
What is a variable defined outside all the functions referred to as ?
- A static variable
- A global variable
- A local variable
- An automatic variable
Python Functions
3 Likes
Answer
A global variable
Reason — A global variable is a variable declared in top level segment (__main__) of a program and usable inside the whole program and all blocks contained within the program.
Answered By
1 Like
Related Questions
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)
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 inside a function 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