Sign in to unlock

Get unlimited access to all questions and answers

checked

Get lifetime access

checked

Track progress

checked

Save time

The fastest way to prepare
for a tech interview

Check our curated list of full-stack, data structures & software architecture interview questions and answers for developers

Python interview questions

Python interview questions.

Only challenges
Topic progress: 0%
  • 1.

    Name some characteristics of Python?

    premium question
    completed

    Answer:

  • 2.

    How do I modify a string?

    premium question
    completed

    Answer:

  • 3.

    What are the built-in types available In Python?

    premium question
    completed

    Answer:

  • 4.

    Name some benefits of Python

    premium question
    completed

    Answer:

  • 5.

    Why would you use the "pass" statement?

    premium question
    completed

    Answer:

  • 6.

    What are local variables and global variables in Python?

    premium question
    completed

    Answer:

  • 7.

    What are descriptors?

    premium question
    completed

    Answer:

  • 8.

    What Is The Benefit Of Using Flask?

    premium question
    completed

    Answer:

  • 9.

    Does Python have a switch-case statement?

    premium question
    completed

    Answer:

  • 10.

    What is pickling and unpickling?

    premium question
    completed

    Answer:

  • 11.

    When to use a tuple vs list vs dictionary in Python?

    premium question
    completed

    Answer:

  • 12.

    What is negative index in Python?

    premium question
    completed

    Answer:

  • 13.

    Suppose lst is 2, 33, 222, 14, 25, What is lst-1?

    premium question
    completed

    Answer:

  • 14.

    How do you list the functions in a module?

    premium question
    completed

    Answer:

  • 15.

    What is PEP 8?

    premium question
    completed

    Answer:

  • 16.

    What are some drawbacks of the Python language?

    premium question
    completed

    Answer:

  • 17.

    What is lambda functions in Python?

    premium question
    completed

    Answer:

  • 18.

    What are the rules for local and global variables in Python?

    premium question
    completed

    Answer:

  • 19.

    Given variables a and b, switch their values so that b has the value of a, and a has the value of b without using an intermediary variable.

    premium question
    completed

    Answer:

  • 20.

    Explain how does Python memory management work?

    premium question
    completed

    Answer:

  • 21.

    What are decorators in Python?

    premium question
    completed

    Answer:

  • 22.

    What are the Dunder/Magic/Special methods in Python? Name a few.

    premium question
    completed

    Answer:

  • 23.

    What is the process of compilation and linking in Python?

    premium question
    completed

    Answer:

  • 24.

    What is monkey patching and is it ever a good idea?

    premium question
    completed

    Answer:

  • 25.

    What are immutable objects in Python?

    premium question
    completed

    Answer:

  • 26.

    What's the difference between lists and tuples?

    premium question
    completed

    Answer:

  • 27.

    What is the python “with” statement designed for?

    premium question
    completed

    Answer:

  • 28.

    Explain the UnboundLocalError exception and how to avoid it?

    premium question
    completed

    Answer:

  • 29.

    What does this stuff mean: *args, **kwargs? And why would we use it?

    premium question
    completed

    Answer:

  • 30.

    How can you share global variables across modules?

    premium question
    completed

    Answer:

  • 31.

    What is the function of “self”?

    premium question
    completed

    Answer:

  • 32.

    What is the difference between range and xrange functions in Python 2.X?

    premium question
    completed

    Answer:

  • 33.

    What's the difference between the list methods append() and extend()?

    premium question
    completed

    Answer:

  • 34.

    What are the wheels and eggs? What is the difference?

    premium question
    completed

    Answer:

  • 35.

    What are the key differences between Python 2 and 3?

    premium question
    completed

    Answer:

  • 36.

    After executing the above code, what is the value of y?

    premium question
    completed

    Answer:

  • 37.

    What are virtualenvs?

    premium question
    completed

    Answer:

  • 38.

    What is the difference between range and xrange? How has this changed over time?

    premium question
    completed

    Answer:

  • 39.

    What is a "callable"?

    premium question
    completed

    Answer:

  • 40.

    Is it possible to have static methods in Python?

    premium question
    completed

    Answer:

  • 41.

    What is a None value?

    premium question
    completed

    Answer:

  • 42.

    What Is Flask-WTF And What Are Their Features?

    premium question
    completed

    Answer:

  • 43.

    How can I create a copy of an object in Python?

    premium question
    completed

    Answer:

  • 44.

    What is namespace in Python?

    premium question
    completed

    Answer:

  • 45.

    How the string does get converted to a number?

    premium question
    completed

    Answer:

  • 46.

    What does the Python nonlocal statement do (in Python 3.0 and later)?

    premium question
    completed

    Answer:

  • 47.

    What is introspection/reflection and does Python support it?

    premium question
    completed

    Answer:

  • 48.

    Is this valid in Python and why?

    premium question
    completed

    Answer:

  • 49.

    How do I check if a list is empty?

    premium question
    completed

    Answer:

  • 50.

    How to make a flat list out of list of lists?

    premium question
    completed

    Answer:

  • 51.

    What is the most efficient way to concatenate many strings together?

    premium question
    completed

    Answer:

  • 52.

    Write a program to check whether the object is of a class or its subclass.

    premium question
    completed

    Answer:

  • 53.

    Can you explain closures (as they relate to Python)?

    premium question
    completed

    Answer:

  • 54.

    Why are Python's 'private' methods not actually private?

    premium question
    completed

    Answer:

  • 55.

    Is there a tool to help find bugs or perform static analysis?

    premium question
    completed

    Answer:

  • 56.

    What's the difference between a Python module and a Python package?

    premium question
    completed

    Answer:

  • 57.

    What is an alternative to GIL?

    premium question
    completed

    Answer:

  • 58.

    What is the purpose of the single underscore “_” variable in Python?

    premium question
    completed

    Answer:

  • 59.

    What is GIL?

    premium question
    completed

    Answer:

  • 60.

    What is MRO in Python? How does it work?

    premium question
    completed

    Answer:

  • 61.

    How is set() implemented internally?

    premium question
    completed

    Answer:

  • 62.

    What is the difference between @staticmethod and @classmethod?

    premium question
    completed

    Answer:

  • 63.

    Explain how you reverse a generator?

    premium question
    completed

    Answer:

  • 64.

    What is monkey patching? How to use it in Python?

    premium question
    completed

    Answer:

  • 65.

    Why are default values shared between objects?

    premium question
    completed

    Answer:

  • 66.

    Whenever you exit Python, is all memory de-allocated?

    premium question
    completed

    Answer:

  • 67.

    How is memory managed in Python?

    premium question
    completed

    Answer:

  • 68.

    What is Cython?

    premium question
    completed

    Answer:

  • 69.

    What is the difference between old style and new style classes in Python?

    premium question
    completed

    Answer:

  • 70.

    Why aren't python nested functions called closures?

    premium question
    completed

    Answer:

  • 71.

    What does an 'x = y or z' assignment do in Python?

    premium question
    completed

    Answer:

  • 72.

    What is the difference between deep and shallow copy?

    premium question
    completed

    Answer:

  • 73.

    What are metaclasses in Python?

    premium question
    completed

    Answer:

  • 74.

    How to work with transitive dependencies?

    premium question
    completed

    Answer:

  • 75.

    What are the advantages of NumPy over regular Python lists?

    premium question
    completed

    Answer:

  • 76.

    Is it a good idea to use multi-thread to speed your Python code?

    premium question
    completed

    Answer:

  • 77.

    Why Python (CPython and others) uses the GIL?

    premium question
    completed

    Answer:

  • 78.

    Is there a simple, elegant way to define singletons?

    premium question
    completed

    Answer:

  • 79.

    What is a global interpreter lock (GIL) and why is it an issue?

    premium question
    completed

    Answer:

  • 80.

    Why isn't all memory freed when Python exits?

    premium question
    completed

    Answer:

  • 81.

    Describe Python's garbage collection mechanism in brief.

    premium question
    completed

    Answer:

  • 82.

    Why use else in try/except construct in Python?

    premium question
    completed

    Answer:

  • 83.

    Why would you use metaclasses?

    premium question
    completed

    Answer:

  • 84.

    Is there any downside to the -O flag apart from missing on the built-in debugging information?

    premium question
    completed

    Answer:

  • 85.

    What does Python optimization (-O or PYTHONOPTIMIZE) do?

    premium question
    completed

    Answer:

  • 86.

    Will the code below work? Why or why not?

    premium question
    completed

    Answer:

  • 87.

    Create function that similar to os.walk

    premium question
    completed

    Answer:

  • 88.

    What will be the output of the code below?

    premium question
    completed

    Answer:

  • 89.

    How to make a chain of function decorators?

    premium question
    completed

    Answer:

  • 90.

    How do I write a function with output parameters (call by reference)

    premium question
    completed

    Answer:

  • 91.

    What will be returned by this code?

    premium question
    completed

    Answer:

  • 92.

    Show me three different ways of fetching every third item in the list

    premium question
    completed

    Answer:

  • 93.

    How to read a 8GB file in Python?

    premium question
    completed

    Answer:

  • 94.

    How should one access nonlocal variables in closures in python 2.x?

    premium question
    completed

    Answer:

  • 95.

    What will this code return?

    premium question
    completed

    Answer:

  • 96.

    How do I access a module written in Python from C?

    premium question
    completed

    Answer:

