FullStackFSCCafé
 
 
Sign in with GoogleSign in with Google. Opens in new tab
Kill Your Tech Interview
3877 Full-Stack, Algorithms & System Design Interview Questions
Answered To Get Your Next Six-Figure Job Offer
      
🤖 Having Machine Learning & DS Interview? Check  MLStack.Cafe - 1704 Data Science & ML Interview Questions & Answers!Having ML & DS Interview? Check 🤖 MLStack.Cafe - 1704 ML & DS Interview Questions and Answers

Top 112 Python Interview Questions

Entry Junior Mid Senior Expert
Sign in with GoogleSign in with Google. Opens in new tab
Topic Progress:

Theoretical Questions

Q1:   

What are the built-in types available In Python?

  
Add to PDF   Entry 
Q2:   

How do I modify a string?

  
Add to PDF   Entry 
Q3:   

Name some characteristics of Python?

  
Add to PDF   Entry 
Q4:   

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

  
Add to PDF   Junior 
Q5:   

How the string does get converted to a number?

  
Add to PDF   Junior 
Q6:   

What is Lambda Functions in Python?

  
Add to PDF   Junior 
Q7:   

Does Python have a switch-case statement?

  
Add to PDF   Junior 
Q8:   

What are descriptors?

  
Add to PDF   Junior 
Q9:   

What are local variables and global variables in Python?

  
Add to PDF   Junior 
Q10:   

Name some benefits of Python

  
Add to PDF   Junior 
Q11:   

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

  
Add to PDF   Junior 
Q12:   

What is Negative Index in Python?

  
Add to PDF   Junior 
Q13:   

Explain what is Linear (Sequential) Search and when may we use one?

 JSPY Related To: Searching, JavaScript
Add to PDF   Junior 
Q14:   

What is a None value?

  
 Add to PDF   Mid 
Q15:   

Is it possible to have static methods in Python?

  
 Add to PDF   Mid 
Q16:   

What is the python with statement designed for?

  
 Add to PDF   Mid 
Q17:   

Explain the UnboundLocalError exception and how to avoid it?

  
 Add to PDF   Mid 
Q18:   

What is Pickling and Unpickling?

  
 Add to PDF   Mid 
Q19:   

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

  
 Add to PDF   Mid 
Q20:   

How can you share global variables across modules?

  
 Add to PDF   Mid 
Q21:   

What is the function of self?

  
 Add to PDF   Mid 
Q22:   

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

  
 Add to PDF   Mid 
Q23:   

What is a Callable?

  
 Add to PDF   Mid 
Q24:   

What are virtualenvs?

  
 Add to PDF   Mid 
Q25:   

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

  
 Add to PDF   Mid 
Q26:   

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

  
 Add to PDF   Mid 
Q27:   

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

  
 Add to PDF   Mid 
Q28:   

What are the Wheels and Eggs? What is the difference?

  
 Add to PDF   Mid 
Q29:   

What are the key differences between Python 2 and 3?

  
 Add to PDF   Mid 
Q30:   

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

  
 Add to PDF   Mid 
Q31:   

Explain how to use Slicing in Python?

  
 Add to PDF   Mid 
Q32:   

Explain what is Interpolation Search

 JSPY Related To: Searching, JavaScript
 Add to PDF   Mid 
Q33:   

What is a Jump (or Block) Search?

 JSJavaPY Related To: Searching, JavaScript
 Add to PDF   Mid 
Q34:   

Explain how does Python memory management work?

  
 Add to PDF   Mid 
Q35:   

Why would you use the pass statement?

  
 Add to PDF   Mid 
Q36:   

What is introspection/reflection and does Python support it?

  
 Add to PDF   Mid 
Q37:   

What are Decorators in Python?

  
 Add to PDF   Mid 
Q38:   

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

  
 Add to PDF   Mid 
Q39:   

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

  
 Add to PDF   Mid 
Q40:   

What is Monkey Patching and is it ever a good idea?

  
 Add to PDF   Mid 
Q41:   

What's the difference between lists and tuples?

  
 Add to PDF   Mid 
Q42:   

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

  
 Add to PDF   Mid 
Q43:   

What are immutable objects in Python?

  
 Add to PDF   Mid 
Q44:   

