Core Python Fundamentals Interview Questions
Python syntax, data types, indentation, PEP 8, slicing, and interpreter basics.
- 20Questions with answers
- 3Difficulty levels
Questions (20)
Browse beginner, intermediate, and advanced questions with answers — hide them when you want to self-test.
What are the key features of Python?
Python is simple, interpreted, dynamically typed, object-oriented, and supports multiple programming paradigms with a large standard library.
What is Python?
Python is a high-level, interpreted programming language used for web development, data science, automation, and AI.
Is Python compiled or interpreted?
Python is an interpreted language, meaning code is executed line by line by the Python interpreter.
What are Python data types?
Common Python data types include int, float, str, list, tuple, set, dict, and bool.
What is type casting in Python?
Type casting is converting one data type into another using functions like int(), float(), str(), etc.
What is difference between list and tuple?
Lists are mutable, while tuples are immutable. Lists use [], tuples use ().
What is indentation in Python?
Indentation defines code blocks in Python and is mandatory for loops, functions, and conditionals.
What is a variable in Python?
A variable is a container for storing data values and does not require explicit type declaration.
What are keywords in Python?
Keywords are reserved words like if, else, for, while, def, class that have special meaning in Python.
What is PEP 8?
PEP 8 is the official Python style guide that defines coding conventions for readability and consistency.
What is the difference between is and ==?
== compares values, while is compares memory locations (identity).
What are comments in Python?
Comments are used to explain code and are ignored by the interpreter. They start with # or triple quotes.
What is slicing in Python?
Slicing is used to extract a portion of sequences like lists or strings using start:end:step syntax.
What is input() function?
input() is used to take user input from the console as a string.
What is Python interpreter?
The Python interpreter executes Python code line by line and converts it into machine-readable instructions.
Which Python built-ins or stdlib modules matter most for Core Python Fundamentals?
Name concrete modules (collections, itertools, pathlib, typing) and how they support Core Python Fundamentals. Prefer stdlib before third-party when it is enough.
How do mutable default arguments or late binding bite you with Core Python Fundamentals?
Explain the classic default-list bug and closures in loops. Show a safe pattern when Core Python Fundamentals uses defaults or lambdas.
What testing tools would you use for Core Python Fundamentals logic?
pytest with fixtures, parametrize, and coverage. Mock I/O at boundaries so Core Python Fundamentals unit tests stay deterministic.
How does typing improve Core Python Fundamentals maintainability?
Annotate public APIs, use mypy/pyright in CI, and prefer Protocols for duck typing. Catch Core Python Fundamentals contract breaks before runtime.
When would you choose a generator or comprehension for Core Python Fundamentals?
Generators save memory for large streams; comprehensions are clear for small transforms. Justify the choice for Core Python Fundamentals data sizes.
Practice with AI mock interviews
Run Python mock interviews with AI follow-ups, instant feedback, and analytics on AiLx.
Free to start · No credit card required