What Python questions are asked in data interviews?
Data-role Python interviews focus on practical work, not trick puzzles: list and dictionary manipulation, string parsing, pandas DataFrame operations (filtering, groupby, merges), file and API handling, and writing small, clean functions. Product companies may add complexity questions; services companies stay closer to syntax and data-cleaning scenarios.
Python is a general-purpose programming language known for readable code and a large set of libraries. It is interpreted: you run the source file directly and the interpreter executes it as it goes, with no separate compile step you run first. Data teams use it to clean files, call APIs, transform tables with pandas and drive Spark through PySpark.
Example: a ten-line script that reads a CSV with pandas, drops duplicate orders, totals sales per city and writes a clean file back
Why it is called interpreted: CPython, the standard interpreter, compiles your code to bytecode when you run it and executes that bytecode in a virtual machine, instead of producing a machine-code program first
Why it is used: readable syntax, a library for almost every task (pandas, NumPy, requests), and the same language from a notebook to a production pipeline
Why it matters for jobs: Python was named in 28.5% of 17,748 Indian tech postings in PrepNPlaced's India Tech Hiring Report (23 August to 27 September 2026), the most of the 18 technologies the report counts
What is the difference between a list, a tuple, a set and a dictionary in Python?
A list is an ordered collection you can change; a tuple is an ordered collection you cannot change; a set holds unique values in no fixed order; a dictionary maps unique keys to values. Pick by two questions: will the contents change, and will you look items up by position, by membership or by key?
Python's four built-in collections, side by side
Dimension
list
tuple
set
dict
Written as
[1, 2, 2]
(1, 2, 2)
{1, 2}
{"a": 1, "b": 2}
Can change after creation
Yes
No
Yes
Yes
Keeps order
Yes, by position
Yes, by position
No
Yes, insertion order (Python 3.7+)
Duplicates
Allowed
Allowed
Removed
Keys unique; values can repeat
Look up by
Index: items[0]
Index: point[0]
Membership: x in s
Key: d["a"]
Usable as a dict key
No
Yes, if its items are hashable
No
No
Typical use
A sequence you append to
A fixed record such as (lat, lon)
Removing duplicates, fast membership tests
Lookups by key, such as a JSON record
Which Python basics do interviewers check?
For data roles, Python rounds often test readable problem solving, data structures, file handling, and whether you can write code that handles edge cases.
Lists, dictionaries, sets, tuples, and when to use each
Functions, arguments, return values, and scope
Exceptions, file reading, and input validation
Threads, processes or asyncio: which one does a Python job need?
Ask what the code is waiting on. If it waits on the network or disk, threads work with ordinary blocking libraries and asyncio scales further when the libraries are async-aware. If it burns CPU, only multiprocessing gets around the GIL in the standard interpreter, at the cost of pickling work between processes.
Pick by what the code waits on
Dimension
threading
multiprocessing
asyncio
Runs CPU work in parallel
No; the GIL runs one thread's bytecode at a time
Yes; each process has its own interpreter
No; everything runs on one thread
Good for
Blocking I/O with ordinary libraries
CPU-bound work such as parsing or maths
Thousands of sockets or HTTP calls at once
Memory
Shared with the main thread
Separate per process; work sent to a Pool is pickled
Shared; it is one thread
Sharing state safely
Locks, or a Queue
Queue, Pipe, or shared memory
Plain objects; tasks only switch at await
What the libraries must be
Anything, even if it blocks
Picklable functions and arguments
Async-aware, or one blocking call stalls the loop
Start-up cost
Low
Highest; a new interpreter per process
Lowest; a task is a coroutine object
How should you approach sample questions?
Practice explaining your approach before coding. A clear brute-force answer with edge cases is better than a clever answer you cannot debug.
Count word frequency from a text file
Group records by category using a dictionary
Remove duplicates while preserving order
Frequency hint
Normalize text, split into tokens, use a dictionary or Counter, and decide how to handle punctuation.
Data cleaning hint
State how you handle missing values, type conversion, invalid dates, and duplicate rows.
What does data-role Python practice involve?
For analytics and data engineering, Python questions may involve parsing files, calling APIs, transforming rows, or explaining pandas-style operations.
Read CSV or JSON safely
Transform records into a new schema
Explain apply, groupby, merge, and vectorized operations at a practical level
Which Python interview questions are asked to freshers, with the answers?
Fresher rounds use short problems that a screen can be read in thirty seconds. They are checking three things: that you know the built-in types, that you handle the empty case, and that you can say what your code prints before you run it. Each answer below is the version an interviewer accepts; say the output first.
Second largest number in a list, without sorting the whole list
Are two strings anagrams?
Count how many times each character appears
Flatten a list of lists
Sort a dictionary by its values
Reverse the words in a sentence, not the letters
Second largest without sort
nums = [4, 9, 1, 9, 7]; top = set(nums); top.remove(max(top)); print(max(top)) prints 7. The set removes the duplicate 9 so the answer is the second distinct value; sorted(nums)[-2] would print 9. Say which one the interviewer wants before choosing.
Anagram check
sorted('listen') == sorted('silent') is True. For long strings use collections.Counter(a) == Counter(b), which is linear. Mention that you lower-case and strip spaces first, or 'Dormitory' and 'dirty room' fail.
Character frequency
from collections import Counter; Counter('banana') gives Counter({'a': 3, 'n': 2, 'b': 1}). Without imports: freq = {}; for ch in s: freq[ch] = freq.get(ch, 0) + 1. Both are accepted; the dict.get version shows you understand the default.
Flatten one level
[x for row in [[1, 2], [3], []] for x in row] prints [1, 2, 3]. The empty inner list contributes nothing and does not raise. For unknown depth, write a recursive function that yields from lists and yields other values as they are.
Sort a dict by value
scores = {'asha': 82, 'bilal': 95, 'chitra': 78}; dict(sorted(scores.items(), key=lambda kv: kv[1], reverse=True)) gives bilal first. Dicts keep insertion order since Python 3.7, so the rebuilt dict stays sorted.
Reverse the words
' '.join('data analyst role'.split()[::-1]) prints 'role analyst data'. s[::-1] alone reverses letters, which is the wrong answer to this question and the right answer to the palindrome one.
What do Python questions for data work look like, with code?
For analyst and data-engineer screens the questions move to pandas, files and dates, and the interviewer wants the row count you expect before you run anything. Use this frame: orders with columns customer, city, amount and order_date, six rows across Bengaluru and Pune. Every answer below says what the output shape is.
Filter, then aggregate: total amount per city, sorted
Merge two frames and check the row count did not change
Fill missing values by group, not with one global number
Read a 5 GB CSV without loading it into memory
Parse dates that arrive in two formats
Keep the latest row per customer
Group and aggregate
df.groupby('city')['amount'].agg(total='sum', orders='count').sort_values('total', ascending=False). Output: one row per city, two columns, index = city. Add .reset_index() if the next step needs city as a column, and say so.
Merge with a row-count check
before = len(orders); merged = orders.merge(customers[['customer', 'segment']], on='customer', how='left'); assert len(merged) == before. If the assertion fails, customers has duplicate customer rows and every amount is now counted twice. The interviewer is checking that you know to look.
Fill missing by group
df['amount'] = df['amount'].fillna(df.groupby('city')['amount'].transform('median')). transform returns a series the same length as df, aligned on the index, so each NaN gets its own city's median rather than one number for everyone.
A CSV bigger than memory
for chunk in pd.read_csv('orders.csv', chunksize=500_000): totals = totals.add(chunk.groupby('city')['amount'].sum(), fill_value=0). Each chunk is aggregated and dropped; only the running totals stay in memory. Mention usecols and dtype to shrink each chunk further.
Two date formats in one column
pd.to_datetime(df['order_date'], format='mixed', errors='coerce') parses '2026-09-01' and '01/09/2026' and turns anything unparseable into NaT instead of raising. Then df['order_date'].isna().sum() tells you how many rows to go and look at.
Latest row per customer
df.sort_values(['customer', 'order_date']).drop_duplicates('customer', keep='last'). Sorting first is what makes 'last' mean latest; drop_duplicates alone keeps whichever row happened to come first in the file.
Where do candidates lose points?
Many candidates lose points by ignoring edge cases, mutating inputs unexpectedly, writing unreadable one-liners, or not explaining complexity.
No handling for empty input
Confusing shallow and deep copies
Using broad exceptions without explaining why
What changes in Python interviews at two to five years of experience?
The problems get smaller and the questions around them get bigger. You will still write a function, but the interviewer then asks what happens when the API times out, the file is empty, the job runs twice, or the input doubles in size. Answers that name the failure and the guard for it are what separate a mid-level offer from another fresher band.
A retry with backoff for a flaky API call, and when not to retry
Why a generator, and what it costs you (one pass, no len)
Threads versus processes versus asyncio: which one for I/O, which for CPU
Logging that says which record failed, not just that something did
Making an ETL script safe to run twice
Retry with backoff
for attempt in range(3): try: return fetch(url) except requests.Timeout: time.sleep(2 ** attempt). Retry timeouts and 5xx responses; never retry a 4xx, because the request itself is wrong and three identical attempts change nothing. Say what happens after the last attempt: raise, or log and skip the record.
Threads, processes or asyncio
Downloading 200 files is I/O-bound: threads or asyncio, because the GIL is released while waiting on the network. Parsing 200 large XML files is CPU-bound: multiprocessing, one process per core. Picking threads for CPU work is the classic wrong answer, and explaining why (the GIL) is the classic right one.
Run-twice safety
Write output to a temp name and rename at the end, so a crash halfway leaves no half file; load with an upsert keyed on the record id rather than a plain append; record the source file's hash so a rerun skips what it already processed. The word the interviewer is listening for is idempotent.
Logging that helps at 2 a.m.
logger.error('row %s in %s failed: %s', row_id, path, exc) beats print('error'). Include the identifier that lets someone find the record, log at the boundary where the error is handled once, and let unexpected exceptions propagate so the scheduler marks the job failed.
Which answered Python questions come up repeatedly?
Answered questions that come up repeatedly in data and automation rounds. Aim for a clear, correct explanation over a clever one-liner.
Data structures and copies
Comprehensions and generators
Practical pandas reasoning
List vs tuple
Lists are mutable; tuples are immutable and hashable, so a tuple can be a dict key or set member and signals a fixed record. Use a tuple when the collection should not change.
Shallow vs deep copy
copy.copy() copies the outer object but shares nested objects, while copy.deepcopy() recursively copies everything. After a shallow copy, mutating a nested list changes both copies.
is vs ==
== compares values; is compares identity (the same object in memory). Use == for equality and reserve is for checks like 'if x is None'.
Mutable default argument trap
def f(x, acc=[]) reuses the same list across calls because the default is created once. Use acc=None, then set acc = acc or [] inside the function.
Count word frequency from a file
Read the file, lower-case and split into tokens, then use collections.Counter(tokens). Counter.most_common(n) returns the top n words; decide how to strip punctuation first.
Generators vs lists
A generator yields items lazily with near-constant memory, ideal for large or streaming files; a list holds everything at once. Use yield or a generator expression for big data.
Remove duplicates preserving order
Use dict.fromkeys(items) which keeps first-seen order, or loop with a seen set. A plain set() removes duplicates but loses order.
groupby and merge in pandas
df.groupby('key')['val'].agg(...) splits rows by key and aggregates each group; pd.merge(a, b, on='key', how='left') joins like SQL. Watch many-to-many keys, which inflate row counts.
Question bank
22 interview questions with answers
Real questions from beginner to advanced, each with a concise model answer — practice them, then rehearse live in a mock interview. Every answer is open; collapse any you have already covered.
BeginnerWhat is the difference between a list and a tuple in Python?
A list is mutable — you can append, remove and reassign elements — while a tuple is immutable: once created, its contents cannot change. Lists use square brackets ([1, 2]), tuples use parentheses ((1, 2)). Because tuples are immutable they are hashable (usable as dict keys and set members) when their elements are hashable, slightly faster to iterate, and safer as 'records' whose shape should never change — like (lat, lon) coordinates. Interviewers often follow up with: a tuple containing a list, e.g. t = ([1], 2), is still a tuple, but t[0].append(3) works — immutability applies to the tuple's references, not to the objects they point at.
BeginnerWhat is the difference between a list and a set?
A list is ordered, allows duplicates, and supports indexing/slicing. A set is unordered, stores only unique hashable elements, and supports O(1) average membership tests plus set algebra (union |, intersection &, difference -). Use a set when the question is 'have I seen this before?' — converting a lookup loop from list to set turns an O(n²) de-duplication into O(n). The classic interview demonstration: len(set(items)) < len(items) detects duplicates in one line. Caveat: sets cannot hold unhashable values like lists or dicts, and they do not preserve insertion order (dict does, since Python 3.7).
BeginnerWhat are mutable and immutable types in Python?
Mutable objects can change in place after creation: list, dict, set, bytearray, most user-defined classes. Immutable objects cannot: int, float, str, tuple, frozenset, bytes. This matters in three places interviewers probe. (1) Function arguments: passing a mutable object lets the callee modify the caller's data. (2) Default arguments: def f(x=[]) shares ONE list across all calls. (3) 'Modifying' a string like s += 'x' actually allocates a new string each time — which is why ''.join(parts) beats += in a loop. Identity check: after s = 'ab'; s += 'c', id(s) has changed; after lst.append(3), id(lst) has not.
BeginnerWhat is the difference between '==' and 'is'?
== compares values by calling __eq__; is compares identity — whether both names point at the same object in memory. [1,2] == [1,2] is True, but [1,2] is [1,2] is False because they are two distinct objects. The only idiomatic uses of is are for singletons: x is None, x is True, x is NotImplemented. The interview trap: small integers (-5..256) and short strings are interned by CPython, so 256 is 256 happens to be True while 257 is 257 may be False — code relying on that is broken by design, which is exactly why comparisons should use ==.
BeginnerWhat is a list comprehension?
A list comprehension builds a list from an iterable in a single expression:
python
squares = [x*x for x inrange(10) if x % 2 == 0]
It replaces a for-loop with append, is usually faster (the loop runs in C), and reads declaratively. Variants: dict comprehensions {k: v for ...}, set comprehensions {x for ...}, and generator expressions (x for ...) which produce items lazily instead of materialising a list. Interview follow-up: nested comprehensions flatten a matrix — the for-clauses read left-to-right in the same order as nested loops:
python
[cell for row in grid for cell in row]
Prefer a plain loop when the logic needs multiple statements; an unreadable comprehension is worse than a loop.
BeginnerWhat are *args and **kwargs?
*args collects extra positional arguments into a tuple; **kwargs collects extra keyword arguments into a dict. def f(*args, **kwargs) accepts any call signature, which is how decorators and wrappers forward arguments unchanged: return func(*args, **kwargs). The same stars unpack in the other direction at call sites: f(*[1,2], **{'x': 3}) is f(1, 2, x=3). Two details worth volunteering: parameters after * are keyword-only (def f(a, *, b) forces f(1, b=2)), and Python 3.8's / marks positional-only parameters. Order in a signature is: positional, *args, keyword-only, **kwargs.
BeginnerHow does Python manage memory?
CPython uses reference counting as its primary mechanism — every object tracks how many references point to it, and when the count hits zero the memory is freed immediately. A cyclic garbage collector supplements this, because reference counting alone cannot free reference cycles (a.b = b; b.a = a). Small objects are allocated from pooled arenas by pymalloc rather than the OS directly. Practical implications interviewers look for: del removes a name, not necessarily the object; sys.getrefcount(x) shows the count (plus one for the call itself); circular references with __del__ used to be uncollectable; and long-running processes can hold memory because arenas are not always returned to the OS — which is why large batch jobs often fork workers instead.
IntermediateWhat is the difference between a generator and a list?
A list materialises every element in memory immediately; a generator produces elements one at a time, on demand, remembering its position between next() calls.
python
gen = (x*x for x inrange(10**9))
That is instant and uses constant memory, while the list equivalent would need gigabytes. Generators are written as functions with yield or as generator expressions. The trade-offs: generators are single-pass (once consumed, they are exhausted), have no len(), and cannot be indexed. They shine in pipelines — sum(x*x for x in nums if x > 0) — and for streaming large files. A follow-up worth pre-empting: yield from delegates to a sub-generator, and generators underpin how 'for' loops, itertools and async code work.
IntermediateWhat is a decorator in Python?
A decorator is a callable that takes a function and returns a replacement, applied with @name above the definition. It is the standard way to add behaviour — timing, caching, auth checks, retries — without editing the wrapped function. Minimal pattern:
The @functools.wraps line is the detail that separates candidates: without it the wrapper hides the original's name and docstring. Decorators with their own arguments need one more nesting level (a factory returning a decorator). Built-ins used daily: @property, @staticmethod, @functools.lru_cache.
IntermediateWhat is the Global Interpreter Lock (GIL)?
The GIL is a mutex in CPython that lets only one thread execute Python bytecode at a time. It simplifies memory management (reference counts are not thread-safe to update concurrently) at the cost of parallel CPU-bound threading: two compute-heavy threads on two cores still run one-at-a-time. What still works under the GIL: I/O-bound threading (the GIL is released while waiting on sockets/disk), C-extension code that releases it (NumPy does), multiprocessing (separate interpreters, true parallelism), and asyncio for high-concurrency I/O. The senior-level nuance: the GIL is a CPython implementation detail, not a language rule — and PEP 703's optional free-threaded build is changing this story.
IntermediateWhat is the difference between a shallow copy and a deep copy?
A shallow copy (copy.copy, list(x), dict(x), x[:]) creates a new outer container whose elements are the SAME inner objects; a deep copy (copy.deepcopy) recursively copies everything. The classic failure: b = copy.copy(a) where a = [[1,2],[3,4]], then b[0].append(9) — a[0] also shows 9, because both lists share the inner lists. Deep copy avoids that but costs time, memory, and needs care with cycles (deepcopy handles them via a memo dict). In data code the same idea appears as df.copy() vs df.copy(deep=False) in pandas, and views vs copies in NumPy — a slice of an ndarray is a VIEW, mutating it mutates the original.
IntermediateHow does exception handling work in Python?
try/except catches exceptions; else runs only if no exception occurred; finally always runs (cleanup); raise re-raises or throws. Catch the NARROWEST exception you can — except Exception: pass is the classic anti-pattern because it silently eats bugs like AttributeError and KeyboardInterrupt subclasses of your intent. raise NewError(...) from err chains exceptions so the original traceback survives. Custom exceptions are plain classes: class PaymentDeclined(Exception): pass — used to give callers something precise to catch. EAFP ('easier to ask forgiveness than permission') is idiomatic Python: try/except KeyError often beats checking 'if key in dict' twice under concurrency.
IntermediateWhat is a context manager and the 'with' statement?
A context manager guarantees setup/teardown around a block: with open(path) as f: ... closes the file even if the body raises. The protocol is two methods — __enter__ (returns the resource) and __exit__ (cleans up; returning True suppresses the exception). The lighter way to write one is @contextlib.contextmanager with a single yield: everything before it is setup, everything after runs on exit. Real uses beyond files: acquiring locks, database transactions (commit on success, rollback on exception), temporarily changing a working directory, and pytest's 'with pytest.raises(ValueError):' assertion.
IntermediateWhat is the mutable default argument pitfall?
def add(item, bucket=[]) evaluates the default ONCE, at function definition — so every call without a bucket shares the same list, and items mysteriously accumulate across calls. The fix is a sentinel:
python
def add(item, bucket=None):
if bucket isNone:
bucket = []
The same trap applies to dict/set defaults and to any mutable object constructed in the signature, including default arguments like now=datetime.now() — that timestamp is frozen at import time, not call time. This question is a favourite precisely because the broken version works in simple tests and fails only in production-shaped call patterns.
IntermediateWhat are Python's key data structures for data work?
Core: list (ordered, mutable), tuple (immutable record), dict (O(1) key lookup, insertion-ordered since 3.7), set (uniqueness and membership). Standard library upgrades interviewers like to hear: collections.defaultdict (grouping without key checks), Counter (frequency counting in one line), deque (O(1) appends/pops at both ends — the right BFS queue), namedtuple/dataclasses (readable records), and heapq (priority queues, top-k problems). For actual data engineering scale: NumPy arrays (contiguous, vectorised), pandas DataFrames (labelled columns), and pyarrow Tables (zero-copy columnar interchange). Choosing the right one IS the interview answer: 'count word frequencies' should be Counter(words).most_common(10), not a hand-rolled dict loop.
IntermediateWhat is the difference between map, filter, and a list comprehension?
map(f, xs) applies a function lazily; filter(pred, xs) keeps matching items lazily; both return iterators in Python 3. A list comprehension does either or both eagerly and is generally preferred as more readable: [f(x) for x in xs if pred(x)] replaces list(map(f, filter(pred, xs))). map/filter win when you already have a named function (map(str.strip, lines) is clean) or when you want laziness without a generator expression. The functional trio's third member, reduce, moved to functools and is usually better expressed with sum(), max(), or an explicit loop. Mentioning that comprehensions avoid lambda-call overhead — and are therefore usually faster than map with a lambda — lands well.
IntermediateHow do you merge two dictionaries in Python?
Python 3.9+: merged = a | b (b's values win on key conflicts); in-place: a |= b. Python 3.5+: {**a, **b}. Older / still common in codebases: merged = a.copy(); merged.update(b). For nested structures none of these recurse — a shallow merge replaces entire sub-dicts, so deep merges need a small recursive helper or a library. Related tools worth naming: dict.setdefault for insert-if-missing, collections.ChainMap for a LAYERED view that does not copy at all (first match wins — handy for config-over-defaults), and the fact that later sources always override earlier ones in every merge form.
AdvancedWhat is the difference between iterators and iterables?
An iterable is anything you can loop over — it implements __iter__ returning an iterator (lists, strings, dicts, files, generators). An iterator is the stateful cursor doing the walking — it implements __next__ (produce the next item or raise StopIteration) and __iter__ (return itself). A for-loop calls iter() on the iterable, then next() repeatedly, catching StopIteration. Key consequences: iterables like lists can be looped many times; iterators are one-shot — zip, map, filter, and generators all exhaust. The subtle bug this explains: assigning it = iter(xs), consuming part of it in one loop, then wondering why a second loop starts midway. Files are their own iterators, which is why you can only read them through once.
AdvancedHow would you process a file that doesn't fit in memory?
Stream it, never call .read() or .readlines(). For text, the file object is already a lazy line iterator:
python
withopen(path) as f:
for line in f:
process(line)
That is constant memory regardless of file size. For binary, read fixed chunks: while chunk := f.read(1024*1024). For CSVs, csv.reader streams rows; in pandas, pd.read_csv(path, chunksize=100_000) yields DataFrame chunks you aggregate incrementally, and specifying dtype/usecols cuts memory further. For columnar analytics at scale, mention Parquet + predicate pushdown via pyarrow/DuckDB, which reads only the needed columns and row groups. If the follow-up is 'and sort it?' — external merge sort: sort chunks, write runs, heapq.merge the runs.
AdvancedWhat are Python closures and when are they useful?
A closure is an inner function that captures variables from its enclosing scope and keeps them alive after the outer function returns:
python
def make_counter():
n = 0def inc():
nonlocal n
n += 1return n
return inc
Each make_counter() call gets independent state — lightweight encapsulation without a class. Closures are the mechanism behind decorators and factory functions like def multiplier(k): return lambda x: x * k. Two interview details: 'nonlocal' is required to REBIND a captured variable (reading needs nothing), and the late-binding trap — functions created in a loop all see the loop variable's FINAL value unless you pin it with a default: lambda x, k=k: x * k.
AdvancedHow do you optimize slow pandas code?
In priority order: (1) Eliminate row loops — replace iterrows/apply with vectorised column operations; df['c'] = df.a * df.b runs in C. (2) Fix dtypes — object columns are Python-object arrays; convert repeated strings to 'category', numbers out of object with pd.to_numeric, and use nullable dtypes. (3) Load less — usecols/dtype/parse_dates in read_csv, or switch to Parquet. (4) Prefer merge/groupby/transform over manual loops, and query()/boolean masks over Python-level filtering. (5) Watch copies — chained indexing (df[a][b] = x) both warns and silently misses; use .loc. (6) When one core is the limit, mention the escape hatches by name: numba for custom numerics, DuckDB/Polars for large joins and aggregations — knowing WHEN pandas is the wrong tool reads as seniority.
AdvancedWhat is the difference between multithreading and multiprocessing in Python?
Threads share one interpreter and memory space, but the GIL serialises Python bytecode — so threading helps I/O-bound work (network calls, disk) and does NOT speed up CPU-bound pure-Python code. Multiprocessing launches separate interpreter processes: true parallelism for CPU-bound work, at the cost of process startup and pickling data across process boundaries. Practical guidance interviewers want: use concurrent.futures.ThreadPoolExecutor for many API calls, ProcessPoolExecutor for CPU-heavy transforms, asyncio when you need thousands of concurrent I/O tasks in one thread, and remember NumPy/pandas often release the GIL inside C code, so threads CAN help there. Rule of thumb: I/O-bound → threads or asyncio; CPU-bound → processes.
By company
Data Analyst interviews that ask these questions
See how this topic shows up in real Data Analyst loops — rounds, difficulty and company-specific questions:
Most entry and mid-level data roles need strong basics, data structures, file handling, API/CSV work, and practical pandas-style transformation.
Should I memorize Python syntax?
Memorize fundamentals, but prioritize explaining approach, edge cases, and why a data structure is appropriate.
Are pandas and NumPy always tested?
Not always. They are common in data analyst and data science workflows, but many interviews still test core Python first.
How do I practice Python for data engineering?
Build scripts that read data, validate it, transform it, and write clean output. Then explain failure handling.
What mistakes should I avoid?
Avoid unclear one-liners, missing edge cases, broad exception swallowing, and claims about libraries you have not used.
What Python interview questions are asked to freshers?
Short problems on built-in types: second largest in a list, anagram check, character frequency, flatten a list of lists, sort a dictionary by value, reverse the words in a sentence. The interviewer checks that you know list, dict, set and tuple, that you handle an empty input, and that you can say the output before running the code. Each of those six is answered above with the exact print.
What is the difference between / and // in Python?
/ is true division and always returns a float: 7 / 2 is 3.5 and 6 / 2 is 3.0. // is floor division: it rounds the result down to the nearest whole number, so 7 // 2 is 3 and -7 // 2 is -4, not -3. With a float on either side, // returns a float, so 7.0 // 2 is 3.0.
What is the difference between Python and Python 3?
Python 3 is the current version of the language; Python 2 is the old line, which is no longer maintained. On many Linux and macOS machines the command python3 starts Python 3, while python may start Python 2 or nothing at all, which is why tutorials type python3. Learn and write Python 3.
What is the difference between Python and Anaconda?
Python is the language and its interpreter. Anaconda is a distribution: it installs a Python interpreter together with many data libraries such as pandas and NumPy, plus the conda tool for managing packages and environments. You write the same Python either way; Anaconda only changes how Python and its packages are installed.
Python or Java: which is better for a data career?
Python, for most data roles. It is what analysts use with pandas, what data engineers use for pipelines and PySpark, and what machine learning runs on. Java and Scala matter closer to the engines: Spark itself is written in Scala, and many Kafka services are written in Java. In PrepNPlaced's India Tech Hiring Report (23 August to 27 September 2026), Python was named in 28.5% of 17,748 postings and Java in 15.6%.
How can PrepNPlaced help?
Use Open Learning for revision, AI Mock Interview for practice, and Rewrite My Resume to turn Python projects into honest resume proof.
Next Step
Turn The Guide Into Practice
Use PrepNPlaced tools to turn this learning path into resume proof, targeted practice, and interview-ready explanations.