Python Interview Questions for Freshers (India, 2026): Basics, OOP, Data Structures & Coding
Python is now one of the most-asked languages in fresher interviews in India — for developer, data analyst, testing and AI/ML roles at service companies like TCS, Infosys, Wipro and Accenture, and at startups. Interviewers want clear fundamentals, a small program written without help, and a project you can explain. Here are the question types you will actually face, grouped by topic, with what a good answer covers.
How Python is tested in fresher interviews
- Online assessment — MCQs on output prediction, data types and built-ins, plus one or two coding problems.
- Technical interview — core concepts, a short program written live, and questions on your project.
- Role depth — data roles add pandas and SQL; developer roles add OOP and APIs; AI/ML roles add NumPy and basic ML.
- HR round — communication, relocation and why you chose this role or company.
Selection steps and test sections change between hiring drives. Always confirm the current pattern on the company's official careers page or your drive invitation before you prepare.
Python basics
- What is Python? Why is it called interpreted and dynamically typed?
- What are Python's built-in data types?
- Difference between a list and a tuple. When would you use each?
- Difference between mutable and immutable objects, with examples.
- Difference between == and is.
- What are *args and **kwargs?
- What is PEP 8 and why does it matter?
- How is memory managed in Python? What does garbage collection do?
Data structures and built-ins
- How does a dictionary work? What can be a dictionary key?
- Difference between a set and a list. How do you remove duplicates from a list?
- What is list comprehension? Write one that squares even numbers.
- Difference between append() and extend().
- What is slicing? What does my_list[::-1] return?
- Explain map(), filter() and lambda with an example.
OOP in Python
- Explain classes and objects with an example from your project.
- What is __init__ and what is self?
- Explain inheritance, including multiple inheritance.
- What are instance, class and static methods?
- What are dunder methods like __str__ and __len__?
- How does Python support encapsulation if there is no private keyword?
Exceptions, files and advanced topics
- How do try, except, else and finally work together?
- How do you read and write a file? Why use the with statement?
- What is a generator? How is yield different from return?
- What is a decorator? Write a simple one that logs a function call.
- Difference between shallow copy and deep copy.
- What are modules and packages? What does if __name__ == '__main__' do?
- What is the GIL, and how does it affect multithreading?
Coding programs to practise in Python
- Reverse a string and check whether it is a palindrome.
- Check prime numbers, print the Fibonacci series, find the factorial (loop and recursion).
- Count the frequency of each character or word using a dictionary.
- Find the second largest number in a list without sort().
- Remove duplicates from a list while keeping the order.
- Check whether two strings are anagrams.
- Find the missing number in a list from 1 to n.
- Swap two numbers without a third variable.
Say your approach out loud before writing code, then mention the time complexity. Interviewers score your reasoning, not just the final output.
For data analyst and AI/ML roles
- Difference between a NumPy array and a Python list.
- How do you handle missing values in a pandas DataFrame?
- Explain groupby, merge and pivot_table in pandas.
- Walk me through cleaning a dataset you worked on.
Project and HR questions
- Explain your project. Which Python libraries did you use and why?
- What was the hardest bug you fixed?
- Tell me about yourself.
- Why should we hire you as a Python developer?
2-week Python prep plan
- Days 1–3: basics and data types — write your own one-line answer for each question above.
- Days 4–5: lists, dictionaries, sets, comprehensions and built-ins, with small programs.
- Days 6–7: OOP and exceptions.
- Day 8: generators, decorators, copying and modules.
- Days 9–11: two coding programs a day from the list, written without an IDE.
- Day 12: prepare a 2-minute project explanation and 'tell me about yourself'.
- Days 13–14: take full mock interviews out loud and fix the weak answers.
Recommended next action
Take the next concrete step — it's free, takes under a minute, and gives you a real score to act on.