6.
What is the output of the following code?
def fun(): total += 1 return total total = 0 print(fun())
a) 0
b) 1
c) error
d) none of the mentioned
7.
What is the output of the following code?
def abc(x): x = ['def', 'abc'] return id(x) q = ['abc', 'def'] print(id(q) == abc(q))
a) True
b) False
c) None
d) Error
8.
What is the output of the following code?
def fun(i, x=[]): x.append(i) return x for i in range(3): print(fun(i))
a) [0]
[1]
[2]
b) [0]
[0, 1]
[0, 1, 2].
c) [1]
[2]
[3]
d) [1]
[1, 2]
[1, 2, 3].
9.
What is the output of the following code?
def xyz(k): k = [1] q = [0] xyz(q) print(q)
a) [0].
b) [1].
c) [1, 0].
d) [0, 1].
10.
How are variable length arguments specified in the function heading?
a) one star followed by a valid identifier
b) one underscore followed by a valid identifier
c) two stars followed by a valid identifier
d) two underscores followed by a valid identifier