JAVA Interview Questions -Part 5
In this blog, I would be sharing few JAVA interview questions that are were asked in service based companies. Whether you are a beginner or experienced I believe these questions would definitely help you in your preparation.
Get Avinash Pratap Singh’s stories in your inbox
Join Medium for free to get updates from this writer.
This part of the questions were asked in WIPRO interview.
- Write a java 8 program which partitions the employees by locations (i.e India and non- India) ; return true for India and returns false for Non-India employees.
[Hint: Make use of Collectors.partitioningBy] - What are the different way to query the database in JPA?
- Have you used Criteria API? What is the return type in CriteriaQuery in JPA?
- What is @SpringBootApplication? What does it do internally?
- Which microservices architecture have you worked on? Explain the API Gateway Architecture. (Asked to name all the Annotations and dependencies which I used in the set-up e.g For Service Discovery, load balancer, Authentication and Authorisation) refer
- What is Routing in API gateway architecture?Which iterface have you used for routing purpose (e.g Route Locator)
- Is there any asynchronous way to send messages to respective services in a microservice architecture apart from messaging queues?
- Have you used Kafka? How were you reading data from Kafka?
- How did you implemented JWT for authorisation and authentication? (Since I mentioned I have used JWT, so the interviewer asked me questions related to it)
- Have you heard of Circuit breaker? How it works? What is fallback Mechanism? Which library have you used for its implementation?
This part of questions were asked in CGI API lead interview questions.
- Write a java 8 program to sort the employees based on cities.
- Explain difference between flat map and map, Please write a code to illustrate the difference.
- Have you used Parallel Streams? How does it differ from stream?
- Perform the flat map operation on List<List<String>> lst = Arrays.asList(Arrays.asList(“Apple”,”Mango”),Arrays.asList(“Rose”,”Jasmine”));
- What are the different http methods have you used in writing APIs?
- What is the difference between PUT, PATCH and POST? Does PUT also create a new resource? In which scenario does it happen?
- Why we used SpringBoot application for building APIs? Advantage of using it?
- What does @RestController? Does automatic serialisation happens in @Controller? If not , then how we can achieve that?
- If you have to create an API to read the data from database and write it in excel file, how would you do that? Explain and if possible write a code to create an excel file.
- What is interceptor?
- If I want to connect to 2 different databases in SpringBoot application, how can I do it ?
- What is CompletableFuture? Why is it used?
- What is Executor framework?
- What is deadlock? In which scenarios deadlocak happen? Could you please write a code to explain a simple dead lock situation?
- What are the different ways to read a file? Could you please write a simple code to explain this. You can use any way.
I hope these questions will help you in your interview preparartion journey. Please share your thoughts in the comment and if you find it useful do clap.
Happy leaning !!!








