Monday, February 16, 2009

Python Interview Questions

I Started Learning python in 2004,I applied for so many companies,
this are the questions they asked in Interview

1.what is strongly typed language?

2.what is statically typed language?

3.there is any difference between in below classes
class A(object):
pass

class B:
pass

4. how to generate a dictionary in a one line, which contains 1-100 numbers as keys,
squares of keys as values ?

5. what is REST?

6. what is the python interface for Postgresql?

7. what is the differece betweeen static method and instance method?

8. how do you connect to database in plan python?

9. how do you fetch first row using cursor?

10. how do you fetch all rows using cursor?

11. when did you started learning python?

12. why your more interested in programming rather then system administration?

13. do you know what is the "interfaces" in Java?

14. are you a mysql database expert?

15. what is the differece betweeen static method and instance method in python classes?

16. how to multiply two values in scheme?

17. how do you pass command line arguments in shell script,python,C?

18. what is the difference between Innodb ,ISM in mysql database?


Others questions

1. presently, what you are working in your project?
2. how will scale your self in JavaScript?
3. How will you declare class in JS? is there any difference with other class?
4. how will find html file is fully loaded or not?
5. how will You scale your self in dojo?
6. write a recursive function to get a reverse of a string?
7. they are two persons.one of them is going at speed of 20km while going in the forward direction while coming back he is going at speed of 60km
but other person going at constant speed 40km going same way how will reach first?
8. they are two persons.one of them is going at speed of x km while going in the forward direction while coming back he is going at speed of y km
but other person going at constant speed x+y/2 going same way how will reach first?


1. write a program to print all permutations for given a string?
2. list vs tuple?
3. can we use list in dict?
4. can we use list as key in dict?
5. a = []
b=[]
for i in xrange(2):
a.append(b)
a[0].append(1)
a[0].append(2)
a[1].append(1)
a[1].append(2)
print a
what is the output?
6.pass by value vs pass by reference
7. a = [1, 2, 3]
b= a
b.append(4)
what is value of a and b?
8. how will u cut when your required equal parts in a round shaped cake?
9. using only 3 cuts how will you get 8 peaces?
10 assume cream is there on top of cake how will u get all 8 peaces having cream using only 3 cuts?
11. write a Int-parser function in python.
      Ex:  int_parse('123') returns the value of 123
12. How to  Parse XML Files in Python.
13. Difference between String & List.
14. Write a power function.
15. How to run Linux commands in Python