Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Ernst & Young (EY) interview experience Real time questions & tips from candidates to crack your interview

Java Developer

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

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: Java , OOPS , Spring , MVC , Hibernate , Aptitude
Tip
Tip

Tip 1 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 2 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Referral
Eligibility: 1+ years of experience
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
Easy
Video Call
Duration60 Minutes
Interview date10 Oct 2020
Coding problem9

This round started with some basic questions from Java followed by some questions from OOPS in Java and standard Java 8 questions.

1. Java Question

What are the advantages of Packages in Java?

Problem approach

There are various advantages of defining packages in Java.

i) Packages avoid the name clashes.
ii) The Package provides easier access control.
iii) We can also have the hidden classes that are not visible outside and used by the package.
iv) It is easier to locate the related classes.

2. Java Question

Why Java is platform independent and JVM platform dependent?

Problem approach

JVM is platform dependent because it takes java byte code and generates byte code for the current operating
system. So Java software is platform dependent but Java language is platform independent because different
operating system have different JVMs.

3. Java Question

Which among String or String Buffer should be preferred when there are lot of updates required to be done in the
data?

Problem approach

StringBuffer is mutable and dynamic in nature whereas String is immutable. Every updation / modification of String
creates a new String thereby overloading the string pool with unnecessary objects. Hence, in the cases of a lot of
updates, it is always preferred to use StringBuffer as it will reduce the overhead of the creation of multiple String
objects in the string pool.

4. 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.

5. Java Question

Explain the use of final keyword in variable, method and class

Problem approach

In Java, the final keyword is used as defining something as constant /final and represents the non-access modifier.

1) final variable :
i) When a variable is declared as final in Java, the value can’t be modified once it has been assigned.

ii) If any value has not been assigned to that variable, then it can be assigned only by the constructor of the class.


2) final method :
i) A method declared as final cannot be overridden by its children's classes.

ii) A constructor cannot be marked as final because whenever a class is inherited, the constructors are not inherited.
Hence, marking it final doesn't make sense. Java throws compilation error saying - modifier final not allowed here


3) final class :
i) No classes can be inherited from the class declared as final. But that final class can extend other classes for its
usage.

6. OOPS Question

What is meant by Interface?

Problem approach

Multiple inheritances cannot be achieved in java. To overcome this problem the Interface concept is
introduced. An interface is a template which has only method declarations and not the method implementation.

Some imp. points about Interface :

1) All the methods in the interface are internally public abstract void.
2) All the variables in the interface are internally public static final that is constants.
3) Classes can implement the interface and not extends.
4) The class which implements the interface should provide an implementation for all the methods declared in the
interface.

7. OOPS Question

Difference between Abstract class and Interface.

Problem approach

The differences between Abstract Class and Interface are as follows :

Abstract Class:

1) Abstract classes have a default constructor and it is called whenever the concrete subclass is instantiated.
2) It contains Abstract methods as well as Non-Abstract methods.
3) The class which extends the Abstract class shouldn’t require the implementation of all the methods, only Abstract
methods need to be implemented in the concrete sub-class.
4) Abstract class contains instance variables.


Interface:

1) It doesn’t have any constructor and couldn’t be instantiated.
2) The abstract method alone should be declared.
3) Classes that implement the interface should provide the implementation for all the methods.
4) The interface contains only constants.

8. Java Question

What are some standard Java pre-defined functional interfaces?

Problem approach

Some of the famous pre-defined functional interfaces from previous Java versions are Runnable, Callable,
Comparator, and Comparable. While Java 8 introduces functional interfaces like Supplier, Consumer, Predicate, etc.
Please refer to the java.util.function doc for other predefined functional interfaces and its description introduced in
Java 8.

Runnable: use to execute the instances of a class over another thread with no arguments and no return value.

Callable: use to execute the instances of a class over another thread with no arguments and it either returns a value
or throws an exception.

Comparator: use to sort different objects in a user-defined order

Comparable: use to sort objects in the natural sort order

9. Java Question

What are the features of a lambda expression?

Problem approach

Below are the two significant features of the methods that are defined as the lambda expressions:
1) Lambda expressions can be passed as a parameter to another method.
2) Lambda expressions can be standalone without belonging to any class.

02
Round
Medium
Video Call
Duration60 Minutes
Interview date10 Oct 2020
Coding problem10

This round had questions from Microservices , Spring Boot and Hibernate. The interviewer was quite freindly and also helped wherever I was stuck.

1. Spring Boot Question

What Are the Basic Annotations that Spring Boot Offers?

Problem approach

The primary annotations that Spring Boot offers reside in its "org.springframework.boot.autoconfigure" and its sub-
packages. Here are a couple of basic ones : 

@EnableAutoConfiguration – to make Spring Boot look for auto-configuration beans on its classpath and
automatically apply them.

@SpringBootApplication – used to denote the main class of a Boot Application. This annotation combines
@Configuration, @EnableAutoConfiguration, and @ComponentScan annotations with their default attributes.

