Professional Documents
Culture Documents
Java Streams, OOPS Concepts, Abstract Class, Interface, Internal workings of Collections
Core Java , hashmap & it's internal working,stream api, Microservices, Kafka, Spring Boot,
SQL bacis questions,
Interview Questions
hashmap and internal working
Java 8 features
Primarily on Spring and REST APIs. Java 8 basic knowledge is required Core Java questions -
Collections framework, OOPS concepts. Spring and REST APIs Java 8 basic knowledge is
required
It was brief more technical mainly spring, spring boot, spring MVC, was a great experience,
also about Hibernate, SQL, front end technology like Angular
1 Answer
1 Answer
JAVA collection, Exception handling and basic REST APIs. Discussed about project
mentioned in resume.
Interview Questions
Concurrent Exception in collection
Interview Questions
difference between final, finally and finalize
1 Answer
Answer Question
Answer Question
reverse a string
Interview Questions
Springboot, Spring, Java, Rest services
oops concept, role in project, difference between json and bson? How is mongodb different
from sql? What is synchronization and is it applied on classes? architecture of the project
Exception handling and questions related to string immutability?
Interview Questions
Core Java Exceptions in details
Answer Question
1 Answer
what is trigger?
Answer Question
.design pattern
Interview Questions
Basic oops concepts like Multithreading, exception handling, abstraction, polymorphism and
Collections concepts
Answer Question
Answer Question
UBS:
First They conducted one Written test :
Write a program to find minimum element from unsorted array.
Count ways to reach the nth stair using step 1, or 2 or both
For ex :If we want to reach at 4th Step:
No of ways would be :
1+1+1+1
2+2
1+1+2
2+1+1
How would you handle memory issues, Spring basic, database indexes, Unix commands,
questions on multithreading, concurrency etc
Interview Questions
1. what are 4 pillars of OOPS 2. what is abstraction 3. sql query to find employee strength of
all the departments given two tables 1. department 2. employee
Answer Question
Answer Question
Answer Question
fter 15 days got the call from UBS saying we will have 1 more technical round. The role was
for java developer and in the final round, they asked me all the things about the database.
And after that round there is no response.
Interview Questions
in 1st technical, they asked about threading, java8, collections
MORGAN STANLEY:
Interview Questions
1) How ConcurrentHash Map works
2) Blocking queue implementation
3) write code for producer consumer problem
4) write code to print even odd in sequence using MultiThreading
Interview Questions
What is reflective API , Multi threading concepts and questions
Interview Questions
Difference between equals and hashcode method?
Interview Questions
Multithreading and Concurrency
Hashmap
Blocking queue
LinkedHashMap Implementation
Immutable class Implementation
Design notepad with search functionality
, they ask you about the internal working of collections like hashmaps and treemaps.
Multithreading is something you have to prepare a lot to get through all the tech rounds.
Interview Questions
How does priority queues and TreeMap works internally?
Interview Questions
Algorithm and Data Structure questions
The first round is one to one on phone call. The candidate start to introduce himself, then
the algo test on hackerrank. And they will ask some technical questions about the
programming language.
Interview Questions
The question of leetcode
Interview Questions
Multithreading and Concurrency Hashmap Blocking queue LinkedHashMap Implementation
Immutable class Implementation Design notepad with search functionality
Interview Questions
Q-Design a realtime dashboard where you would display top 10 players in a game.
Q-Design an algorithm to schedule a match within N teams where each match is elimination?How would
you handle if you have N%2=1(where N is odd)? On what basis you would sit out a team and play
another
Q-How would you send and receive XML as Req and Res in REST
Q-What are the alternatives to Databases ? How can you compute 1 billion records in a distributed
system? How would you breakdown data and remerge the results across distributed systems.
they ask you about the internal working of collections like hashmaps and treemaps.
Multithreading is something you have to prepare a lot to get through all the tech rounds.
Interview Questions
How does priority queues and TreeMap works internally?
Interview Questions
Basic questions on Java collections, multithreading, design patterns
Interview Questions
HashMap, Concurrency, SQL, Exceptions, Iterators.
Interview Questions
REST API protocol The difference between PUT and POST
Interview Questions
Implementation of Linked list
Below questions were asked 1- How the Spring works internally? 2- Map works internally? 3
What approach is followed if two same object stored in map with same value. 4- What is
singleton ? When you will use singleton? 5- Advantages of OOps with real time example.
Interview Questions
Phone Screen: Check if two elements in an array equal to a sum or not?
1 Answer
Onsite #1: Fibonacci, recursively and iteratively, Tradeoff and complexities for both solution
1 Answer
1 Answer
1 Answer
1 Answer
Onsite #5 System Design question to process multiple feeds and an API to serve various
queries
Answer Question
Onsite#6 Return all characters from a string which appeared more than once
1 Answer
nterview Questions
I have an array of million integers. I want to sum it efficiently. How would you do it without
using Java 8 parallel streams?
3 Answers
I have a collection of string that is sorted and unique. You will receive an input as string.
Your job is to search that string in that group and return true or false based on its presence. How will
you solve this?
1 Answer
I have an online radio player application. There are two types of subscription free and paid.
In free there is a restriction that user can only listen upto 50 songs in 1 hour. How will you code this?
Answer Question
How does HashMap works? What is the time complexity of the get method in HashMap?
Glassdoor:
Modifier Description
Default declarations are visible only within the package (package private)
Object Oriented Programming system (OOPS) is designed based on the concept of “Object”.
“Object” contains both variables (used for holding the data) and methods(used for defining the
behaviors)
OOPS Concepts are very important mainly because without having idea of OOPS concepts, we will
not be able to design systems in object oriented programming model.
Abstraction
Abstraction is the concept of hiding the internal details of a functionality and providing a simple
representation for the same.
So complex functionality can be made available to the outside world in a simple way.
Example:
We use mobile phone everyday but we don’t know how the functionalities are designed inside it
so that we receive the calls and send messages etc.
These functionalities have been kept inside and we are just accessing them using the options
provided in the mobile.
Similarly, we drive a car and change the gears as and when its required to go high speed and come
back to low speed but We don’t know how the gear box works internally.
So, gearbox working is abstracted and provided with simple mechanism of changing gears to the
outside world.
Similary, we apply brakes whenever we want to stop the car but we are not sure how the braking
system works internally.
Similarly, in java we can write a method to perform some functionality inside a class and we
can expose it to outside world just by providing an option to call this method.
So, anyone who calls this method will not be knowing the internal complexity of the method but
will be knowing the functionality of the method and hence he calls it and uses it.
So, this way, we hide the internal implementation and abstract it inside a method.
1. Abstract class
2. Interface
1. Abstract Class
Abstract class in Java can be created using “ abstract ” keyword.
If we make any class as abstract then it can't be instantiated which means we are not able to create the
object of abstract class.
Example:
1. Abstract class Phone{
2. Abstract void receiveCall();
3. Abstract void sendMessage();
4. }
This definition is the actual internal details of how this functionality has been implemented.
Anyone who needs to access this functionality has to call the method using the Phone
object pointing to its subclass.
Check Abstract Class in Java article for more details on Abstract class and methods
2. Interface
Interface is used to achieve pure or complete abstraction.
Example:
We can define interface for Car functionality abstraction as below
1. Interface Car{
2. public void changeGear( int gearNumber);
3. public void applyBrakes();
4. }
1. Class Lamborghini implements car {
2. public void changeGear( int gearNumber){
3. //Actual logic to change the gear
4. System.out.println("Gear changed in Lamborghini car to "+gearNumber);
5.
6. }
7.
8. public void applyBrakes(){
9. //Actual logic to apply the brake
10. System.out.println("Break applied in Lamborghini car ");
11.
12. }
13. }
1. Class Audi implements car {
2. public void changeGear( int gearNumber){
3. //Actual logic to change the gear
4. System.out.println("Gear changed in Audi car to "+gearNumber);
5.
6. }
7.
8. public void applyBrakes(){
9. //Actual logic to apply the brake
10. System.out.println("Break applied in Audi car ");
11.
12. }
13. }
So, we can see that, internal working of gear box and the brake system is implemented in the
subclass and its abstracted using the interface.
Anyone who would like to use this functionality can call the appropriate method using interface
variable pointing to the required implementation as below
1. Car c = new Audi();
2. c. changeGear(2);
3. c. applyBrakes();
Since variable “c” is pointing to Audi class object , we can see below output
Output :
Encapsulation
Encapsulation is the process of binding object state(fields) and behaviors(methods) together in a single
entity called “Class”.
Inheritance
One class inherits or acquires the properties of another class.
The class from which the properties are inherited is called Super class or Parent class
We can create more specific classes by inheriting fields and methods from the Generic class.
Polymorphism
Polymorphism is the concept where an object behaves differently in different situations
Method overloading
In this case, which method to call will be decided at the compile time itself based on number or type of
the parameters
Method overriding
In this case, which method to call will be decided at the run time time based on what object is actually
pointed by the reference variable.
import java.lang.reflect.Method;
import java.lang.reflect.Field;
import java.lang.reflect.Constructor;
class Test
{
// creating a private field
private String s;
class Demo
// getclass method
cls.getName());
constructor.getName());
System.out.println(method.getName());
// the getDeclaredMethod
int.class);
// invokes the method at runtime
methodcall1.invoke(obj, 19);
// getDeclaredField method
field.setAccessible(true);
field.set(obj, "JAVA");
methodcall2.invoke(obj);
// getDeclaredMethod method
methodcall3.setAccessible(true);
methodcall3.invoke(obj);
}
Output :
The name of class is Test
The name of constructor is Test
The public methods of class are :
method2
method1
wait
wait
wait
equals
toString
hashCode
getClass
notify
notifyAll
The number is 19
The string is JAVA
Private method invoked
PUT POST
Generally, in practice, always use PUT for Always use POST for
UPDATE operations. CREATE operations.
5. A parametrized constructor that will assign the value during creation of object.
The constructor should not assign real instances to mutable objects. It must
create a clone copy of the passed argument and then use the clone copy. Make
sure to always return a clone copy of the field and never return the real object
instance.
o The instance variable of the class is final i.e. we cannot change the value of it after
creating an object.
o The class is final so we cannot create the subclass.
o There is no setter methods i.e. we have no option to change the value of the
instance variable.
HashMap stores the data in Key-Value pair and it uses node to store the key-
value. It uses the Node class that is a static inner class to represent the
pair(Key-Value) as a node. The HashMap contains an array and LinkedList
data structure internally for storing Key and Value. Let’s see the object of the
structure of HashMap or Internal working of HashMap in JDK:
final K key;
V value;
Node<K,V> next;
SDLC:
So, If we need to make a software, then you need to follow some steps and that’s what SDLC.
It involves steps like, Requirement gathering, Analysis, Design, Implementation, Integration & Testing,
Delivery and maintenance.
𝐒𝐃𝐋𝐂 𝐢𝐬 𝐚 𝐟𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤 𝐝𝐞𝐟𝐢𝐧𝐢𝐧𝐠 𝐭𝐚𝐬𝐤𝐬 𝐩𝐞𝐫𝐟𝐨𝐫𝐦𝐞𝐝 𝐚𝐭 𝐞𝐚𝐜𝐡 𝐬𝐭𝐞𝐩 𝐢𝐧 𝐭𝐡𝐞 𝐬𝐨𝐟𝐭𝐰𝐚𝐫𝐞 𝐝𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭
𝐩𝐫𝐨𝐜𝐞𝐬𝐬. 𝐇𝐞𝐫𝐞'𝐬 𝐩𝐫𝐨𝐜𝐞𝐬𝐬 𝐢𝐧 𝐝𝐞𝐭𝐚𝐢𝐥.
REQUIREMENT GATHERING:
In this phase, business analyst meets with the stakeholders and tries to figure out what the requirement
exactly is. A requirement specification document is then created which serves as a guideline for the
development team to work on.
ANALYSIS:
In this phase, a detailed requirement are done to understand the following things:/
The analysis phase has be done on the based of the requirement document about the following things:
DESIGN:
In this Phase, the whole project is divided into modules and submodules using UML (Unified Modelling
Language) diagrams.
IMPLEMENTATION:
Programming/Coding is done in this phase. Developers develop the source code using the pseudo code
as a reference.
In this phase, the test engineer reviews the requirement documents and prepares the certain test cases
for the software.
If there are any defects, the testing team then prepare a Defect Profile document, sends it back to the
development team, and waits for the next build.
Delivery:
Once the defects are removed, the software is then installed into the client environment with the help
of guidelines provided in the deployment document.
Maintenance:
In case there is an issue post-delivery, the task is then resolved according to the situation of the problem
@RestController
@RequestMapping(value = "/employee-management", produces =
{ MediaType.APPLICATION_JSON_VALUE })
public class EmployeeRESTController
{
@RequestMapping(value="/employees", method =
RequestMethod.OPTIONS)
ResponseEntity<?> collectionOptions()
{
return ResponseEntity
.ok()
.allow(HttpMethod.GET, HttpMethod.POST,
HttpMethod.OPTIONS)
.build();
}
@RequestMapping(value="/employees/{id}", method =
RequestMethod.OPTIONS)
ResponseEntity<?> singularOptions()
{
return ResponseEntity
.ok()
.allow(HttpMethod.GET, HttpMethod.DELETE,
HttpMethod.PUT, HttpMethod.OPTIONS)
.build();
}
//Other APIs
}
curl -i -X OPTIONS
http://localhost:8080/SpringRestExample/api/rest/employee-
management/employees/
Response:
#status# HTTP/1.1 200 OK
Server Apache-Coyote/1.1
Content-Length 0
Date Thu, 02 May 2019 10:41:02 GMT
Allow GET,POST,OPTION
curl -i -X OPTIONS
http://localhost:8080/SpringRestExample/api/rest/employee-
management/employees/1
Response:
#status# HTTP/1.1 200 OK
Server Apache-Coyote/1.1
Content-Length 0
Date Thu, 02 May 2019 10:43:15 GMT
Allow GET,DELETE,PUT,OPTIONS
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
Server response
OPTIONS
HTTP/1.1 200 OK
Allow: GET,HEAD,POST,OPTIONS,TRACE
Content-Type: text/html; charset=UTF-8
Date: Wed, 08 May 2013 10:24:43 GMT
Content-Length: 0
HEAD
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Date: Wed, 08 May 2013 10:12:29 GMT
ETag: "780602-4f6-4db31b2978ec0"
Last-Modified: Thu, 25 Apr 2013 16:13:23 GMT
Content-Length: 1270
OPTIONS tells you things such as "What methods are allowed for this resource".
HEAD gets the HTTP header you would get if you made a GET request, but without the
body. This lets the client determine caching information, what content-type would be
returned, what status code would be returned. The availability is only a small part of it.
The lifecycle of any object means when & how it is born, how it behaves
throughout its life, and when & how it dies. Similarly, the bean life cycle refers to
when & how the bean is instantiated, what action it performs until it lives, and
when & how it is destroyed. In this article, we will discuss the life cycle of the
bean.
Bean life cycle is managed by the spring container. When we run the program
then, first of all, the spring container gets started. After that, the container
creates the instance of a bean as per the request and then dependencies are
injected. And finally, the bean is destroyed when the spring container is closed.
Therefore, if we want to execute some code on the bean instantiation and just
after closing the spring container, then we can write that code inside the
custom init() method and the destroy() method. The following image shows the
process flow of the bean life cycle.
What is Distributed Caching? Explained
with Redis!
Design Patterns in Java
A design patterns are well-proved solution for solving the specific problem/task.
Now, a question will be arising in your mind what kind of specific problem? Let me explain by
taking an example.
Problem Given:
Suppose you want to create a class for which only a single instance (or object) should be created
and that single object can be used by all other classes.
Solution:
Singleton design pattern is the best solution of above specific problem. So, every design
pattern has some specification or set of rules for solving the problems. What are those
specifications, you will see later in the types of design patterns.
By using the design patterns you can make your code more flexible, reusable and
maintainable. It is the most important part because java internally follows design patterns.
Advantage of design pattern:
1. They are reusable in multiple projects.
2. They provide the solutions that help to define the system architecture.
3. They capture the software engineering experiences.
4. They provide transparency to the design of an application.
5. They are well-proved and testified solutions since they have been built upon the
knowledge and experience of expert software developers.
6. Design patterns don?t guarantee an absolute solution to a problem. They provide clarity
to the system architecture and the possibility of building a better system.
Design patterns ease the analysis and requirement phase of SDLC by providing
information based on prior hands-on experiences.
Design pattern:
1) CRAETIONAL
2) STR
TCS:
Interview
Based on project then ask on core java Question.... Collection.... Hashmap .... implementation
of arraylist.... Difference between Hashmap and hashtable.... Microservices Question...Uses
of Microservices... How to deploy Microservices on server.... How Microservices
communicate with each other
Difference between interface and abstract class, scope of sprig bean, singleton, immutability,
multithreading, exception handling, polymorphism.
Java 8 API
Interview Questions
Java basic questions, spring boot, rest api, security related questions
Basic technical questions and programming logic were asked. OOPS and Software
Engineering concepts were also asked. I got selected.
Interview Questions
Program to Swap two numbers