Detailed Python Interview Syllabus
1. Python Basics
Python is an interpreted, high-level, dynamically typed language used for general-purpose
programming.
- Syntax and Variables: Python uses indentation to define blocks. Variables are dynamically typed.
- Data Types: int, float, str, bool. Use type() to check data type.
- Type Conversion: Converting between types using int(), float(), str(), etc.
- Input/Output: input() to take user input, print() to display output.
- Operators: Includes arithmetic (+, -, *), comparison (==, !=), and logical (and, or, not) operators.
2. Control Flow
Control flow allows decision making and looping in programs.
- if/elif/else: Used for decision making.
- for loop: Iterates over a sequence (like list, string).
- while loop: Repeats until a condition is False.
- break: Exits loop early; continue: skips current iteration; pass: does nothing (placeholder).
3. Functions
Functions are reusable blocks of code.
- Defining functions using def keyword.
- Parameters are inputs; return sends back output.
- Lambda functions: anonymous one-liner functions for short operations.
- *args allows variable number of arguments; **kwargs allows keyword arguments.
4. Data Structures
Python provides built-in data structures for data storage and manipulation.
- Lists: Ordered, mutable collections. Supports indexing and slicing.
- Tuples: Ordered, immutable sequences.
- Sets: Unordered collections of unique elements.
- Dictionaries: Key-value pairs for fast lookup.
- List Comprehensions: Short syntax for creating lists from existing iterables.
5. Object-Oriented Programming (OOP)
OOP is a programming paradigm based on objects and classes.
- Class: A blueprint for creating objects.
- Object: An instance of a class.
- Constructor (__init__): Initializes object state.
- Inheritance: Allows a class to inherit attributes/methods from another.
- Polymorphism: Allows different classes to be treated as instances of the same class through
shared interfaces.
- Encapsulation: Hides internal state of an object from outside.
- Abstraction: Hides complex implementation details.
6. Modules and Packages
Modules are Python files with reusable functions/classes; Packages are directories with __init__.py.
- Importing built-in modules like math, random, datetime.
- Creating user-defined modules and using import statement.
- Python Standard Library contains many helpful modules for various tasks.
7. Exception Handling
Helps handle runtime errors gracefully.
- try: block to test code, except: to catch errors.
- finally: executes regardless of exception.
- raise: to manually throw exceptions.
- Custom exceptions can be created by inheriting Exception class.
8. File Handling
Reading/writing files using built-in functions.
- open(): Opens a file in read/write/append mode.
- read(), readline(), readlines(): Methods to read file content.
- write(), writelines(): Methods to write content to files.
- 'with' statement handles file closing automatically.
9. Python Libraries for DSA & Projects
- NumPy: For numerical computing using arrays, vectorized operations.
- Pandas: Powerful data analysis library using Series and DataFrame.
- Matplotlib/Seaborn: For data visualization (plots, charts, graphs).
- Scikit-learn: Provides tools for ML - regression, classification, clustering.
10. Interview Coding Practice
- String Problems: Reversing, palindrome check, frequency count.
- List/Array: Sorting, finding duplicates, rotating arrays.
- Dictionary: Counting frequency, grouping items.
- Recursion: Function calling itself - used in problems like factorial, Fibonacci.
- Backtracking: Solving problems by trying all possibilities - like N-Queens.
- Sorting: Bubble, Merge, Quick sort.
- Searching: Linear and Binary search algorithms.