2. 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.

3. Spring Boot Question

What is dependency Injection?

Problem approach

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

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

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

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

4. Spring Boot Question

What is the @Controller annotation used for? How can you create a controller without an annotation?

Problem approach

The @Controller is a Spring MVC annotation to define Controller but in reality, it's just a stereotype annotation. You
can even create a controller without @Controller by annotating the Spring MVC Controller classes using
@Component annotation. The real job of request mapping to the handler method is done using @RequestMapping
annotation.

5. Spring Boot Question

What does the @SpringBootApplication annotation do internally?

Problem approach

The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration,
and @ComponentScan with their default attributes. Spring Boot enables the developer to use a single annotation
instead of using multiple. But, as we know, Spring provided loosely coupled features that we can use for each
annotation as per our project needs.

6. Hibernate Question

Can you tell the difference between setMaxResults() and setFetchSize() of Query?

Problem approach

setMaxResults() the function works similar to LIMIT in SQL. Here, we set the maximum number of rows that we want
to be returned. This method is implemented by all database drivers.

setFetchSize() works for optimizing how Hibernate sends the result to the caller for example: are the results buffered,
are they sent in different size chunks, etc. This method is not implemented by all the database drivers.

7. Hibernate Question

What are the concurrency strategies available in hibernate?

Problem approach

Concurrency strategies are the mediators responsible for storing and retrieving items from the cache. While enabling
second-level cache, it is the responsibility of the developer to provide what strategy is to be implemented to decide for
each persistent class and collection.

Following are the concurrency strategies that are used : 

1) Transactional: This is used in cases of updating data that most likely causes stale data and this prevention is most
critical to the application.

2) Read-Only: This is used when we don't want the data to be modified and can be used for reference data only.

3) Read-Write: Here, data is mostly read and is used when the prevention of stale data is of critical importance.

4) Non-strict-Read-Write: Using this strategy will ensure that there wouldn't be any consistency between the database
and cache. This strategy can be used when the data can be modified and stale data is not of critical concern.

8. Hibernate Question

Can you tell something about the N+1 SELECT problem in Hibernate?

Problem approach

N+1 SELECT problem is due to the result of using lazy loading and on-demand fetching strategy. 

Let's take an example. 

If you have an N items list and each item from the list has a dependency on a collection of another object,
say bid. In order to find the highest bid for each item while using the lazy loading strategy, hibernate has to first fire 1
query to load all items and then subsequently fire N queries to load big of each item. Hence, hibernate actually ends
up executing N+1 queries.

9. Microservices Question

Explain the working of Microservice Architecture.

Problem approach

Microservice architectures consist of the following components :

1) Clients: Different users send requests from various devices.
2) Identity Provider: Validate a user's or client's identity and issue security tokens.
3) API Gateway: Handles the requests from clients.
4) Static Content: Contains all of the system's content.
5) Management: Services are balanced on nodes and failures are identified.
6) Service Discovery: A guide to discovering the routes of communication between microservices.
7) Content Delivery Network: Includes distributed network of proxy servers and their data centers.
8) Remote Service: Provides remote access to data or information that resides on networked computers
and devices.

10. Microservices Question

What issues are generally solved by spring clouds?

Problem approach

The following problems can be solved with spring cloud :

1) Complicated issues caused by distributed systems: This includes network issues, latency problems, bandwidth
problems, and security issues.

2) Service Discovery issues: Service discovery allows processes and services to communicate and locate each other
within a cluster.

3) Redundancy issues: Distributed systems can often have redundancy issues.

4) Load balancing issues: Optimize the distribution of workloads among multiple computing resources, including
computer clusters, central processing units, and network links.

5) Reduces performance issues: Reduces performance issues caused by various operational overheads.

03
Round
Easy
HR Round
Duration30 Minutes
Interview date10 Oct 2020
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?

Why are you looking for a job change?

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

Which type of comments is used to comment on single lines of Java code?

Choose another skill to practice
Join the Discussion
2 replies
Sathish 11 Jul, 2024

i am interested in this.

0 replies
0 upvotes
Reply
Report
Anonymous 8 Jan, 2024

i  am  interested.

0 replies
0 upvotes
Reply
Report
Similar interview experiences
company logo
React developer
3 rounds | 19 problems
Interviewed by Ernst & Young (EY)
2008 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 5 problems
Interviewed by Ernst & Young (EY)
1059 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 11 problems
Interviewed by Ernst & Young (EY)
1169 views
0 comments
0 upvotes
company logo
Analyst
3 rounds | 4 problems
Interviewed by Ernst & Young (EY)
577 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Java Developer
3 rounds | 16 problems
Interviewed by Infosys
17821 views
1 comments
0 upvotes
company logo
Java Developer
3 rounds | 15 problems
Interviewed by Infosys
48541 views
3 comments
0 upvotes
company logo
Java Developer
2 rounds | 3 problems
Interviewed by Tata Consultancy Services (TCS)
8056 views
0 comments
0 upvotes