Python Interview Questions and Answers
fresher Interview Questions & Answers
Q1. What is Python?
Ans: Python is a high-level, interpreted programming language known for readability.
Q2. What are Python's key features?
Ans: Simple syntax, dynamic typing, interpreted, object-oriented, and vast libraries.
Q3. What is a list in Python?
Ans: A list is an ordered, mutable collection of items.
Q4. What is a tuple?
Ans: A tuple is an ordered, immutable collection of items.
Q5. What is a dictionary?
Ans: A dictionary is a key-value pair collection used for fast lookups.
Q6. How do you write a function in Python?
Ans: Using the def keyword followed by function name and parameters.
Q7. What is indentation in Python?
Ans: Indentation indicates a block of code and is mandatory.
Q8. What is PEP8?
Ans: PEP8 is a style guide for writing readable Python code.
Q9. What are Python data types?
Ans: Common types include int, float, str, list, tuple, dict, and bool.
Q10. What is a loop in Python?
Ans: A loop allows executing a block of code multiple times (for/while).
Q11. What is a module?
Ans: A module is a file containing Python definitions and functions.
Q12. What is a package in Python?
Ans: A package is a directory containing multiple modules with __init__.py file.
Q13. What is typecasting?
Ans: Typecasting is converting one data type into another, e.g., int to float.
Q14. What are Python libraries?
Ans: Pre-written code modules like NumPy, Pandas, Matplotlib, etc.
Q15. What is the use of comments?
Ans: Comments are used to describe code logic, ignored during execution.
