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.

HardSystem Design
0 practiced
Design a memory-efficient Python data ingestion pipeline to stream terabytes of training data from object storage to a training loop. Consider chunking, prefetching, shuffling (reproducible), buffering, multi-process readers, fault tolerance, local caching, and throughput/latency trade-offs for an AI training workload.
MediumTechnical
0 practiced
Write pytest-style unit tests for a function top_n_words(filepath, n) that returns the n most common words. Include tests for empty files, ties, punctuation handling, and non-UTF-8 files (expected to raise an appropriate exception). Describe fixtures and mocking strategies you would use.
MediumTechnical
0 practiced
For each of these operations, state average and worst-case time complexity in CPython and briefly explain why: list.append, list.pop() from end, list.pop(0), dict lookup, dict insertion, set membership, list concatenation using +, collections.deque appendleft. Mention any surprising performance pitfalls.
MediumTechnical
0 practiced
Explain Python concurrency choices and recommend an approach to parallelize CPU-bound preprocessing of image files on a multicore machine. Discuss threading vs multiprocessing vs async IO, pickling costs for ProcessPool, shared-memory strategies, and considerations when GPUs are also present.
EasyTechnical
0 practiced
Implement merge_dicts_sum(a, b) that merges two dictionaries mapping strings to integers returning a new dictionary where values for shared keys are summed. Provide an idiomatic, efficient implementation and state its time and space complexity.

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.