Intermediate Level EY Interview Questions and Answers
11. Write a program to detect a cycle in a directed graph.
Here's an example implementation in Java to detect a cycle in a directed graph using depth-first search (DFS):
public boolean hasCycle(int[][] graph) {
int numVertices = graph.length;
boolean[] visited = new boolean[numVertices];
boolean[] inStack = new boolean[numVertices];
for (int vertex = 0; vertex < numVertices; vertex++) {
if (hasCycleUtil(graph, vertex, visited, inStack)) {
return true;
}
}
return false;
}
private boolean hasCycleUtil(int[][] graph, int vertex, boolean[] visited, boolean[] inStack) {
if (inStack[vertex]) {
return true;
}
if (visited[vertex]) {
return false;
}
visited[vertex] = true;
inStack[vertex] = true;
for (int neighbor : graph[vertex]) {
if (hasCycleUtil(graph, neighbor, visited, inStack)) {
return true;
}
}
inStack[vertex] = false;
return false;
}

You can also try this code with Online Java Compiler
Run Code
12. How do you implement a thread-safe singleton pattern in Java?
To implement a thread-safe singleton pattern in Java, you can use the following approaches:
Eager initialization: Create the instance at class loading time.
public class Singleton {
private static final Singleton INSTANCE = new Singleton();
private Singleton() {}
public static Singleton getInstance() {
return INSTANCE;
}
}

You can also try this code with Online Java Compiler
Run Code
Double-checked locking: Perform a double-check to ensure thread safety & lazy initialization.
public class Singleton {
private static volatile Singleton instance;
private Singleton() {}
public static Singleton getInstance() {
if (instance == null) {
synchronized (Singleton.class) {
if (instance == null) {
instance = new Singleton();
}
}
}
return instance;
}
}

You can also try this code with Online Java Compiler
Run Code
13. Write a function to perform matrix multiplication.
Here's a function in Java to perform matrix multiplication:
public int[][] multiplyMatrices(int[][] matrix1, int[][] matrix2) {
int rows1 = matrix1.length;
int cols1 = matrix1[0].length;
int cols2 = matrix2[0].length;
int[][] result = new int[rows1][cols2];
for (int i = 0; i < rows1; i++) {
for (int j = 0; j < cols2; j++) {
for (int k = 0; k < cols1; k++) {
result[i][j] += matrix1[i][k] * matrix2[k][j];
}
}
}
return result;
}

