Monday, August 17, 2009

Python questions for interview

Python is a bliss for quick development. It's a mix of C & C++ features and comes in flavor of a script. For a C/C++ developer who happen to work with Python, here are few interview questions that are frequently asked:

1. what all Python can do for you in OOP?
Python fairly supports OOP principles. You can declare and define classes that follow same philosophy of OOP(similar to C++, Java). Besides features like inheritance, polymorphism are also there.

2. Does it support operator overloading?
You can have operator overloading also.

3. What is pickling?
It's an object serialization technique. Very similar to marshaling/un-marshaling that packet data in networks.

4. Does it support function overloading?
No.

5. How do you pass variable number of arguments to a function?
def foo(*pass_many):
...
In the function you should retrieve the arguments as a tuple.

6. Difference between a tuple and list?
You know it. Tuples are immutable objects while list are mutable.

Highly recommended: http://www.learningpython.com/2008/06/21/operator-overload-learn-how-to-change-the-behavior-of-equality-operators/

No comments: