Class 12 Questions : Function Set 2

16.
What is the output of the code shown below?

def f1():
    x=100
    print(x)
x=+1
f1()

a) Error
b) 100
c) 101
d) 99

17.
What is the output of the code shown below?

def san(x):
    print(x+1)
x=-2
x=4
san(12)

a) 13
b) 10
c) 2
d) 5

18.
What is the output of the code shown?

def f1():
    global x
    x+=1
    print(x)
x=12
print("x")

a) Error
b) 13
c) 13
d) x

19.
What is the output of the code shown below?

def f1(x):
    global x
    x+=1
    print(x)
f1(15)
print("hello")

a) error
b) hello
c) 16
d) 16

20.
What is the output of the following code?

x=12
def f1(a,b=x):
    print(a,b)
x=15
f1(4)

a) Error
b) 12 4
c) 4 12
d) 4 15