Python Interview Questions – Introduction & Fundamentals
1. [Asked in Infosys] What is Python, and why is it popular?
Answer: Python is a high-level, interpreted programming language known for its simplicity and readability. It is popular due to its vast libraries, easy syntax, and versatility in web development, data science, automation, and AI.
2. [Asked in Accenture] What are the key features of Python?
Answer:
- Easy to learn and use
- Interpreted language
- Dynamically typed
- Open-source and community-supported
- Extensive libraries
- Portable and cross-platform
3. [Asked in TCS] Is Python compiled or interpreted?
Answer: Python is an interpreted language, meaning code is executed line by line without needing compilation.
4. [Asked in Cognizant] What is PEP 8?
Answer: PEP 8 is the Python Enhancement Proposal that provides guidelines for writing clean and readable Python code.
5. [Asked in Capgemini] How is Python different from other programming languages?
Answer: Python has a simpler syntax, extensive built-in libraries, and dynamic typing, making it easier than languages like Java or C++.
6. [Asked in Wipro] What are Python’s applications?
Answer: Web development, Data Science, Machine Learning, Automation, Game Development, Embedded Systems, and Networking.
7. [Asked in Deloitte] What is the latest stable version of Python?
Answer: Check Python’s official website python.org for the latest version, as it gets updated frequently.
8. [Asked in HCL] What is the difference between Python 2 and Python 3?
Answer: Python 3 introduced improvements like better Unicode support, print as a function, and integer division returning a float. Python 2 is no longer maintained.
9. [Asked in IBM] How do you run a Python script?
Answer: You can run a Python script using the command:
python script.py # For Python 2
python3 script.py # For Python 3
10. [Asked in Tech Mahindra] What is a dynamically typed language?
Answer: In Python, variables do not require explicit declaration. The type is determined at runtime.
