Question 1
What is the output of the following program :
def myfunc(a):
a = a + 2
a = a * 2
return a
print myfunc(2)
Question 3
What is the output of the following program :
print \'{0:.2}\'.format(1.0 / 3)
Question 4
What is the output of the following program :
print \'{0:-2%}\'.format(1.0 / 3)
Question 5
What is the output of the following program :
i = 0
while i < 3:
print i
i += 1
else:
print 0
Question 6
i = 0
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print(0)
Question 7
What is the output of the following program :
print \'cd\'.partition(\'cd\')
Question 8
What is the output of the following program :
print \'abef\'.partition(\'cd\')
Question 9
What is the output of the following program :
print \'abcefd\'.replace(\'cd\', \'12\')
Question 10
def f(value, values):
v = 1
values[0] = 44
t = 3
v = [1, 2, 3]
f(t, v)
print(t, v[0])
There are 11 questions to complete.