CBSE Class 12 Computer Science Question 89 of 103

Working with Functions — Question 22

Back to all questions
22
Question

Question 16

In the following code, which variables are in the same scope ?

def func1():
    a = 1
    b = 2

def func2():
    c = 3
    d = 4
e = 5
Answer

In the code, variables a and b are in the same scope because they are defined within the same function func1(). Similarly, variables c and d are in the same scope because they are defined within the same function func2(). e being a global variable is not in the same scope.