You can also try this code with Online Java Compiler
Run Code
14. What is the difference between REST & SOAP APIs?
REST (Representational State Transfer) & SOAP (Simple Object Access Protocol) are two different architectural styles for building web services.
- REST is lightweight, uses standard HTTP methods (GET, POST, PUT, DELETE), & relies on simple URLs for resource identification. It commonly uses JSON or XML for data exchange.
- SOAP is more complex, uses XML for message format, & relies on a strict contract (WSDL) to define the operations & data types. It supports various transport protocols like HTTP, SMTP, etc.
15. Explain the concept of microservices architecture.
Microservices architecture is an approach to building applications as a collection of small, independent services. Each service focuses on a specific business capability & can be developed, deployed, & scaled independently. Microservices communicate with each other through APIs, typically using lightweight protocols like HTTP/REST.
Microservices enable faster development, improved scalability, & easier maintenance compared to monolithic architectures. However, they also introduce complexity in terms of service coordination, data consistency, & deployment.
16. Explain the use of Docker.
Docker is a platform that allows developers to package an application along with its dependencies into a standardized unit called a container. Containers provide a consistent & isolated environment for applications to run, regardless of the underlying infrastructure. Docker simplifies the deployment process by providing a standardized way to package & distribute applications, making it easier to manage dependencies, ensure consistency, & scale applications efficiently.
17. What are the Key benefits of using Docker in application deployment?
Key benefits of using Docker in application deployment:
- Consistency: Containers ensure that the application runs the same way across different environments (development, testing, production).
- Portability: Containers can be easily moved between different machines or cloud platforms without modification.
- Isolation: Each container runs in its own isolated environment, preventing conflicts with other applications or system dependencies.
- Scalability: Containers can be easily scaled up or down based on demand, allowing efficient resource utilization.
- Efficiency: Containers are lightweight & share the host operating system kernel, resulting in faster startup times & lower resource overhead compared to virtual machines.
18. How do you manage database transactions in a multi-threaded environment?
Managing database transactions in a multi-threaded environment requires careful consideration to ensure data consistency & avoid conflicts. Here are some key strategies:
- Use a connection pool: Instead of creating a new database connection for each thread, use a connection pool to manage a pool of reusable connections. This improves performance & resource utilization.
- Implement proper transaction isolation levels: Choose the appropriate transaction isolation level based on the application's requirements. Isolation levels like READ_COMMITTED or REPEATABLE_READ help prevent data inconsistencies caused by concurrent access.
- Use pessimistic or optimistic locking: Pessimistic locking (e.g., explicit locks) can be used to prevent concurrent access to shared resources. Optimistic locking (e.g., version checking) allows multiple threads to read data simultaneously & checks for conflicts during updates.
- Avoid long-running transactions: Keep transactions short & focused to minimize the chances of conflicts & improve concurrency. Break down complex operations into smaller transactions if possible.
- Handle deadlocks & timeouts: Implement proper error handling & retry mechanisms to deal with deadlocks & timeouts that can occur due to concurrent access to shared resources.
- Use thread-safe code: Ensure that the code accessing the database is thread-safe. Use synchronization mechanisms like locks or concurrent data structures when necessary to prevent race conditions.
19. What are the best practices for writing scalable & maintainable code?
- Follow SOLID principles: Adhere to the SOLID principles (Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) to create code that is flexible, extensible, & easier to understand.
- Use meaningful naming conventions: Choose clear & descriptive names for variables, functions, & classes. Follow consistent naming conventions to enhance code readability.
- Write readable & self-explanatory code: Write code that is easy to understand by using clear logic, avoiding complex nested structures, & adding comments or documentation when necessary.
- Implement proper error handling: Handle exceptions & errors gracefully. Provide meaningful error messages & log relevant information for debugging purposes.
- Optimize for performance: Consider performance aspects such as algorithm efficiency, caching, lazy loading, & database query optimization. However, avoid premature optimization & focus on readability first.
- Perform code reviews: Conduct regular code reviews to maintain code quality, identify potential issues, & share knowledge among team members.
- Write unit tests: Implement unit tests to verify the correctness of individual components & catch regressions early in the development process.
20. Describe your experience with cloud computing platforms like AWS or Azure.
Sample answer:
I have been working with Amazon Web Services (AWS) for software development and deployment of cloud based applications. My practical experience is mainly in Amazon’s AWS services like EC2 (Elastic Compute Cloud), S3 (Simple Storage Service), RDS (Relational Database Service), & Lambda.
For one of my recent projects, I designed and implemented a highly scalable web application using AWS. For instance, I hosted the application servers on EC2 instances, configured auto-scaling to cater for fluctuating traffic loads, & employed Elastic Load Balancer (ELB) to spread incoming requests across multiple instances. Another important thing is that I used S3 to store static files and also utilized CloudFront as Content Delivery Network (CDN) to boost performance by reducing user latency globally.
Advanced Level EY Interview Questions and Answers
21. How to cope when there are tight deadlines?
Sample Answer :
While working on a project when you are having tight deadlines, you should prioritize tasks based on their relative importance & urgency. In order to do this firstly you need to break down your tasks into smaller tasks. This will make it easier for you to focus on each task individually as well as have a plan with deliverables. You must ensure that stakeholders are well informed about the progress of your work while at the same time keeping up with their expectations. If necessary, you should partner with other team members so as to divide the work and get things moving faster using their expertise. Apart from that, You must keep alternative plans in mind just in case things do not go as planned. During this period, your main focus should be to make sure that all aspects of the tasks are met with their timelines and there is no delay in the completion of tasks.
22. Describe a situation when you had to adjust to some serious changes at your place of work or study.
Sample Answer :
During one of our recent projects there was a significant change after one of our key team members left our team unexpectedly. In my capacity as the project lead, I had to adapt quickly to this new change. After reviewing project scope, I redistributed tasks among remaining team members according to their strengths and realigned the project timelines accordingly. The changes were communicated to stakeholders who then learned about an updated plan for better understanding regarding this matter. Nevertheless, despite these difficulties, we managed to unite as a team for collective functioning when we were going through hard times by guiding each other, providing necessary assistance and ensuring successful delivery within the revised timelines.
23. How do you go about prioritizing tasks when you have several projects to manage?
Sample Answer:
When I am handling multiple projects, I focus on the way a task will be ranked on my list as per the effort, time & dependencies. In order to do this, I first create a list that includes all duties from the different projects and assess their significance and deadlines. Then I group the tasks on the basis of high, medium and low priority. My key focus is on delivering high-priority tasks first; in this regard, delivered tasks should reflect critical project milestones or stages. My other consideration is about work completion with regards to how it progresses in terms of task dependencies., I keep reviewing my task lists during the day as well as adjusting my priorities in line with any changes of plans or new insights that may arise. Communicating effectively with stakeholders helps me manage expectations and make informed decisions regarding prioritization of tasks.
24. Have you ever experienced a conflict within a team? How did you resolve it?
Sample Answer :
In one of our previous projects, two colleagues had different opinions on how to solve certain technical problems we were facing back then. This led into an unpleasant environment within the team which affected the progress of the task. Since I was given the role of being an overall head for the team members, I took personal responsibility for mending fences between them. Consequently, I arranged for a meeting where both members were invited and we shared our different perspectives with open minds. In the end we resolved it by finding what would help us not who was wrong in it all along together as one but separate individuals making their own opinions before coming up with a fruitful solution. Hence, it would benefit all parties involved after agreement had been reached upon investigating likely scenarios which might occur due to application of more than one methodologies but working together using strengths commonly discovered throughout the whole process which brought successful results without any complications arising again between them after getting rid off confliction thus setting right footing for future developments.
25. Describe a project where you led a team through to success.
Sample Answer :
In a recent project, I led a team in developing and launching a new mobile application. As the project manager, I set clear objectives and goals as well as assigned specific roles to each individual in my team. I facilitated meetings that were held at regular intervals to check on progress, address obstacles, and ensure that everyone was on the same page. As such, we fostered an inclusive environment wherein members shared their opinions freely. I encouraged brainstorming sessions for the team whenever they encountered technical hitches. I never assumed that it was their problem to solve but rather ours hence helping them improve their problem-solving abilities. When it comes to stakeholder management, information flow helps us keep everyone informed of what is going on so that they are not surprised by any undesirable outcome later on down the line. Through good leadership practices like these as well as cooperation among people we were able to deliver the app successfully.
26. How do you handle underperforming team members?
Sample Answer :
To deal with team members that have not done well, one needs to have an honest conversation to establish why the problem occurred in the first place. Instead of offering general feedback, explaining clearly what is expected and offering support can aid in their improvement. Track the progress on a regular basis and acknowledge any signs of positive change. When the situation persists, it may be necessary to involve HR or management for more assistance.
27. Explain a time when you had to make a tough decision with limited information.
In one project we encountered an issue that was vital just before the deadline, and I had to decide whether to delay release or ship it with a known bug. Given little time remaining for getting more facts about it though before making such a decision I looked at its implications as well as consulted my colleagues over it. Because its severity was small and there were deadliness linked with delivering the product on agreed date; I decided to release the software in spite of this defect but documented that problem so that it could be corrected immediately after shipping
28. How do you manage client expectations during a project?
To manage client expectations while working on a project starts with clear communication from day one. Right from the planning phase, I always ensure that the scope of work is concise and everybody agrees on it. To keep clients updated about the progress of the tasks, we offer regular updates and demonstrations among other kinds of practices including this one. Proactive communication is also key where challenges arise during implementations which might affect deliverable deadlines. At such times I openly share this news with them & provide few alternatives hence seeking their inputs. Thus they become part of the solution finding process through mutual agreement.
29. Describe a situation where you had to mediate a conflict between team members.
One time two of my teammates could not agree on the way to fix a technical issue. There was escalation of this quarrel and it began affecting the rest of the members. As the team leader, I arranged for a meeting for both parties so that I could get their points of view. I encouraged open conversation while also stressing active listening. We found common ground by looking at other solutions that could be used to address their concerns together. Conflict ended after empathy and compromise led us through alternate resolutions which catered for both these interests. By promoting empathy & compromise, we managed to resolve this problem thus restoring harmony amongst our group-members.
30. How do you ensure continuous improvement in your team's processes?
To encourage constant improvement, I cultivate a feedback culture and run frequent retrospectives. This involves critically reflecting on what worked best as well as areas requiring adjustments in our operations at various times. Elapsed time involving team members’ suggestions and ideas is crucial. This step will help us measure the impact of these new approaches on our service delivery. You can count only those practices that yielded desired results and leave aside others. Continuously evolving our procedures in an iterative manner with a growth mindset allows us to achieve better performance levels while working as a team.
Conclusion
We hope you have gained some insights on EY Interview Questions through this article. We hope this will help you excel in your interviews for EY.
You can also practice coding questions commonly asked in interviews on Coding Ninjas Code360.
Also, check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc., as well as some Contests, Test Series, and Interview Experiences curated by top Industry Experts.