What is the difference between a function decorated with @staticmethod and one decorated with @classmethod?

  
 Add to PDF   Senior 
Q45:   

Why are default values shared between objects?

  
 Add to PDF   Senior 
Q46:   

What is Monkey Patching? How to use it in Python?

  
 Add to PDF   Senior 
Q47:   

Explain how you reverse a generator?

  
 Add to PDF   Senior 
Q48:   

How is memory managed in Python?

  
 Add to PDF   Senior 
Q49:   

What is Cython?

  
 Add to PDF   Senior 
Q50:   

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

  
 Add to PDF   Senior 
Q51:   

Why aren't Python nested functions called closures?

  
 Add to PDF   Senior 
Q52:   

What is the difference between deep and shallow copy?

  
 Add to PDF   Senior 
Q53:   

Why Python (CPython and others) uses the GIL?

  
 Add to PDF   Senior 
Q54:   

What are metaclasses in Python?

  
 Add to PDF   Senior 
Q55:   

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

  
 Add to PDF   Senior 
Q56:   

What are the advantages of NumPy over regular Python lists?

  
 Add to PDF   Senior 
Q57:   

How to work with transitive dependencies?

  
 Add to PDF   Senior 
Q58:   

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

  
 Add to PDF   Senior 
Q59:   

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

  
 Add to PDF   Senior 
Q60:   

Why are Python's private methods not actually private?

  
 Add to PDF   Senior 
Q61:   

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

  
 Add to PDF   Senior 
Q62:   

What is an alternative to GIL?

  
 Add to PDF   Senior 
Q63:   

What is GIL?

  
 Add to PDF   Senior 
Q64:   

What is MRO in Python? How does it work?

  
 Add to PDF   Senior 
Q65:   

What is the difference between @staticmethod and @classmethod?

  
 Add to PDF   Senior 
Q66:   

How is set() implemented internally?

  
 Add to PDF   Senior 
Q67:   

Why would you use metaclasses?

  
 Add to PDF   Expert 
Q68:   

Why use else in try/except construct in Python?

  
 Add to PDF   Expert 
Q69:   

Describe Python's Garbage Collection mechanism in brief

  
 Add to PDF   Expert 
Q70:   

Why isn't all memory freed when Python exits?

  
 Add to PDF   Expert 
Q71:   

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

  
 Add to PDF   Expert 
Q72:   

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

  
 Add to PDF   Expert 
Q73:   

Is there a simple, elegant way to define singletons?

  
 Add to PDF   Expert 
Q74:   

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

  
 Add to PDF   Expert 

Code Challenges

Q1:   

Return the N-th value of the Fibonacci sequence. Solve in O(n) time

 JSJavaPY Related To: Fibonacci Series, Data Structures, JavaScript
 Add to PDF   Junior 
Q2:   

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

  
 Add to PDF   Junior 
Q3:   

Implement Pre-order Traversal of Binary Tree using Recursion

 JavaPY Related To: Binary Tree, Data Structures
 Add to PDF   Junior 
Q4:   

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

  
 Add to PDF   Junior 
Q5:   

Explain how Insertion Sort works

 JSJavaPY Related To: Sorting, JavaScript
 Add to PDF   Junior 
Q6:   

Convert a Singly Linked List to Circular Linked List

 PY Related To: Linked Lists, Data Structures
 Add to PDF   Junior 
Q7:   

How to implement a Tree data-structure? Provide some code.

 JavaPY Related To: Binary Tree, Trees, Data Structures
 Add to PDF   Junior 
Q8:   

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

  
  Add to PDF   Mid 
Q9:   

How do I check if a list is empty?

  
  Add to PDF   Mid 
Q10:   

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

  
  Add to PDF   Mid 
Q11:   

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

  
  Add to PDF   Mid 
Q12:   

How to merge two sorted Arrays into a Sorted Array?

 JSJavaPY Related To: Arrays, Data Structures, Java, JavaScript
  Add to PDF   Mid 
Q13:   

Split the Linked List into k consecutive linked list "parts"

 JavaPY Related To: Linked Lists
  Add to PDF   Mid 
Q14:   

How to check if String is a Palindrome?

 JavaPY Related To: Strings
  Add to PDF   Mid 
Q15:   

Write a program for Recursive Binary Search

 JSJavaPY Related To: Searching, Java, JavaScript
  Add to PDF   Mid 
