Wednesday, December 30, 2015

Python Interview questions

1. What is constructors in python?
2. How do inherit in python?
3. Name the types of datatypes in python?

Python has five standard data types:
1. Numbers
2. Strings
3. List
4. Tuple
5. Dictionary

Python supports four different numerical types:
1. int (signed integers)
2. long (long integers, they can also represented in octal and hexa decimal)
3. Float
4. Complex


4. Name the types of  variables in python? and how to configure the private, public variables and how to access them?

5. How do you reverse the string?


How do you login the webpage using python scripting without selenium web driver?

6. Write a class that keeps track of all the identifiers of objects created while instantiating?

7. Write a method that takes two dimensional list as argument and gives the transpose of the list
(Eg:)
def transpose(input_list):
    #Your Code here
    return output_list

a = [[1,2,3],[4,5,6]]


print transpose(a)
#Outputs[[1,4],[2,5],[3,6]]

8. Read a file and print only the strings from the file.

def Main():
        with open('word.txt','r') as f:
                for line in f:
                        for i in line.split(" "):
                                for x in i.rstrip("\n").split():
                                        if x.isalpha() == True:
                                                print x


if __name__ == "__main__":
        Main()


9. Write a class which implements method overloading?

10. What is the output of the following code?

def fun1(a=None):
    print "In the first function"

def fun1(a):
   print "In the second function"



10 comments:

  1. Thanks for sharing this python interview questions. I have bookmarked this page for my future reference.
    Python Classes in Chennai | Python Training Institutes in Chennai

    ReplyDelete
  2. Hi There,

    Gasping at your brilliance! Thanks a tonne for sharing all that content. Can’t stop reading Honestly

    Just want to know why str keyword is passed in is instance() method?
    Excellent tutorials - very easy to understand with all the details. I hope you will continue to provide more such tutorials.


    Obrigado,
    Jennifa

    ReplyDelete
  3. Hi Man,


    Muchas Gracias Mi Amigo! You make learning so effortless. Anyone can follow you and I would not mind following you to the moon coz I know you are like my north star.



    I'm doing a master thesis in Finance
    so I decided to learn python in order to make things simpler.
    I have learned the basics but my question stands in the possibility to python read a folder full of pdf files and search for specific key words.
    This is probably a beginner question, but any help regarding the subject would be extremely valuable.

    Great effort, I wish I saw it earlier. Would have saved my day :)


    Thanks and Regards
    Ajeeth

    ReplyDelete
  4. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
    Python Training in Bangalore

    ReplyDelete
  5. python does not support method overloading
    right?

    ReplyDelete
  6. Python is trending programming language in IT Sectors. Students have the best option to learn python language for an enduring carreer. Before attending any interview related to the python language, students are recommended to have a rapid revision of python interview questions. python interview questions

    ReplyDelete
  7. Aw, this was a decent post. Taking the time and genuine exertion to create a brilliant article… yet what would i be able to say… I tarry a ton and never figure out how to complete live anything.

    ReplyDelete