Complied List of Java Interview Question by Umesh Kaushik
Complied List of Java Interview Question by Umesh Kaushik
Design Patterns:
8. Design Patterns:
o What is the Builder Pattern? Write code for it.
o Write code for Singleton Pattern.
o What is the concept of the Factory Pattern? (Mention dissatisfaction in
previous interview)
o Why do we need design patterns?
o How do design patterns help simplify programming?
o What design patterns are you familiar with?
o How would you invent a new design pattern?
9. Spring Core:
o What is Spring Boot? Why is it popular?
o What are the Spring annotations (e.g., @Qualifier, @Value, @Bean,
@Component)?
o What is the difference between @Controller and @RestController?
o What is the difference between @Mock and @InjectMock?
o What is the difference between @RestController and @Controller?
10. Spring Security:
How to handle exceptions in the controller and return proper status code?
14. Miscellaneous:
Java Collections:
Java Streams:
What is the CAP theorem? Which trade-off is important for distributed systems?
22. Miscellaneous:
Sort employee list by highest salary first and collect into a new list.
Find employees with salaries more than a given number.
Find average age of employees whose salary is more than X.
Top 3 highest-paid employees.
Find the total number of employees from X city.
Find the sum of salary from a given list of employees.
Extract address list from the employee list and save it into another list.
Group employees by their city?
24. Troubleshooting:
What would be your troubleshooting steps when a backend service is not accessible
after deployment?