Here will the interview questions, which I will came during my preparation

1. What are Hash Table?

Hash tables are a type of data structure in which the address/ index value of the data element is generated from a hash function. This enables very fast data access as the index value behaves as a key for the data value.
Pasted image 20260820144438.png
Read more on: link.

2. What is Hashing?

Hashing is a method that takes any type of data, such as a word, a file, or even a full message, and converts it into a short, fixed-length string of letters and numbers. This result is called a hash code.

Note

Encryption vs Hashing

Encryption is a two-way process. You can hide the data by encrypting it. Later, you can decrypt it using a special key to retrieve the original information.
Hashing, on the other hand, is a one-way process. You can hash data but can’t reverse it. Once it’s converted into a hash, there’s no key or way to retrieve the original data.

3. Why sets are faster than list for searching?

Sets are implemented using hash tables. When searching for an element, Python computes the hash value and directly accesses the corresponding location, resulting in O(1) average lookup time. Lists require sequential scanning of elements, leading to O(n) lookup time.

4. Mutable vs Immutable

Datatypes that can be modified after there creation are mutable. On the other than if any datatype can not be modified after it's creation is called immutable objects.

5. Why strings are immutable

Strings are immutable because immutability provides benefits such as memory optimization, hashability, thread safety, and predictable behavior. Since strings cannot change after creation, Python can safely reuse string objects and cache hash values, making dictionaries and sets more efficient.

6. Deep Copy vs Shallow Copy

A shallow copy creates a new outer object but shares references to nested objects. A deep copy recursively creates copies of all nested objects, resulting in a completely independent copy.

7. Pass by Value or Pass by Reference

When we pass by value, a copy of the variable's value is passed to the function. Changes made inside the function do not affect the original variable.
But when we pass by reference, the memory address (reference) of the object is passed to the function. Changes made inside the function affect the original object.

Python is neither purely pass-by-value nor pass-by-reference. Python uses Pass-by-Object-Reference (also called Pass-by-Assignment). A reference to the object is passed to the function.. The function receives a reference to the object. If the object is mutable, it can be modified inside the function. If it is immutable, a new object is created instead of modifying the original.

8. - Map vs List Comprehension, What are list comprehension benefits

List comprehensions are generally more readable, concise, and Pythonic. They allow transformation and filtering in a single expression and are easier to understand than map() combined with lambda functions. However, map() performs lazy evaluation and can be more memory efficient when working with large datasets because it returns an iterator instead of creating the entire list upfront.

9. Why use Generators in Data Engineering?

Generators enable processing large datasets, files, and streams one record at a time, reducing memory consumption and improving scalability.

10. You need to process 100gb file, why generator over list?

If I load a 100 GB file into a list, Python attempts to store the entire dataset in memory, which can lead to excessive memory consumption or even Out-Of-Memory (OOM) errors. A generator processes the file record-by-record, keeping only the current item in memory. This makes generators highly memory-efficient and suitable for ETL pipelines, log processing, streaming applications, and large-scale data engineering workloads.

11. What are the advantages of inheritance in OOPs?

Code Reuse, Modularity and Extensibility - By organizing classes hierarchically, inheritance promotes modular design. Developer can extend existing classes to add or override functionality, creating new classes while maintaining a clean and organized codebase, Polymorphism, Abstraction and Encapsulations, Hierarchical Organization, Reduced Development Time

12. Why use with open() instead of open()?

with open() automatically closes the file after execution, even if an exception is occurs, It prevents resource leaks and is considered best practice.

13. Difference between except Exception and specific exceptions?

Catching specific exceptions is preferred because it handles only expected errors. Using except Exception catches all exceptions and may hide bugs, making debugging difficult.