(1) what are the output of the following:
def multipliers():
return [lambda x : i * x for i in range(4)]
print [m(2) for m in multipliers()]
(2) what are the following OOP doing?
class Parent(object):
x = 1
class Child1(Parent):
pass
class Child2(Parent):
pass
print Parent.x, Child1.x, Child2.x
Child1.x = 2
print Parent.x, Child1.x, Child2.x
Parent.x = 3
print Parent.x, Child1.x, Child2.x
(3) list = ['a', 'b', 'c', 'd', 'e']
print list[10:]
(4)
d = DefaultDict()
d['florp'] = 127
(5) How Python is interpreted? How memory is managed in Python?
(6) What is the difference between list and tuple?
(7) What is Dict and List comprehensions are?
(8) How are arguments passed by value or by reference?
(9) What are the built-in type does python provides?
(10) What is module and package in Python?
(11) What is module and package in Python?
Monday, July 25, 2016
Python interview question 2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment