Ernst & Young (EY) interview experience Real time questions & tips from candidates to crack your interview

Technology Consultant

Ernst & Young (EY)
upvote
share-icon
3 rounds | 18 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 Months
Topics: Data Structures, Algorithms, OOPS , Java , Spring
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date20 Oct 2021
Coding problem8

In this round, I was first asked a coding question related to Sliding Window Technique and then I was grilled on some major concepts from Java and Java Collections.

1. Smallest Subarray With K Distinct Elements

Easy
20m average time
80% success
0/40
Asked in companies
IntuitUberGoldman Sachs

Given an array 'A' consisting of 'N' integers, find the smallest subarray of 'A' containing exactly 'K' distinct integers.

Note :
If more than one such contiguous subarrays exist, consider the subarray having the smallest leftmost index.

For example - if A is [1, 2, 2, 3, 1, 3 ] and k = 2 then the subarrays: [1,2], [2,3], [3,1], [1,3] are the smallest subarrays containing 2 distinct elements. In this case, we will consider the starting and ending index of subarray [1,2] i.e. 0 and 1.
Problem approach

Approach (Using Sliding Window) : 

1) Initialize the map to store the count of each element.

2) Initialize start and end to store the index of the required subarray.

3) i, j denote the start and end of the window, i = 0, j = 0

4) While the end < size of the array,

4.1) In the map, increase the count of the end index's character by 1, if the character is not present in the map, increment the value of count.

4.2) While the count of distinct elements equals K (i.e. the size of the map is equal to K)
i) Find the length of subarray as j - i

ii) Compare it with the length of the minimum length you've found so far (initially 0)

iii) If the current length is less than the minimum, update the minimum length

iv) From the left side, i.e. i's side, decrease the count of ith character by 1. If it is already one, remove that character from the map

v) Move i forward by 1

5) If end is equal to n, that means no subarray was found with K distinct characters and we can print -1. Otherwise, we can print the start and end index we found.


TC : O(N), where N = size of the array
SC : O(K), where K = given integer

Try solving now

2. Java Question

How would you differentiate between a String, StringBuffer, and a StringBuilder?

Problem approach

1) Storage area : In string, the String pool serves as the storage area. For StringBuilder and StringBuffer, heap
memory is the storage area.

2) Mutability : A String is immutable, whereas both the StringBuilder and StringBuffer are mutable.

3) Efficiency : It is quite slow to work with a String. However, StringBuilder is the fastest in performing operations. The
speed of a StringBuffer is more than a String and less than a StringBuilder. (For example appending a character is
fastest in StringBuilder and very slow in String because a new memory is required for the new String with appended
character.)

4) Thread-safe : In the case of a threaded environment, StringBuilder and StringBuffer are used whereas a String is
not used. However, StringBuilder is suitable for an environment with a single thread, and a StringBuffer is suitable for
multiple threads.

3. Java Question

What is a package in Java? List down various advantages of packages.

Problem approach

Packages in Java, are the collection of related classes and interfaces which are bundled together. By using
packages, developers can easily modularize the code and optimize its reuse. Also, the code within the packages can
be imported by other classes and reused. Below I have listed down a few of its advantages : 

1) Packages help in avoiding name clashes
2) They provide easier access control on the code
3) Packages can also contain hidden classes which are not visible to the outer classes and only used within the
package
4) Creates a proper hierarchical structure which makes it easier to locate the related classes

4. Java Question

Why are Java Strings immutable in nature?

Problem approach

String objects in Java are immutable by definition. This signifies that the String object's state cannot be changed once
it has been created. As a result, if you try to update the value of that object rather than the values of that object, Java
creates a new string object.

Because String objects are often cached in the String pool, Java String objects are immutable. Because String literals
are frequently shared among numerous clients, one client's action may have an impact on the others. It improves the
application's security, caching, synchronization, and performance by doing so.

5. Java Question

What do you know about JIT Compiler?

Problem approach

1) JIT stands for Just-In-Time and it is used for improving the performance during run time. It does the task of
compiling parts of byte code having similar functionality at the same time thereby reducing the amount of compilation
time for the code to run.

2) The compiler is nothing but a translator of source code to machine-executable code.

Working of JIT Compiler :

1) First, the Java source code (.java) conversion to byte code (.class) occurs with the help of the javac compiler.

2) Then, the .class files are loaded at run time by JVM and with the help of an interpreter, these are converted to
machine understandable code.

3) JIT compiler is a part of JVM. When the JIT compiler is enabled, the JVM analyzes the method calls in the .class
files and compiles them to get more efficient and native code. It also ensures that the prioritized method calls are
optimized.

4) Once the above step is done, the JVM executes the optimized code directly instead of interpreting the code again.
This increases the performance and speed of the execution.

6. Java Question

Differentiate between HashSet and HashMap.

Problem approach

Hash Set :
1) It implements the Set Interface.
2) It does not allow duplicate values.
3) While adding an element it requires only one object as a parameter.
4) Internally, HashSet uses HashMap to add entries. The key K in a HashSet is the argument supplied in the
add(Object) method. For each value supplied in the add(Object) method, Java assigns a dummy value.
5) It is slower than HashMap.


Hash Map :
1) It implements the Map Interface.
2) The key needs to be unique while two different keys can have the same value.
3) While adding an entry, it requires two object values, the Key and the Value as the parameter.
4) There is no concept of duplicate values.
5) It is faster than HashSet.

7. Java Question

Differentiate between ArrayList and Vector in java.

Problem approach

Following are the differences between ArrayList and Vector in java :

1) Synchronization : Vector is synchronized, which means that only one thread can access the code at a time,
however, ArrayList is not synchronized, which means that multiple threads can operate on ArrayList at the same time.

2) Data Growth : Both ArrayList and Vector dynamically expand and shrink to make the most use of storage space,
but the manner they do it is different. If the number of elements in an array exceeds its limit, ArrayList increments
50% of the current array size, while vector increments 100%, thereby doubling the current array size.

3) Performance : ArrayList is faster than vector operations because it is non-synchronized, but vector operations are
slower since they are synchronized (thread-safe). When one thread works on a vector, it acquires a lock on it,
requiring any other threads working on it to wait until the lock is released.

4) Ease of Iteration : Vector can traverse over its elements using both Enumeration and Iterator, whereas ArrayList
can only traverse using Iterator.

8. Java Question

Differentiate between HashMap and HashTable.

Problem approach

Following are the differences between HashMap and HashTable : 

1) HashMap is a non-synchronized data structure. It is not thread-safe and cannot be shared across many threads without the use of synchronization code, while Hashtable is synchronized. It's thread-safe and can be used by several threads.

2) HashMap supports one null key and numerous null values, whereas Hashtable does not.

3) If thread synchronization is not required, HashMap is often preferable over HashTable.

02
Round
Medium
Video Call
Duration60 Minutes
Interview date20 Oct 2021
Coding problem9

This round started with some basic questions from Java 8 and then the interviewer started asking some questions from Spring Boot. At the end of the interview, I was also asked some questions from SQL and DBMS.

1. Java Question

What are Java 8 streams?

Problem approach

A stream is an abstraction to express data processing queries in a declarative way.

A Stream, which represents a sequence of data objects & series of operations on that data is a data pipeline that is
not related to Java I/O Streams does not hold any data permanently.
The key interface is java.util.stream.Stream. It accepts Functional Interfaces so that lambdas can be passed.
Streams support a fluent interface or chaining.

2. Java Question

Write a Java 8 program to iterate a Stream using the forEach method?

Problem approach

In this program, we are iterating a Stream starting from “number = 2”, followed by the count variable incremented by
“1” after each iteration.

Then, we are filtering the number whose remainder is not zero when divided by the number 2. Also, we have set the
limit as 5 which means only 5 times it will iterate. Finally, we are printing each element using forEach.

//Code :

import java.util.stream.*;
public class Java8 {

public static void main(String[] args){
Stream.iterate(2, count->count+1)

// Counter Started from 2, incremented by 1

.filter(number->number%2==0)

// Filtered out the numbers whose remainder is zero when divided by 2

.limit(5)
// Limit is set to 5, so only 5 numbers will be printed

.forEach(System.out::println);
}
}

3. Spring Boot Question

How does Spring Boot works?

Problem approach

Spring Boot automatically configures your application based on the dependencies you have added to the project by
using annotation. The entry point of the spring boot application is the class that contains @SpringBootApplication
annotation and the main method.

Spring Boot automatically scans all the components included in the project by using @ComponentScan annotation.

4. Spring Boot Question

What is dependency Injection?

Problem approach

The process of injecting dependent bean objects into target bean objects is called dependency injection.

Setter Injection : The IOC container will inject the dependent bean object into the target bean object by calling the
setter method.

Constructor Injection : The IOC container will inject the dependent bean object into the target bean object by calling
the target bean constructor.

Field Injection : The IOC container will inject the dependent bean object into the target bean object by Reflection API.

5. Spring Boot Question

Explain @RestController annotation in Sprint boot?

Problem approach

It is a combination of @Controller and @ResponseBody, used for creating a restful controller. It converts the
response to JSON or XML. It ensures that data returned by each method will be written straight into the response
body instead of returning a template.

6. Spring Boot Question

How MVC works in Spring?

Problem approach

Here is how MVC works in Spring :

1) DispatcherServlet receives a request.

2) After that, the DispatcherServlet communicates with HandlerMapping. It also revokes the controller associated with
that specific request.

3) The Controller processes this request by calling the service methods, and a ModelAndView object is returned by
the DispatcherServlet.

4) The view name is sent to a ViewResolver to find the actual View to invoke.

5) After that, DispatcherServlet is passed to View to render the result.

6) By using the model data, the View renders and sends back result back to the user.

7. Spring Boot Question

Mention a few features of Spring Boot.

Problem approach

Few important features of Spring Boot are as follows:

1) Spring CLI – Spring Boot CLI allows you to Groovy for writing Spring boot application and avoids boilerplate code.

2) Starter Dependency – With the help of this feature, Spring Boot aggregates common dependencies together and
eventually improves productivity

3) Auto-Configuration – The auto-configuration feature of Spring Boot helps in loading the default configurations
according to the project you are working on. In this way, you can avoid any unnecessary WAR files.

4) Spring Initializer – This is basically a web application, which can create an internal project structure for you. So,
you do not have to manually set up the structure of the project, instead, you can use this feature.

5) Spring Actuator – This feature provides help while running Spring Boot applications.

6) Logging and Security – The logging and security feature of Spring Boot, ensures that all the applications made
using Spring Boot are properly secured without any hassle.

8. SQL Question

Write a query that joins two tables A and B having common attribute ID and selects records(ID_NAME) that have
matching ID values in both tables .

Problem approach

SELECT A.ID_Name, B.ID_Name
FROM A
INNER JOIN B ON A.ID=B.ID;

9. SQL Question

Given an Employee Table, find the Nth highest salary from it.

Problem approach

CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE M INT;
SET M=N-1;
RETURN (
SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT M, 1
);
END

03
Round
Easy
HR Round
Duration30 Minutes
Interview date20 Oct 2021
Coding problem1

This was a Technical Cum HR round where I was first asked some basic Java related concepts and then we discussed
about my expectations from the company , learnings and growth in the forthcomig years. I would suggest be honest and
try to communicate your thoughts properly in these type of rounds to maximise your chances of getting selected.

1. Basic HR Questions

Why should we hire you ?
What are your expectations from the company?
How was your overall interview experience?
What are your strengths and weakness according to you?
Where do you see yourself in the next 5 years?

Problem approach

Tip 1 : The cross questioning can go intense some time, think before you speak.
Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
like what are the projects currently the company is investing, which team you are mentoring. How all is the work
environment etc.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
Technology Consultant
3 rounds | 18 problems
Interviewed by Ernst & Young (EY)
1966 views
0 comments
0 upvotes
company logo
Technology Consultant
2 rounds | 2 problems
Interviewed by Ernst & Young (EY)
2625 views
0 comments
0 upvotes
company logo
Technology Consultant
3 rounds | 3 problems
Interviewed by Ernst & Young (EY)
0 views
0 comments
0 upvotes
company logo
Technology Consultant
4 rounds | 3 problems
Interviewed by Ernst & Young (EY)
2312 views
0 comments
0 upvotes