Q16:   

Sum two numbers represented as Linked Lists

 JavaPY Related To: Linked Lists
  Add to PDF   Mid 
Q17:   

Find all the Permutations of a String

 JSJavaPY Related To: Backtracking, Strings, Data Structures, Java, JavaScript
  Add to PDF   Mid 
Q18:   

Check if parentheses are balanced using Stack

 JSJavaPY Related To: Stacks, Java, JavaScript
  Add to PDF   Mid 
Q19:   

Merge two sorted singly Linked Lists without creating new nodes

 JavaPY Related To: Linked Lists
  Add to PDF   Mid 
Q20:   

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

  
  Add to PDF   Mid 
Q21:   

Display startNumber to endNumber only from Fibonacci Sequence

 PY Related To: Fibonacci Series
  Add to PDF   Mid 
Q22:   

LIS: Find length of the longest increasing subsequence (LIS) in the array. Solve using DP.

 JSJavaPY Related To: Dynamic Programming, Data Structures, JavaScript
  Add to PDF   Mid 
Q23:   

Floyd's Cycle Detect Algorithm: How to detect a Cycle (or Loop) in a Linked List?

 JavaPY Related To: Linked Lists
  Add to PDF   Mid 
Q24:   

Is this valid in Python and why?

  
  Add to PDF   Mid 
Q25:   

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

  
  Add to PDF   Senior 
Q26:   

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

  
  Add to PDF   Senior 
Q27:   

Explain how Radix Sort works

 JSPY Related To: Sorting, JavaScript
  Add to PDF   Senior 
Q28:   

Given a singly Linked List, determine if it is a Palindrome

 JavaPY Related To: Linked Lists, Java
  Add to PDF   Senior 
Q29:   

Will the code below work? Why or why not?

  
  Add to PDF   Senior 
Q30:   

Create function that similar to os.walk

  
  Add to PDF   Senior 
Q31:   

What will be the output of the code below?

  
  Add to PDF   Senior 
Q32:   

How to make a chain of function decorators?

  
  Add to PDF   Senior 
Q33:   

What will be returned by this code?

  
  Add to PDF   Senior 
Q34:   

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

  
  Add to PDF   Senior 
Q35:   

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

  
  Add to PDF   Expert 
Q36:   

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

  
  Add to PDF   Expert 
Q37:   

What will this code return?

  
  Add to PDF   Expert 
Q38:   

How to read a 8GB file in Python?

  
  Add to PDF   Expert 
 

Rust has been Stack Overflow’s most loved language for four years in a row and emerged as a compelling language choice for both backend and system developers, offering a unique combination of memory safety, performance, concurrency without Data races...

Clean Architecture provides a clear and modular structure for building software systems, separating business rules from implementation details. It promotes maintainability by allowing for easier updates and changes to specific components without affe...

Azure Service Bus is a crucial component for Azure cloud developers as it provides reliable and scalable messaging capabilities. It enables decoupled communication between different components of a distributed system, promoting flexibility and resili...

Cosmos DB has gained popularity among developers and organizations across various industries, including finance, e-commerce, gaming, IoT, and more. Follow along and learn the 24 most common and advanced Azure Cosmos DB interview questions and answers...
More than any other NoSQL database, and dramatically more than any relational database, MongoDB's document-oriented data model makes it exceptionally easy to add or change fields, among other things. It unlocks Iteration on the project. Iteration f...
Unit Tests and Test Driven Development (TDD) help you really understand the design of the code you are working on. Instead of writing code to do something, you are starting by outlining all the conditions you are subjecting the code to and what outpu...
Domain-Driven Design is nothing magical but it is crucial to understand the importance of Ubiquitous Language, Domain Modeling, Context Mapping, extracting the Bounded Contexts correctly, designing efficient Aggregates and etc. before your next DDD p...
At its core, Microsoft Azure is a public cloud computing platform - with solutions including Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) that can be used for services such as analytics, virtual c...
As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications. Follow along to refresh your knowledge and explore the 52 most frequently asked and advanced Node JS Interview Questions and Answers every...
Dependency Injection is most useful when you're aiming for code reuse, versatility and robustness to changes in your problem domain. DI is also useful for decoupling your system. DI also allows easier unit testing without having to hit a database and...