Infosys private limited interview experience Real time questions & tips from candidates to crack your interview

Java Developer

Infosys private limited
upvote
share-icon
3 rounds | 14 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
Medium
Video Call
Duration60 Minutes
Interview date20 Aug 2021
Coding problem6

This round had questions from OOPS , Spring and MVC. More emphasis was given on the fundamentals of the subject rather than the advanced topics.

1. OOPS Question

What is meant by Interface?

Problem approach

Answer : 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.

2. OOPS Question

Difference between Abstract class and Interface.

Problem approach

Answer :
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.

3. SpringBoot Question

What is the starter dependency of the Spring boot module?

Problem approach

Spring boot provides numbers of starter dependency, here are the most commonly used -

1) Data JPA starter.
2) Test Starter.
3) Security starter.
4) Web starter.
5) Mail starter.
6) Thymeleaf starter.

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

5. Technical Question

Explain in brief the role of different MVC components?

Problem approach

The different MVC components have the following roles -
1) Presentation: This component takes care of the visual representation of a particular abstraction in the application.

2) Control: This component takes care of the consistency and uniformity between the abstraction within the system
along with their presentation to the user. It is also responsible for communicating with all other controls within the
MVC system.

3) Abstraction: This component deals with the functionality of the business domain within the application.

6. Technical 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.

02
Round
Medium
Video Call
Duration60 Minutes
Interview date20 Aug 2021
Coding problem6

This round primarily focused on Java 8 and Hibernate. I was asked if I had some experience in Hibernate to which I said Yes and so I was asked some fundamental questions related to it.

1. Java Question

How ConcurrentHashMap works in Java

Problem approach

According to ConcurrentHashMap Oracle docs,

The constructor of ConcurrentHashMap looks like this :

public ConcurrentHashMap (int initialCapacity, float loadFactor, int concurrencyLevel)

So the above line creates a new, empty map with the specified initial capacity, load factor and concurrency level.
where,

Important Parameters to consider from ConcurrentHashMap Constructor :

initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.

concurrencyLevel - the estimated number of concurrently updating threads. The implementation performs internal
sizing to try to accommodate this many threads.

In the ConcurrentHashMap Api , you will find the following constants.

static final int DEFAULT_INITIAL_CAPACITY = 16;
static final int DEFAULT_CONCURRENCY_LEVEL = 16;

initial capacity parameter and concurrency level parameters of ConcurrentHashMap constructor (or Object) are set to
16 by default.

1) Thus, instead of a map wide lock, ConcurrentHashMap maintains a list of 16 locks by default ( number of locks equal
to the initial capacity , which is by default 16) each of which is used to lock on a single bucket of the Map.
2) This indicates that 16 threads (number of threads equal to the concurrency level , which is by default 16) can modify the collection at the same time , given ,each thread works on different bucket. 
3) So unlike hashtable, we perform any sort of operation ( update ,delete ,read ,create) without locking on entire map in ConcurrentHashMap.


Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and
remove). Retrievals reflect the results of the most recently completed update operations holding upon their onset.


1) The allowed concurrency among update operations is guided by the optional concurrencyLevel constructor argument
(default 16), which is used as a hint for internal sizing. 
2) The table is internally partitioned to try to permit the indicated number of concurrent updates without contention. 
3) Because placement in hash tables is essentially random, the actual concurrency will vary. Ideally, you should choose a value to accommodate as many threads as will ever concurrently modify the table. 
4) Using a significantly higher value than you need can waste space and time, and a significantly lower value can lead to thread contention

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

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

4. Hibernate Question

Can you explain what is lazy loading in hibernate?

Problem approach

Lazy loading is mainly used for improving the application performance by helping to load the child objects on demand.

It is to be noted that, since Hibernate 3 version, this feature has been enabled by default. This signifies that child objects are not loaded until the parent gets loaded.

5. Hibernate Question

What is hibernate caching?

Problem approach

Hibernate caching is the strategy for improving the application performance by pooling objects in the cache so that the queries are executed faster. Hibernate caching is particularly useful when fetching the same data that is executed multiple times. Rather than hitting the database, we can just access the data from the cache. This results in reduced throughput time of the application.

Types of Hibernate Caching

First Level Cache:

1) This level is enabled by default.
2) The first level cache resides in the hibernate session object.
3) Since it belongs to the session object, the scope of the data stored here will not be available to the entire application as an application can make use of multiple session objects.


Second Level Cache:

1) Second level cache resides in the SessionFactory object and due to this, the data is accessible by the entire application.
2) This is not available by default. It has to be enabled explicitly.
3) EH (Easy Hibernate) Cache, Swarm Cache, OS Cache, JBoss Cache are some example cache providers.

6. Hibernate Question

Explain brief about Session interface used in hibernate?

Problem approach

Session interface is primarily used by hibernate application. Session is light weight,short lived objects which are inexpensive to create and destroy. It allows you to create query objects to retrieve persistent objects.It wraps JDBC connection Factory for Transaction.It holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier .

03
Round
Easy
HR Round
Duration30 Minutes
Interview date20 Aug 2021
Coding problem2

This is a cultural fitment testing round. HR was very frank and asked standard questions. Then we discussed about my role.

1. Basic HR Question

Tell me something not there in your resume.

Problem approach

If you get this question, it's an opportunity to choose the most compelling information to share that is not obvious from
your resume.

Example :

Strength -> I believe that my greatest strength is the ability to solve problems quickly and efficiently, which makes me
unique from others.

Ability to handle Pressure -> I enjoy working under pressure because I believe it helps me grow and become more
efficient.

Tip : Emphasize why you were inspired to apply for the job. You can also explain that you are willing to invest a great
deal of energy if hired.

These are generally very open ended questions and are asked to test how quick wit a candidate is. So there is
nothing to worry about if you have a good command over your communication skills and you are able to propagate
your thoughts well to the interviewer.

2. Basic HR Question

Why should we hire you ?

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.

Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical
questions. No coding in most of the cases but some discussions over the design can surely happen.

Here's your problem of the day

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

Skill covered: Programming

To make an AI less repetitive in a long paragraph, you should increase:

Choose another skill to practice
Similar interview experiences
System Engineer Specialist
2 rounds | 4 problems
Interviewed by Infosys private limited
1453 views
0 comments
0 upvotes
Java Developer
3 rounds | 16 problems
Interviewed by Infosys private limited
46629 views
2 comments
0 upvotes
Java Developer
3 rounds | 15 problems
Interviewed by Infosys private limited
87837 views
6 comments
0 upvotes
Software Engineer
3 rounds | 3 problems
Interviewed by Infosys private limited
1174 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Java Developer
3 rounds | 20 problems
Interviewed by Ernst & Young (EY)
9007 views
2 comments
0 upvotes
company logo
Java Developer
2 rounds | 3 problems
Interviewed by Tata Consultancy Services (TCS)
11960 views
0 comments
0 upvotes
company logo
Java Developer
3 rounds | 4 problems
Interviewed by SAP Labs
3131 views
0 comments
0 upvotes