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.
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.
This round started slow with some basic fundamental questions around OOPS and then paced up higher to some more advanced questions Java and Multithreading in Java in general.
Explain SOLID principles in Object Oriented Design.
The SOLID principle is an acronym of the five principles which is given below :
1) Single Responsibility Principle (SRP)
2) Open/Closed Principle
3) Liskov’s Substitution Principle (LSP)
4) Interface Segregation Principle (ISP)
5) Dependency Inversion Principle (DIP)
Uses of SOLID design principles :
1) The SOLID principle helps in reducing tight coupling.
2) Tight coupling means a group of classes are highly dependent on one another which we should avoid in our code.
3) Opposite of tight coupling is loose coupling and our code is considered as a good code when it has loosely-
coupled classes.
4) Loosely coupled classes minimize changes in your code, helps in making code more reusable, maintainable,
flexible and stable.
Explaining the 5 SOLID principles one by one :
1) Single Responsibility Principle : This principle states that “a class should have only one reason to change” which
means every class should have a single responsibility or single job or single purpose.
Use layers in your application and break God classes into smaller classes or modules.
2) Open/Closed Principle : This principle states that “software entities (classes, modules, functions, etc.) should be
open for extension, but closed for modification” which means you should be able to extend a class behavior, without
modifying it. Using this principle separates the existing code from the modified code so it provides better stability,
maintainability and minimizes changes as in your code.
3) Liskov’s Substitution Principle : According to this principle “Derived or child classes must be substitutable for their
base or parent classes“. This principle ensures that any class that is the child of a parent class should be usable in
place of its parent without any unexpected behavior.
4) Interface Segregation Principle : This principle is the first principle that applies to Interfaces instead of classes in
SOLID and it is similar to the single responsibility principle. It states that “do not force any client to implement an
interface which is irrelevant to them“. Here your main goal is to focus on avoiding fat interface and give preference to
many small client-specific interfaces.
5) Dependency Inversion Principle : Two key points are here to keep in mind about this principle
a) High-level modules/classes should not depend on low-level modules/classes. Both should depend upon
abstractions.
b) Abstractions should not depend upon details. Details should depend upon abstractions.
What is Abstraction?
If you are a user, and you have a problem statement, you don't want to know how the components of the software
work, or how it's made. You only want to know how the software solves your problem. Abstraction is the method of
hiding unnecessary details from the necessary ones. It is one of the main features of OOPs.
For example, consider a car. You only need to know how to run a car, and not how the wires are connected inside it.
This is obtained using Abstraction.
How is an abstract class different from an interface?
Interface and abstract class both are special types of classes that contain only the methods declaration and not their
implementation. But the interface is entirely different from an abstract class. The main difference between the two is
that, when an interface is implemented, the subclass must define all its methods and provide its implementation.
Whereas when an abstract class is inherited, the subclass does not need to provide the definition of its abstract
method, until and unless the subclass is using it.
What is classloader?
Classloader is a subsystem of JVM which is used to load class files. Whenever we run the java program, it is loaded
first by the classloader. There are three built-in classloaders in Java.
1) Bootstrap ClassLoader: This is the first classloader which is the superclass of Extension classloader. It loads the
rt.jar file which contains all class files of Java Standard Edition like java.lang package classes, java.net package
classes, java.util package classes, java.io package classes, java.sql package classes, etc.
2) Extension ClassLoader: This is the child classloader of Bootstrap and parent classloader of System classloader. It
loads the jar files located inside $JAVA_HOME/jre/lib/ext directory.
3) System/Application ClassLoader: This is the child classloader of Extension classloader. It loads the class files from
the classpath. By default, the classpath is set to the current directory. You can change the classpath using "-cp" or "-
classpath" switch. It is also known as Application classloader.
Why Java is platform independent and JVM platform dependent?
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.
Tell us something about JIT compiler.
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 the 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.
Explain the use of final keyword in variable, method and class.
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.
Explain thread pool?
1) A Thread pool is simply a collection of pre-initialized or worker threads at the start-up that can be used to execute
tasks and put back in the pool when completed.
2) It is referred to as pool threads in which a group of fixed-size threads is created.
3) By reducing the number of application threads and managing their lifecycle, one can mitigate the issue of
performance using a thread pool.
4) Using threads, performance can be enhanced and better system stability can occur. To create the thread pools,
java.util.concurrent.Executors class usually provides factory methods.
What is the difference between the interrupted() and isInterrupted() method in Java?
1) Main difference between interrupted() and isInterrupted() is that former clears the interrupt status while later does
not.
2) The interrupt mechanism in Java multi-threading is implemented using an internal flag known as the interrupt
status. Interrupting a thread by calling Thread.interrupt() sets this flag.
3) When interrupted thread checks for an interrupt by invoking the static method Thread.interrupted(), interrupt status
is cleared. The non-static isInterrupted() method, which is used by one thread to query the interrupt status of another,
does not change the interrupt status flag.
4) By convention, any method that exits by throwing an InterruptedException clears interrupt status when it does so.
5) However, it's always possible that interrupt status will immediately be set again, by another thread invoking
interrupt
This round primarily focused on some major concepts in Spring Boot and Hibernate and had questions revolving around
that with some more questions from Microserviices and Java Design Patterns.
How many bean scopes are supported by Spring?
The Spring Framework supports five scopes. They are :
1) Singleton : This provides scope for the bean definition to single instance per Spring IoC container.
2) Prototype : This provides scope for a single bean definition to have any number of object instances.
3) Request : This provides scope for a bean definition to an HTTP-request.
4) Session : This provides scope for a bean definition to an HTTP-session.
5) Global-session : This provides scope for a bean definition to an Global HTTP-session.
The last three are available only if the users use a web-aware ApplicationContext.
What do you understand by auto wiring and name the different modes of it?
The Spring container is able to autowire relationships between the collaborating beans. That is, it is possible to let
Spring resolve collaborators for your bean automatically by inspecting the contents of the BeanFactory.
Different modes of bean auto-wiring are :
1) no : This is default setting which means no autowiring. Explicit bean reference should be used for wiring.
2) byName : It injects the object dependency according to name of the bean. It matches and wires its properties with
the beans defined by the same names in the XML file.
3) byType : It injects the object dependency according to type. It matches and wires a property if its type matches with
exactly one of the beans name in XML file.
4) constructor : It injects the dependency by calling the constructor of the class. It has a large number of parameters.
5) autodetect : First the container tries to wire using autowire by constructor, if it can’t then it tries to autowire by
byType.
Explain @RestController annotation in Sprint boot.
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.
What does the @SpringBootApplication annotation do internally?
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.
Explain Spring Actuator and its advantages.
1) Spring Actuator is a cool feature of Spring Boot with the help of which you can see what is happening inside a
running application.
2) So, whenever you want to debug your application, and need to analyze the logs you need to understand what is
happening in the application.
3) In such a scenario, the Spring Actuator provides easy access to features such as identifying beans, CPU usage,
etc.
4) The Spring Actuator provides a very easy way to access the production-ready REST points and fetch all kinds of
information from the web.
5) These points are secured using Spring Security’s content negotiation strategy.
What are the concurrency strategies available in hibernate?
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.
Explain the working of Microservice Architecture.
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.
What issues are generally solved by spring clouds?
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.
Explain the Singleton pattern?
Singleton pattern in Java is a pattern which allows a single instance within an application. One good example of the
singleton pattern is java.lang.Runtime.
Singleton Pattern states that define a class that has only one instance and provides a global point of access to it.
In other words, it is the responsibility of the class that only a single instance should be created, and all other classes
can use a single object.
This is a cultural fitment testing round. HR was very frank and asked standard questions. Then we discussed about my
role.
Why should we hire you ?
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.
Why are you looking for a job change?
Tip : For an experienced professional seeking a change, this is a common question. The easiest method to respond
to this question is to state that you are leaving your current work in order to advance your career. Make sure you don't
criticize or speak poorly about the company where you now work

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?