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 with a coding questions in which I was expected to first explain my approach and then code the solution. This was followed by some more questions from Operating System and Computer Networks.



For the given input array [4, 3, 2, 1], the minimum no. of swaps required to sort the array is 2, i.e. swap index 0 with 3 and 1 with 2 to form the sorted array [1, 2, 3, 4].
Approach :
1) The basic idea is to make a new array (called temp), which is a sorted form of the input array.
2) Make a map that stores the elements and their corresponding index, of the input array. So at each i starting from 0
to N is in the given array, where N is the size of the array:
3) If i is not in its correct position according to the sorted array, then
4) We will fill this position with the correct element from the hashmap we built earlier. We know the correct element
which should come here is temp[i], so we look up the index of this element from the hashmap.
5) After swapping the required elements, we update the content of the hashmap accordingly, as temp[i] to the ith
position, and arr[i] to where temp[i] was earlier.
TC : O(N * Log(N)), where N=size of the given array.
SC : O(N)
Print 1 to 100 using more than two threads(optimized approach).
Prerequisite to solve this problem : Multithreading
The idea is to create two threads and print even numbers with one thread and odd numbers with another thread.
Below are the steps:
1) Create two threads T1 and T2 , where T1 and T2 are used to print odd and even numbers respectively.
2) Maintain a global counter variable and start both threads.
3) If the counter is even in the Thread T1, then wait for the thread T2 to print that even number. Otherwise, print that
odd number, increment the counter and notify to the Thread T2 .
4)If the counter is odd in the Thread T2, then wait for the thread T1 to print that even number. Otherwise, print that
even number, increment the counter and notify the Thread T1.
Difference between Process and Program
Process : A Process is an execution of a specific program. It is an active entity that actions the purpose of the
application. Multiple processes may be related to the same program. For example, if we double-click on Google
Chrome browser, we start a process that runs Google Chrome and when we open another instance of Chrome, we
essentially create a second process.
Program : A Program is an executable file which contains a certain set of instructions written to complete the specific
job or operation on your computer. For example, Google browser chrome.exe is an executable file which stores a set
of instructions written in it which allows us to open the browser and explore web pages.
Major Differences b/w Process and Program :
1) Process is an executing part of a program whereas a program is a group of ordered operations to achieve a
programming goal.
2) The process has a shorter and minimal lifespan whereas program has a longer lifespan.
3) Process contains many resources like a memory address, disk, printer while Program needs memory space on the
disk to store all instructions.
4) When we distinguish between process and program, Process is a dynamic or active entity whereas Program is a
passive or static entity.
5) To differentiate program and process, Process has considerable overhead whereas Program has no significant
overhead cost.
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.
Describe the OSI Reference Model
Open System Interconnections (OSI) is a network architecture model based on the ISO standards. It is called the OSI
model as it deals with connecting the systems that are open for communication with other systems.
The OSI model has seven layers. The principles used to arrive at the seven layers can be summarized briefly as
below :
1) Create a new layer if a different abstraction is needed.
2) Each layer should have a well-defined function.
3) The function of each layer is chosen based on internationally standardized protocols.
What is the use of a router and how is it different from a gateway?
The router is a networking device used for connecting two or more network segments. It directs the traffic in the
network. It transfers information and data like web pages, emails, images, videos, etc. from source to destination in
the form of packets. It operates at the network layer. The gateways are also used to route and regulate the network
traffic but, they can also send data between two dissimilar networks while a router can only send data to similar
networks.
Explain TCP/IP Model
The most widely used and available protocol is TCP/IP i.e. Transmission Control Protocol and Internet Protocol.
TCP/IP specifies how data should be packaged, transmitted and routed in their end to end data communication.
Given below is a brief explanation of each layer :
1) Application Layer: This is the top layer in the TCP/IP model. It includes processes that use the Transport Layer
Protocol to transmit the data to their destination. There are different Application Layer Protocols such as HTTP, FTP,
SMTP, SNMP protocols, etc.
2) Transport Layer: It receives the data from the Application Layer which is above the Transport Layer. It acts as a
backbone between the host’s system connected with each other and it mainly concerns about the transmission of
data. TCP and UDP are mainly used as Transport Layer protocols.
3) Network or Internet Layer: This layer sends the packets across the network. Packets mainly contain source &
destination IP addresses and actual data to be transmitted.
4) Network Interface Layer: It is the lowest layer of the TCP/IP model. It transfers the packets between different hosts.
It includes encapsulation of IP packets into frames, mapping IP addresses to physical hardware devices, etc.
What are the advantages of using a VPN?
Below are few advantages of using VPN :
1) VPN is used to connect offices in different geographical locations remotely and is cheaper when compared to WAN connections.
2) VPN is used for secure transactions and confidential data transfer between multiple offices located in different geographical locations.
3) VPN keeps an organization’s information secured against any potential threats or intrusions by using virtualization.
4) VPN encrypts the internet traffic and disguises the online identity.
This round started with 2 coding questions - the first one was related to simple Number Theory and the second one was a simple questions related to Arrays and Hashing. After that, I was asked some questions related to OOPS and Java towards the end of the interview.



