InterviewStack.io LogoInterviewStack.io

Python Programming and Libraries Questions

Practical knowledge of the Python programming language and commonly used data science libraries. Expect assessment of idiomatic syntax, core data structures, and libraries such as NumPy and Pandas for efficient array and table operations. Candidates should demonstrate writing clear, maintainable, and testable code using list comprehensions, generators, vectorized operations, and proper memory use. Topics include debugging and profiling workflows, performance optimization techniques, packaging and dependency management, basic concurrency and asynchronous patterns, unit testing, and reproducible development practices.

HardTechnical
93 practiced
Implement a thread-safe LRU cache decorator in Python without using functools.lru_cache (you may use threading primitives). The decorator should accept a maxsize and be safe for concurrent access by multiple threads. Discuss complexity and potential contention points.
MediumTechnical
80 practiced
Implement a function top_k_frequent(iterable, k) that returns the k most frequent items and their counts. Your solution must handle very large iterables (possibly streaming) and have O(n) expected time with O(k) additional memory where possible. Use Python.
EasyTechnical
93 practiced
Given a NumPy array a of shape (N, M), write Python code to compute a boolean mask of rows that contain any NaN using vectorized NumPy operations. Do not use Python loops.
MediumTechnical
144 practiced
Explain how vectorized operations in NumPy and Pandas can be faster than explicit Python loops. Describe one situation where vectorization might be slower and why.
MediumTechnical
97 practiced
A data pipeline intermittently produces different results on different runs (non-deterministic). List possible Python-language and library causes (e.g., dict ordering, floating-point reductions, parallelism) and propose concrete fixes to achieve determinism for production runs.

Unlock Full Question Bank

Get access to hundreds of Python Programming and Libraries interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.