Python Quiz with answers – Part 2

Practical questions to test your knowledge of Python programming – Part 2
Which function inserts an object with a given index in a list?
list.index(obj)
list.insert(index, obj)
list.pop(obj=list[-1])
list.remove(obj)
Correct!
Wrong!
In python, what is the right method to load a module?
include math
import math
#include math.h
using math
Correct!
Wrong!
What is the output for 'python' [-3] ?
Error: negative index.
'h'
'o'
't'
Correct!
Wrong!
What will be the output of the following code:
print type (type(int)) ?
print type (type(int)) ?
type ‘int’
type ‘type’
Error
0
Correct!
Wrong!
What will be the output of the following code?
[ (a,b) for a in range(3) for b in range(a) ]
[(1,0),(2,0),(2,1)]
[(1,0),(2,1),(2,1)]
[(0,0),(1,1),(2,2)]
[(1,0),(2,1),(3,2)]
Correct!
Wrong!
What will be the output of the following code?
myList = ['a','b','c','d']
print "".join(myList)
[‘a’,’b’,’c’,’d’]
abcd
Null
Error
Correct!
Wrong!
What will be the output of the following code?
print(max('hello world'))
w
e
o
ll
Correct!
Wrong!
What will be the output of the following code?
chr(ord('A'))
65
A
a
Error
Correct!
Wrong!
What will be the output of the following code?
x = lambda a : a + 10
print(x(5))
10
5
15
Error
Correct!
Wrong!
When a function is defined in a class, is it called ______?
Module
Class
Method
Another function
Correct!
Wrong!
Share the quiz to show your results !
Subscribe to see your results
Python Quiz – Part 2
I got %%score%% of %%total%% right
%%description%%
%%description%%
Loading...