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 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 had questions from OOPS, Java and Java Collections.
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.
Why are Java Strings immutable in nature?
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.
How would you differentiate between a String, StringBuffer, and a StringBuilder?
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.
What do you know 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 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.
What are the advantages of Packages in Java?
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.
Differentiate between HashSet and HashMap.
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.
Differentiate between ArrayList and Vector in Java.
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.
This round started with a simple coding question and then the interviewer started asking some questions from Java 8, Operating System and Multithreading in Java.



Approach :
1) Make a hash_map which will map the character to there respective frequencies.
2) Traverse the given string using a pointer.
3) Increase the count of current character in the hash_map.
4) Now traverse the string again and check whether the current character hasfrequency=1.
5) If the frequency>1 continue the traversal.
6) Else break the loop and print the current character as the answer.
TC : O(N), where N = length of the string
SC : O(N)
What are the features of a lambda expression?
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.
What are some standard Java pre-defined functional interfaces?
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
What are the advantages of using the Optional class?
It encapsulates optional values, i.e., null or not-null values, which helps in avoiding null checks, which results in
better, readable, and robust code. It acts as a wrapper around the object and returns an object instead of a value,
which can be used to avoid run-time NullPointerExceptions.
Difference between Process and Thread
Process : A process is the execution of a program that allows us to perform the appropriate actions specified in a
program. It can be defined as an execution unit where a program runs. The OS helps us to create, schedule, and
terminates the processes which is used by CPU. The other processes created by the main process are called child
process.
Thread : Thread is an execution unit that is part of a process. A process can have multiple threads, all executing at
the same time. It is a unit of execution in concurrent programming. A thread is lightweight and can be managed
independently by a scheduler. It helps us to improve the application performance using parallelism.
Major Differences b/w Process and Thread :
1) Process means a program is in execution, whereas thread means a segment of a process.
2) A Process is not Lightweight, whereas Threads are Lightweight.
3) A Process takes more time to terminate, and the thread takes less time to terminate.
4) Process takes more time for creation, whereas Thread takes less time for creation.
5) Process likely takes more time for context switching whereas as Threads takes less time for context switching.
6) A Process is mostly isolated, whereas Threads share memory.
7) Process does not share data, and Threads share data with each other.
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 race condition in Java? Given one example.
Race condition are cause of some subtle programming bugs when Java programs are exposed to concurrent
execution environment. As the name suggests, a race condition occurs due to race between multiple threads, if a
thread which is supposed to execute first lost the race and executed second, behaviour of code changes, which
surface as non-deterministic bugs. This is one of the hardest bugs to find and re-produce because of random nature
of racing between threads. One example of race condition is out-of-order processing.
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
Difference between Thread and Runnable in Java
Thread :
1) Thread is a class. It is used to create a thread.
2) It has multiple methods including start() and run().
3) Each thread creates a unique object and gets associated with it.
4) More memory required.
5) Multiple Inheritance is not allowed in java hence after a class extends Thread class, it can not extend any other class.
Runnable :
1) Runnable is a functional interface which is used to create a thread.
2) It has only abstract method run().
3) Multiple threads share the same objects.
4) Less memory required.
5) If a class is implementing the runnable interface then your class can extend another class.
This was a Technical Cum HR round where I was first asked some basic Design Pattern 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.
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?
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
What is recursion?