One tip that got me hired by Google, Microsoft, and Stripe

I've worked for Microsoft, Google, Stripe, and received offers from many other companies. One thing I learned when I was interviewing myself is that standard interview tips are woefully inadequate.

Reverse Tech Interview: Questions to Stump an Interviewer

Few people want to get into an uncomfortable environment or an unprofitable company with no prospects. If you’re wondering how to get a real feel for a company during an interview, you’re welcome. I’ll give a list of questions that interviewers don’t usually expect...

How to become a programmer, move to the US, and get a dream job

Are you curious about what you need to do to earn more than $15.000 a month, drive a Tesla, live in sunny California, and work at Google, Apple, Facebook, or Amazon?

11 Reactive Systems interview questions and answers for software engineers

Reactive systems are an architectural style that allows multiple individual applications to blend into one unit, reacting to their environment, while staying aware of each other. Here is a list of coding interview questions on Reactive Systems to help you get ready for your next data struc...

. Reactive Systems
34 Microservices interview questions and answers for software engineers

Microservice architecture – a variant of the service-oriented architecture structural style – arranges an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight. Here is a list of coding intervie...

. Microservices
7 Layering & Middleware interview questions for developers

Middleware in the context of distributed applications is software that provides services beyond those provided by the operating system to enable the various components of a distributed system to communicate and manage data. Middleware supports and simplifies complex distributed application...

