InterviewStack.io LogoInterviewStack.io

Python Fundamentals and Problem Solving Questions

Comprehensive knowledge of the Python programming language, idiomatic usage, and the ability to implement correct, readable, and testable solutions to coding problems. Core language elements include syntax and semantics, primitive and composite data types such as integers, floats, strings, lists, dictionaries, sets, and tuples, sequence and mapping operations, control flow constructs, functions and closures, and object oriented programming basics including classes, instances, inheritance, and special methods. Additional practical topics include error and exception handling, file input and output operations, comprehensions and generator expressions, generator functions and iteration protocols, context managers, lambda functions, unpacking, and common standard library utilities. Candidates should understand algorithmic time and space complexity for common operations, typical performance characteristics of lists and dictionaries, and common pitfalls such as mutable default arguments and shared mutable state. Interview focused expectations include writing clean correct code without editor assistance, sensible variable naming, implementing basic algorithms and data structure manipulations under time constraints, reasoning about tradeoffs and complexity, and demonstrating testability and code quality.

MediumTechnical
55 practiced
Describe the most commonly used itertools functions (chain, islice, groupby, accumulate, combinations). Give a concrete example showing how itertools.chain and islice can be used to process many small iterables lazily without extra memory overhead.
HardTechnical
51 practiced
Explain the Global Interpreter Lock (GIL) in CPython: why it exists, how it affects multi-threaded programs doing CPU-bound work, strategies to work around it (multiprocessing, C extensions releasing GIL, subinterpreters), and practical implications for AI workloads that use heavy C libraries like NumPy and PyTorch.
HardTechnical
82 practiced
Discuss best practices for serializing and saving large machine learning models and state in Python. Cover pickle pitfalls (security, versioning), joblib and memory-mapped approaches, atomic checkpointing, storing optimizer state, and recommendations for cross-language interoperability (e.g., ONNX or HDF5).
HardTechnical
55 practiced
Implement a thread-safe cached_property descriptor: the first access computes the value and caches it on the instance, subsequent accesses return the cached value, and deleting the attribute forces recomputation. Ensure the implementation avoids race conditions when used by multiple threads.
MediumTechnical
46 practiced
Write a generator iterate_gz_lines(paths) that yields non-empty, stripped lines from multiple gzipped files lazily. Each file should be opened only when needed and closed promptly. Use only standard library components and ensure memory usage stays small for very large files.

Unlock Full Question Bank

Get access to hundreds of Python Fundamentals and Problem Solving interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.