Question 1
What is the output of the following program :
def myfunc(a): a = a + 2 a = a * 2 return a print myfunc(2)
8
16
Indentation Error
Runtime Error
Question 3
What is the output of the following program :
print('{0:.2}'.format(1.0 / 3))
0.333333
0.33
0.333333:-2
Error
Question 4
What is the output of the following program :
print ('{0:-2%}'.format(1.0 / 3))
0.33
0.33%
33.33%
33%
Question 5
What is the output of the following program :
i = 0 while i < 3: print(i,end=' ') i += 1 else: print(0)
0 1 2 3 0
0 1 2 0
0 1 2
Error
Question 6
What is the output of the following program :
i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0)
0 1 2 0
0 1 2
Error
None of the above
Question 7
What is the output of the following program :
print('cd'.partition('cd'))
(‘cd’)
(”)
(‘cd’, ”, ”)
(”, ‘cd’, ”)
Question 8
What is the output of the following program :
print('abef'.partition('cd'))
(‘abef’)
(‘abef’, ‘cd’, ”)
(‘abef’, ”, ”)
Error
Question 9
What is the output of the following program :
print('abcefd'.replace('cd', '12'))
ab1ef2
abcefd
ab1efd
ab12ed2
Question 10
What will be displayed by the following code?
def f(value, values): v = 1 values[0] = 44 a = 3 v = [1, 2, 3] f(a, v) print(a, v[0])
1 1
1 44
3 1
3 44
There are 11 questions to complete.