Wednesday 25 April 2012

Python Interview Questions and Answers pdf free download

2. Why can't I use an assignment in an expression? 
3. Is there a tool to help find bugs or perform static analysis? 
4. How do you set a global variable in a function? 
5. What are the rules for local and global variables in Python? 
6. How do I share global variables across modules? 
7. How can I pass optional or keyword parameters from one function to another? 
8. How do you make a higher order function in Python? 
9. How do I copy an object in Python? 
10. How can I find the methods or attributes of an object? 
11.How do I convert a string to a number? 
12. How can my code discover the name of an object? 
13. Is there an equivalent of C's "?:" ternary operator? 
14.How do I convert a number to a string? 
15.How do I modify a string in place? 
16. How do I use strings to call functions/methods? 
17. Is there a scanf() or sscanf() equivalent? 
18. How do I convert between tuples and lists? 
19. What's a negative index? 
20. How do I iterate over a sequence in reverse order? 
21. How do you remove duplicates from a list? 
22. How do I create a multidimensional list? 
23. How do I apply a method to a sequence of objects? 
24. I want to do a complicated sort: can you do a Schwartzman Transform in Python? 
25. What is a class? 
26. What is a method? 
27. What is delegation? 
28. How do I call a method defined in a base class from a derived class that overrides it? 
29. How do I create static class data and static class methods? 
30. How can I overload constructors (or methods) in Python? 
31. How do I find the current module name? 
32. Where is the math.py (socket.py, regex.py, etc.) source file? 
33. How do I make a Python script executable on Unix? 
34. Why don't my signal handlers work? 
35.  How do I avoid blocking in the connect() method of a socket? 
36. Are there any interfaces to database packages in Python? 
37. How do I generate random numbers in Python? 
38. Can I create my own functions in C? 
39. Can I create my own functions in C++? 
40. How can I execute arbitrary Python statements from C? 
41. How can I evaluate an arbitrary Python expression from C? 
42. How do I extract C values from a Python object? 
43. How do I access a module written in Python from C? 
44. How do I interface to C++ objects from Python?