InterviewStack.io LogoInterviewStack.io

Python Fundamentals and Core Syntax Questions

Comprehensive knowledge of core Python language features and syntax, including primitive and composite data types such as integer numbers, floating point numbers, strings, booleans, lists, dictionaries, sets, and tuples. Candidates should understand variable assignment and naming, operators for arithmetic, logical, and comparison operations, and control flow constructs including conditional statements and loops. Expect familiarity with function definition, invocation, parameter passing, return values, and scope rules, as well as common built in functions and idioms such as iteration utilities, list comprehensions, generator expressions, and basic functional utilities like map and filter. Candidates should demonstrate error and exception handling techniques and best practices for writing readable and maintainable code with modularization and clear naming. Practical skills include file input and output, working with common data formats such as comma separated values and JavaScript Object Notation, selecting appropriate data structures with attention to performance and memory characteristics, and applying memory efficient patterns for processing large data sets using iterators and generators. Familiarity with the standard library and common utilities for parsing and transforming data, and the ability to write small code snippets to solve algorithmic and data manipulation tasks, are expected.

MediumTechnical
86 practiced
Write Python 3 code that reads a large NDJSON file and writes a standard JSON array to an output file without loading all objects into memory. Ensure proper JSON formatting (commas between items, no trailing comma). Discuss how to make the write atomic and how to test this behavior.
MediumTechnical
82 practiced
Explain the Python Global Interpreter Lock (GIL): what it is, how it affects CPU-bound vs IO-bound workloads, and what options a data engineer has to parallelize Python code for CPU-heavy data transformations. Discuss trade-offs between threading, multiprocessing, and using native extensions.
MediumTechnical
86 practiced
Write a Python 3 generator unique_everseen(iterable, key=None) that yields unique elements from the input preserving first-seen order. The function should work well for streaming sources. Explain memory trade-offs and how you would adapt the approach if keys are unhashable or if the unique key-space is too large for memory.
MediumTechnical
114 practiced
Tell me about a time when you discovered a performance or correctness issue in a Python-based data pipeline. Use the STAR method: describe the Situation, the Task you were responsible for, the Actions you took (technical and non-technical), and the Results (quantified if possible). Emphasize how you prioritized fixes, communicated with stakeholders, and verified the improvement.
EasyTechnical
71 practiced
Write increment_nested_counter(store, key1, key2, delta=1) in Python 3 that safely increments nested counters represented as a dict-of-dicts, leveraging collections.defaultdict to simplify initialization. Show how you would initialize such a store and explain why this pattern is useful in ETL aggregation code.

Unlock Full Question Bank

Get access to hundreds of Python Fundamentals and Core Syntax interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.