Skip to content

A listing of questions that could potentially be asked for a python job listing

Notifications You must be signed in to change notification settings

sawani02/python-interview-questions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

Python Interview Questions

This repository contains a number of Python interview questions that can be used when vetting potential candidates. It is not advised to use every one of these questions for the same candidate.

Basic Questions

  1. What is Python?

  2. Describe some features of Python.

  3. How does Python execute code?

  4. What are some built-in types in Python?

  5. How do you create a list?

  6. How do you create a dictionary?

  7. What is PEP8?

Intermediate/Advanced Questions

  1. How can you improve the following code?

    import string
    
    i = 0
    for letter in string.letters:
        print("The letter at index %i is %s" % (i, letter))
        i = i + 1

    Bonus points for mentioning enumerate and use of str.format.

  2. What's the fastest way to swap the values bound to two variables?

  3. What is the importance of reference counting?

  4. Do functions (or methods) return something even if there isn't a return statement? If so, what do they return?

  5. How can you return multiple values from a function/method?

  6. What is a list comprehension? Why would you use one?

  7. What is a generator? What can it be used for?

  8. What is a decorator? How is it represented?

  9. How do you reverse a list? Can you come up with at least three ways?

  10. How would you merge two sorted lists? They can be any length, or empty.

  11. How would you count the lines in a file? How would you do it if the file was too big to hold in memory?

  12. What are bindings, i.e., what does it mean for a value to be bound to a variable?

  13. What happens if you have an error in an init statement?

  14. What is inheritance?

  15. What happens in python if you try to divide by zero?

More advanced questions

  1. What is a descriptor?

answer [https://docs.python.org/2/reference/datamodel.html#descriptors]

  1. What is the GIL?

  2. Do lists and tuples react the same way to hashability?

  3. What is a meta class?

Other/related technologies

  1. What is a cron job?

answer [http://www.opsschool.org/en/latest/cron_101.html#what-is-a-crontab]

About

A listing of questions that could potentially be asked for a python job listing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published