Approach (Using Sieve of Eratosthenes) :
1) First, we will make a boolean array/list isPrime of size N + 1. This will mark if a number is prime or not. Initially, all
values will be true.
2) Then, we initialize a variable num equal to 2 which represents the current processing prime number.
3) We will loop as num from 2 to N^½:
3.1) If num is not prime, we continue.
3.2) Else, we will mark all multiples of num in isPrime as false.
4) In the end, we will iterate through isPrime and store all primes in the result vector/list.
5) Finally, we return the result vector.
TC : O(N * log(log N)), where N is the given positive integer.
SC : O(N)



Suppose ‘N’ = 5, ‘A’ = [1,2,3,4,5], and target = 8
As target == A[2] + A[4] = 3 + 5 = 8.
Hence output will be 2 4.
Approach :
1) We can store the frequency of every element in the array in a hashmap.
2) We will loop over every index i, and check the frequency of (Target - ARR[i]) is the hashmap:
2.1) If (Target - ARR[i]) is equal to ARR[i], we will check if frequency of ARR[i] . If it is greater than 1 then we will
decrease the frequency of ARR[i] by 2 and add a pair (ARR[i] , ARR[i]) to our answer.
2.2) Else, if the frequency of ARR[i] and Target - ARR[i] is greater than equal to 1 then we add pair (ARR[i], Target -
ARR[i]) to our answer and decrease the frequency of both by 1.
3) If no valid pairs exist, we will return [[-1,-1]].
TC : O(N), where N=size of the array
SC : O(N)
Explain Singleton Class in Java
1) In object-oriented programming, a singleton class is a class that can have only one object (an instance of the
class) at a time.
2) After first time, if we try to instantiate the Singleton class, the new variable also points to the first instance created.
3) So whatever modifications we do to any variable inside the class through any instance, it affects the variable of the
single instance created and is visible if we access that variable through any variable of that class type defined.
The key points while defining class as singleton class are :
1) Make constructor private.
2) Write a static method that has return type object of this singleton class. Here, the concept of Lazy initialization is
used to write this static method.
What do you mean by data encapsulation?
1) Data Encapsulation is an Object-Oriented Programming concept of hiding the data attributes and their behaviors in
a single unit.
2) It helps developers to follow modularity while developing software by ensuring that each object is independent of
other objects by having its own methods, attributes, and functionalities.
3) It is used for the security of the private properties of an object and hence serves the purpose of data hiding.
What is Garbage collector in JAVA?
1) Garbage Collection in Java is a process by which the programs perform memory management automatically.
2) The Garbage Collector(GC) finds the unused objects and deletes them to reclaim the memory.
3) In Java, dynamic memory allocation of objects is achieved using the new operator that uses some memory and the
memory remains allocated until there are references for the use of the object.
4) When there are no references to an object, it is assumed to be no longer needed, and the memory, occupied by
the object can be reclaimed.
5) There is no explicit need to destroy an object as Java handles the de-allocation automatically.
The technique that accomplishes this is known as Garbage Collection. Programs that do not de-allocate memory can
eventually crash when there is no memory left in the system to allocate. These programs are said to have memory
leaks.
Garbage collection in Java happens automatically during the lifetime of the program, eliminating the need to de-
allocate memory and thereby avoiding memory leaks.
In C language, it is the programmer’s responsibility to de-allocate memory allocated dynamically using free() function.
This is where Java memory management leads.
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.
This was a typical HR round with some standard Behavioral questions.
Tell me something about yourself?
Tip 1 : Prepare the points that you will speak in your introduction prior to the interview.
Tip 2 : Tell about your current cgpa, achievements and authenticated certification
Tip 3 : I told about my role in current internship and what all I do
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.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?