Table of Contents
As the demand for skilled Python developers continues to grow, Ernst & Young (EY), one of the “Big Four” accounting firms, seeks professionals who can not only write efficient code but also solve complex business problems using Python. EY interviews often cover a wide range of topics, from core Python concepts to advanced problem-solving techniques. Whether you’re a seasoned developer or preparing for your first technical interview, being well-versed in Python fundamentals, data manipulation, and problem-solving can give you a competitive edge.
In this blog, we’ll explore the top Python interview questions asked at EY. These questions focus on Python programming skills, object-oriented concepts, data structures, algorithms, and real-world applications in data analytics and automation.
Get hands-on with our python course – sign up for a free demo!
Introduction to EY
Ernst & Young (EY) is one of the largest professional services networks in the world, commonly recognized as one of the “Big Four” accounting firms, alongside Deloitte, PwC, and KPMG. Headquartered in London, EY provides a wide range of services including audit, tax, advisory, consulting, and transaction advisory services.
Key Areas of Expertise:
- Audit and Assurance: EY conducts independent audits and provides assurance services, ensuring the integrity of financial statements for businesses.
- Tax Services: EY helps clients manage tax obligations while navigating the complexities of international tax law.
- Advisory: The firm advises organizations on business strategies, operations, risk management, and IT implementations.
- Consulting: EY offers management and business consulting services, with a focus on digital transformation, innovation, and data analytics.
- Transaction Advisory: EY provides support for mergers and acquisitions (M&A), capital transactions, and business restructuring.
Global Reach:
With offices in over 150 countries, EY operates a highly integrated global network, serving clients across various industries, including financial services, technology, healthcare, and consumer products.
Focus on Innovation:
EY is investing heavily in digital transformation, artificial intelligence, blockchain, and data analytics to help clients tackle challenges in an increasingly complex global business environment. They also offer services through EY wavespace, innovation centers that focus on co-creating digital solutions.
Sustainability and Corporate Social Responsibility:
EY is committed to driving sustainable growth, both for itself and its clients. The firm integrates environmental, social, and governance (ESG) factors into its business strategy and advisory services, aligning with global sustainability standards.
EY aims to build a better working world by helping clients solve their toughest challenges while creating long-term value for society as a whole.
Why Join EY?
There are several reasons why someone might consider joining Ernst & Young (EY), one of the largest professional services firms in the world. Here are key points to consider:
1. Global Exposure
- EY operates in over 150 countries, providing employees with global opportunities to work with diverse teams, clients, and industries.
- Employees have the chance to travel and collaborate with teams worldwide, offering international exposure and experience.
2. Diverse Career Opportunities
- EY offers a broad range of services, including assurance, advisory, tax, and transaction advisory services. This diversity allows professionals to specialize in different areas or transition between sectors within the firm.
- Their global network enables employees to explore various career paths and industries, from financial services and technology to healthcare and government.
3. Strong Learning and Development Programs
- EY is known for its commitment to learning and development. The firm invests heavily in training, providing employees with access to certifications, leadership programs, and continuous education.
- Their EY Badges program allows employees to earn digital certifications in areas like data analytics, artificial intelligence (AI), and blockchain.
4. Innovative Culture
- EY is committed to innovation and has been at the forefront of adopting technologies like AI, data analytics, and robotic process automation (RPA) in the consulting space.
- The firm has created environments to foster creativity and innovation through initiatives like EY wavespace, which are centers that bring together digital technologies, collaboration, and design thinking.
5. Inclusive and Diverse Workplace
- EY places a strong emphasis on diversity and inclusion. Their workforce is built on a commitment to promoting equal opportunities, fostering gender diversity, and supporting LGBTQ+ and other underrepresented groups through various employee networks.
- Their EY Women’s Network and initiatives promoting diversity are recognized globally.
6. Strong Ethical Foundation
- EY maintains a reputation for integrity and ethical business practices. They follow strict codes of conduct and place significant importance on sustainability and corporate social responsibility (CSR).
- They aim to create long-term value by focusing on sustainable growth, helping clients achieve their environmental, social, and governance (ESG) goals.
7. Work-Life Balance
- While consulting is generally known for its demanding hours, EY promotes flexible working arrangements, hybrid models, and initiatives to ensure employees can balance their personal and professional lives.
- EY also focuses on employee well-being, offering health benefits, mental health support, and various wellness programs.
8. Impactful Work
- EY provides an opportunity to work on impactful projects that help shape businesses and industries, advising some of the world’s largest organizations on transformation, risk, and growth strategies.
- Employees can see the tangible results of their work on global businesses and economies.
9. Career Growth and Progression
- EY offers clear career development paths, enabling employees to grow into leadership roles. Their merit-based system rewards high performance and provides room for rapid career progression.
- Employees have access to mentorship and leadership development programs that help guide them through their career journey.
10. Corporate Social Responsibility
- EY has a strong focus on CSR, encouraging employees to get involved in their communities through volunteer programs and pro bono consulting services.
- The firm has initiatives aimed at improving education, equity, and entrepreneurship globally.
Get hands-on with our python course – sign up for a free demo!
Ey Python Interview Preparation Tips
To prepare for a Python interview at EY (Ernst & Young), it’s important to focus on a combination of technical skills, problem-solving abilities, and practical experience. Here are some key tips to help you prepare:
1. Core Python Concepts
- Data Types: Understand the core data types like
int
,float
,str
,bool
, and their mutability. Be familiar with Python collections (list
,set
,tuple
,dict
). - Loops and Conditional Statements: Practice
for
loops,while
loops, and conditional statements likeif-else
. - Functions and Scope: Be well-versed with defining and using functions, along with concepts like recursion,
*args
,**kwargs
, global vs local scope. - List Comprehensions: Understand how to use list comprehensions and the differences between comprehensions and loops.
2. Object-Oriented Programming (OOP)
- Classes and Objects: Review how to define classes, create objects, and understand the purpose of constructors (
__init__
). - Inheritance and Polymorphism: Be ready to explain inheritance (single, multiple, multilevel) and demonstrate how polymorphism works in Python.
- Encapsulation and Abstraction: Understand how to use private and protected members and achieve abstraction with abstract classes or interfaces using
abc
module. - Magic/Dunder Methods: Know how to use special methods like
__str__
,__repr__
,__eq__
, etc.
3. Data Structures and Algorithms
- Data Structures: Study common data structures such as stacks, queues, linked lists, hash maps, trees, and graphs.
- Algorithms: Focus on sorting algorithms (merge sort, quicksort), searching algorithms (binary search), and basic graph algorithms (BFS, DFS).
- Time and Space Complexity: Be able to analyze the efficiency of your code using Big-O notation.
4. Error Handling and Exceptions
- Understand how to handle exceptions using
try-except-finally
blocks. - Be familiar with raising custom exceptions and using
assert
statements.
5. Libraries and Frameworks
- Standard Libraries: EY may focus on your knowledge of Python’s standard libraries, including
math
,collections
,itertools
,os
,sys
, anddatetime
. - Popular Libraries: If the role requires knowledge in data science or web development, review libraries like
pandas
,numpy
,requests
,flask
,Django
, etc.
6. Database Interaction
- Be prepared to work with databases using Python. Understand how to connect to databases like MySQL, SQLite, or PostgreSQL using libraries like
sqlite3
orSQLAlchemy
. - Be familiar with basic SQL queries and how to execute them in Python.
7. Coding Practice
- EY is likely to focus on your problem-solving abilities. Practice coding problems on platforms like LeetCode, HackerRank, or CodeSignal.
- Focus on problems related to string manipulation, array processing, and recursive solutions.
8. Real-World Applications
- EY values practical experience. Be ready to explain how you’ve used Python in real-world projects, particularly those involving automation, data analysis, or web development.
- Discuss any projects you’ve worked on that demonstrate your ability to apply Python skills in a business context.
9. Behavioral Interview Preparation
- Prepare for behavioral questions related to teamwork, problem-solving under pressure, and how you approach learning new technologies.
- EY may ask about your ability to manage deadlines, work collaboratively in teams, and handle challenges in previous projects.
10. Mock Interviews and Technical Tests
- Practice technical problems under time constraints to simulate real interview conditions.
- EY may include coding assessments as part of the interview process, so take practice tests online to improve speed and accuracy.
Top Ey Python Interview Questions and Answers
Here are the top 35 EY Python interview questions and answers, tailored for Python roles focusing on programming skills, object-oriented concepts, data structures, algorithms, and real-world applications in data analytics and automation:
1. What are Python’s key features?
Answer: Python is an interpreted, high-level, dynamically typed language. Key features include simplicity, readability, extensive libraries, and support for object-oriented programming.
2. Explain Python’s memory management.
Answer: Python uses automatic memory management through a private heap, garbage collection, and reference counting to manage memory allocation and deallocation.
3. What are decorators in Python?
Answer: Decorators are special functions in Python used to modify the behavior of another function or method without changing its actual code.
4. How does Python handle exceptions?
Answer: Python uses a try-except block to handle exceptions. Errors are caught in the except block to avoid program crashes.
5. What is the difference between a list and a tuple?
Answer: Lists are mutable, allowing modifications, whereas tuples are immutable and cannot be changed after creation.
6. What is a lambda function?
Answer: Lambda functions are small anonymous functions in Python, often used for short operations, defined using the keyword lambda
.
7. Explain Python’s Global Interpreter Lock (GIL).
Answer: The GIL is a mutex that protects access to Python objects, preventing multiple native threads from executing Python bytecode simultaneously in a single process.
8. What is the difference between deep copy and shallow copy?
Answer: A shallow copy creates a new object but inserts references to the original objects. A deep copy creates a new object and recursively copies all objects, not just references.
9. What are Python iterators?
Answer: Iterators are objects that allow traversing through all the elements of a collection, like lists or tuples, using __iter__()
and __next__()
methods.
10. Explain list comprehensions.
Answer: List comprehensions provide a concise way to create lists by iterating over sequences and applying an expression to generate elements.
11. What are Python generators?
Answer: Generators are functions that yield values one at a time using the yield
keyword and maintain their state between each call.
12. How do you manage memory leaks in Python?
Answer: Memory leaks can be managed by using proper object referencing and ensuring that unused references are cleared, allowing Python’s garbage collector to reclaim memory.
13. What is the difference between __init__
and __new__
in Python?
Answer: __new__
is a static method used to create a new instance of a class, while __init__
initializes the attributes of that instance.
14. Explain method overloading in Python.
Answer: Python does not support traditional method overloading. However, it can be implemented using default arguments or by checking argument types.
15. What are closures in Python?
Answer: Closures are functions that capture and remember values from their enclosing scopes, even when the original scope is no longer present.
16. What is a Python module and how is it different from a package?
Answer: A module is a single Python file that can contain functions and classes. A package is a collection of related modules grouped in a directory.
17. What is monkey patching in Python?
Answer: Monkey patching is a technique where you dynamically change or extend a module or class at runtime.
18. Explain the purpose of the self
keyword in Python.
Answer: self
represents the instance of the class and allows access to its attributes and methods within the class.
19. What is the use of with
statement in Python?
Answer: The with
statement ensures that resources, like files, are properly managed and automatically closed after usage.
20. How do you handle missing data in Pandas?
Answer: Missing data can be handled using methods like fillna()
, dropna()
, and interpolate()
in Pandas.
21. How do you merge two DataFrames in Pandas?
Answer: DataFrames can be merged using the merge()
, join()
, or concat()
methods in Pandas, depending on the type of operation needed.
22. What is the purpose of the map()
function in Python?
Answer: map()
applies a given function to all items in an iterable and returns a list of results.
23. Explain multithreading in Python.
Answer: Multithreading in Python allows the execution of multiple threads concurrently but is limited by the GIL. Python’s threading
module handles thread-based parallelism.
24. What is the difference between NumPy arrays and lists?
Answer: NumPy arrays are more efficient for numerical operations as they use less memory and provide faster access to elements than Python lists.
25. **What are *args and kwargs in Python?
Answer: *args
allows passing a variable number of non-keyword arguments to a function, while **kwargs
allows passing a variable number of keyword arguments.
26. What is data serialization in Python?
Answer: Data serialization is the process of converting data into a byte stream to store it or transmit it. Python supports serialization through the pickle
module.
27. How would you implement a stack in Python?
Answer: A stack can be implemented using a list in Python with append()
for push operations and pop()
for pop operations.
28. What is the difference between multithreading and multiprocessing?
Answer: Multithreading allows multiple threads to run concurrently within a process, while multiprocessing involves multiple processes, each with its own memory space.
29. Explain the zip()
function in Python.
Answer: The zip()
function combines two or more iterables (e.g., lists or tuples) into a single iterable of tuples, where the first element of each passed iterable forms the first tuple, and so on.
30. What is the __repr__
method in Python?
Answer: __repr__
provides a string representation of an object that can be used for debugging. It is meant to provide detailed information useful for developers.
31. How do you optimize the performance of a Python program?
Answer: Python program performance can be optimized by using efficient algorithms, minimizing I/O operations, using built-in functions, and using libraries like NumPy for numerical computations.
32. What is the purpose of the __name__ == '__main__'
construct?
Answer: This construct allows you to check whether a Python script is being run directly or imported as a module into another script.
33. Explain method resolution order (MRO) in Python.
Answer: MRO determines the order in which base classes are searched when a method is called in the context of class inheritance. Python uses the C3 linearization algorithm for MRO.
34. What is the difference between is
and ==
in Python?
Answer: is
checks whether two variables refer to the same object in memory, while ==
checks if the values of the two variables are equal.
35. How do you create and handle a custom exception in Python?
Answer: Custom exceptions can be created by inheriting from the Exception
class and overriding the constructor and __str__
methods.
Get hands-on with our python course – sign up for a free demo!
Python OOPS Interview Questions
1. How will you check if a class is a child of another class?
For example:
class Parent(object):
pass
class Child(Parent):
pass
# Driver Code
print(issubclass(Child, Parent)) #True
print(issubclass(Parent, Child)) #False
- We can check if an object is an instance of a class by making use of isinstance() method:
obj1 = Child()
obj2 = Parent()
print(isinstance(obj2, Child)) #FalseÂ
print(isinstance(obj2, Parent)) #True
2. What is init method in python?
For example:
class InterviewbitEmployee:
# init method / constructor
def __init__(self, emp_name):
self.emp_name = emp_name
# introduce method
def introduce(self):
print('Hello, I am ', self.emp_name)
emp = EntriAppEmployee('Mr Employee') # __init__ method is called here and initializes the object name with "Mr Employee"
emp.introduce()
3. Why is finalize used?
4. Differentiate between new and override modifiers.
5. How is an empty class created in python?
For example-
class EmptyClassDemo:
pass
obj=EmptyClassDemo()
obj.name="Entri App"
print("Name created= ",obj.name)
Output:
Name created = Entri App
Python Pandas Interview Questions
1. How to add new column to pandas dataframe?
import pandas as pd
data_info = {'first' : pd.Series([1, 2, 3], index=['a', 'b', 'c']),
'second' : pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])}
df = pd.DataFrame(data_info)
#To add new column third
df['third']=pd.Series([10,20,30],index=['a','b','c'])
print (df)
#To add new column fourth
df['fourth']=df['first']+info['third']
print (df)
2. What do you understand by reindexing in pandas?
3. How will you identify and deal with missing values in a dataframe?
missing_data_count=df.isnull().sum()
We can handle missing values by either replacing the values in the column with 0 as follows:
df[‘column_name’].fillna(0)
Or by replacing it with the mean value of the column
df[‘column_name’] = df[‘column_name’].fillna((df[‘column_name’].mean()))
4. Can you create a series from the dictionary object in pandas?
import pandas as pd
dict_info = {'key1' : 2.0, 'key2' : 3.1, 'key3' : 2.2}
series_obj = pd.Series(dict_info)
print (series_obj)
Output:
x 2.0
y 3.1
z 2.2
dtype: float64
If an index is not specified in the input method, then the keys of the dictionaries are sorted in ascending order for constructing the index. In case the index is passed, then values of the index label will be extracted from the dictionary.
5. How will you combine different pandas dataframes?
- append() method: This is used to stack the dataframes horizontally. Syntax:
df1.append(df2)
- concat() method:Â This is used to stack dataframes vertically. This is best used when the dataframes have the same columns and similar fields. Syntax:
pd.concat([df1, df2])
- join() method:Â This is used for extracting data from various dataframes having one or more common columns.
df1.join(df2)
6. Define pandas dataframe.
The syntax for creating dataframe:
import pandas as pd
dataframe = pd.DataFrame( data, index, columns, dtype)
Python Libraries Interview Questions
1. Differentiate between deep and shallow copies.
Answer:
- Shallow copy does the task of creating new objects storing references of original elements. This does not undergo recursion to create copies of nested objects. It just copies the reference details of nested objects.
- Deep copy creates an independent and new copy of an object and even copies all the nested objects of the original element recursively.
2. What is main function in python? How do you invoke it?
main()
 function explicitly. But this doesn’t mean that we cannot simulate the execution of main. This can be done by defining user-defined main()
 function and by using the __name__
 property of python file. This __name__
 variable is a special built-in variable that points to the name of the current module. This can be done as shown below:
def main():
print("Hello Entri App!")
if __name__=="__main__":
main()
3. Are there any tools for identifying bugs and performing static analysis in python?
4. Define PIP.
pip install <package_name>
5. Define PYTHONPATH.
6. Define GIL.
Numpy Interview Questions
1. How will you reverse the numpy array using one line of code?
reversed_array = arr[::-1]
where arr = original given array, reverse_array is the resultant after reversing all elements in the input.
2. How will you find the nearest value in a given numpy array?
import numpy as np
def find_nearest_value(arr, value):
arr = np.asarray(arr)
idx = (np.abs(arr - value)).argmin()
return arr[idx]
#Driver code
arr = np.array([ 0.21169, 0.61391, 0.6341, 0.0131, 0.16541, 0.5645, 0.5742])
value = 0.52
print(find_nearest_value(arr, value)) # Prints 0.5645
3. How will you sort the array based on the Nth column?
arr = np.array([[8, 3, 2],
[3, 6, 5],
[6, 1, 4]])
Let us try to sort the rows by the 2nd column so that we get:
[[6, 1, 4],
[8, 3, 2],
[3, 6, 5]]
We can do this by using the sort() method in numpy as:
import numpy as np
arr = np.array([[8, 3, 2],
[3, 6, 5],
[6, 1, 4]])
#sort the array using np.sort
arr = np.sort(arr.view('i8,i8,i8'),
order=['f1'],
axis=0).view(np.int)
We can also perform sorting and that too inplace sorting by doing:
arr.view('i8,i8,i8').sort(order=['f1'], axis=0)
4. How will you read CSV data into an array in NumPy?
from numpy import genfromtxt
csv_data = genfromtxt('sample_file.csv', delimiter=',')
5. How are NumPy arrays advantageous over python lists?
Answer:
- The list data structure of python is very highly efficient and is capable of performing various functions. But, they have severe limitations when it comes to the computation of vectorized operations which deals with element-wise multiplication and addition. The python lists also require the information regarding the type of every element which results in overhead as type dispatching code gets executes every time any operation is performed on any element. This is where the NumPy arrays come into the picture as all the limitations of python lists are handled in NumPy arrays.
- Additionally, as the size of the NumPy arrays increases, NumPy becomes around 30x times faster than the Python List. This is because the Numpy arrays are densely packed in the memory due to their homogenous nature. This ensures the memory free up is also faster.
Get hands-on with our python course – sign up for a free demo!