. Layering & Middleware
55 Docker interview questions and answers for software engineers

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Here is a list of coding interview questions on Docker to help you get ready for your next data structures interview in 2021.

. Docker
23 Databases interview questions and answers for software engineers

A database is an organized collection of data, generally stored and accessed electronically from a computer system. Where databases are more complex they are often developed using formal design and modeling techniques. Here is a list of coding interview questions on Databases to help you g...

. Databases
21 Concurrency interview questions and answers for software engineers

In computer science, concurrency is the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the final outcome. Here is a list of coding interview questions on Concurrency to help you get ready for your n...

. Concurrency
13 CAP Theorem interview questions and answers for software engineers

In theoretical computer science, the CAP theorem, also named Brewer's theorem after computer scientist Eric Brewer, states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees: Consistency: Every read receives the ...

. CAP Theorem
Load more posts

Features

folder icon

Access all answers

Get the inside track on what to expect in your next tech interview. We offer you a collection of high quality technical interview questions to help you prepare for your next coding interview.

graph icon

Track progress

A smart interface helps you track your progress and focus on the topics you need. You can search through questions or sort them by difficulty or type.

clock icon

Save time

Save tens of hours searching for information on hundreds of low-quality sites designed to drive traffic and make money from advertising.

Land a six-figure job at one of the top companies.

amazon logo facebook logo google logo microsoft logo uber logo
Prepare for a technical interview

Get hired with our
tech interview questions & answers