Class 12: Scope of variables | MCQs

7.
Give the Output:

w=10

def abc():
     w=100
     print(w)
     w+=10
     print(w)


print(w)
abc()
w=w+10
print(w)

8.
Give the Output:

d=10

def abc():
     d=30
     print(d)
     d-=50
     print(d)


print(d)
d=d*10
abc()
print(d)

9.
Give the Output:

a=10

def abc():
     global a
     a+=30
     print(a)
     a-=5
     print(a)
     a+=20


print(a)
a=a*10
abc()
print(a)

10.
Give the Output:

q=10

def abc():
     global q
     q+=230
     print(q)
     q-=50
     print(q)
     q+=120


q+=10
print(q)
q=q*5
abc()
print(q)