16.
What is the output of the below program?
def power(x, y=2): r = 1 for i in range(y): r = r * x return r print (power(3)) print (power(3, 3))
a) 212
32
b) 9
27
c) 567
98
d) None of the mentioned
17.
What is the output of the below program?
def sum(*args): '''Function returns the sum of all values''' r = 0 for i in args: r += i return r print (sum(1, 2, 3)) print (sum(1, 2, 3, 4, 5))
a) 6
15
b) 6
100
c) 123
12345
d) None of the mentioned
18.
What is a variable defined outside a function referred to as?
a)A static variable
b)A global variable
c)A local variable
d)An automatic variable
19.
What is a variable defined inside a function referred to as?
a)A global variable
b)A volatile variable
c)A local variable
d)An automatic variable
20.
What is the output of the following code?
i=0 def change(i): i=i+1 return i change(1) print(i)
a)1
b)Nothing is displayed
c)0
d)An exception is thrown