Capgemini
10+ Goutham Institution Interview Questions and Answers
Q1. 1.difference between list,set and map in java collections 2.exception Handling 3.difference between throw and throws 4.why to create a thread 5.maker interface in java and its use 6.Spring boot which you used i...
read moreInterview questions for Senior Java Developer
List is an ordered collection, Set is an unordered collection with no duplicates, Map is a key-value pair collection
Exception handling is used to handle runtime errors and prevent program crashes
Throw is used to throw an exception explicitly, Throws is used to declare an exception that a method may throw
Threads are used to execute multiple tasks simultaneously and improve program performance
Marker interface is an interface with no ...read more
Q2. what is marker interface what is Stream api difference between Runnable and callable difference between comparable and compartor Internal working of hashMap Difference between Spring and Springboot
Marker interface is an interface with no methods, used to mark classes for special treatment.
Marker interface is an empty interface with no methods
It is used to mark classes for special treatment
Examples include Serializable, Cloneable interfaces
Q3. What are the advantages of spring boot over spring?
Spring Boot simplifies the development of Spring applications by providing out-of-the-box configurations and reducing boilerplate code.
Spring Boot provides a quick and easy way to set up a Spring application with minimal configuration.
It includes embedded servers like Tomcat, Jetty, or Undertow, eliminating the need for deploying WAR files.
Auto-configuration feature in Spring Boot automatically configures the application based on dependencies in the classpath.
Spring Boot Actu...read more
Q4. Difference between post & get mapping in spring boot and can we update the data using post mapping?
Post mapping is used to create or update data, while get mapping is used to retrieve data. Yes, data can be updated using post mapping.
Post mapping is used to create or update data in the server, while get mapping is used to retrieve data from the server.
Post mapping is typically used for operations that modify data, such as creating a new resource or updating an existing one.
Get mapping is used for operations that do not modify data, such as retrieving information or fetchin...read more
Q5. How connect two dbs in spring boot?
To connect two databases in Spring Boot, you can configure multiple data sources and use JPA to interact with them.
Configure multiple data sources in application.properties or application.yml file
Define multiple DataSource beans in your configuration class
Use @Primary annotation to specify the primary data source
Use @Qualifier annotation to specify which data source to use in a specific repository or service
Use @Transactional annotation with the appropriate data source to per...read more
Q6. Difference between @Service and @Component
The @Service annotation is used to annotate classes at the service layer, while @Component is a generic stereotype annotation for any Spring-managed component.
The @Service annotation is a specialization of the @Component annotation, indicating that a class is a service layer component.
Using @Service helps in better code organization and readability by clearly defining the purpose of the annotated class.
Spring automatically detects classes annotated with @Service and registers...read more
Q7. Diffence between @Controller and @RestController
The @Controller annotation is used to define a controller class in Spring MVC, while @RestController is used to define a RESTful web service controller.
The @Controller annotation is used to create a controller class that handles HTTP requests and returns a view, typically used in traditional Spring MVC applications.
The @RestController annotation is used to create a controller class that handles HTTP requests and returns data directly in JSON or XML format, commonly used in RE...read more
Q8. various follow ups on monolithic vs microservices architecture
Microservices architecture allows for modular, scalable, and flexible development compared to monolithic architecture.
Microservices break down applications into smaller, independent services that communicate through APIs.
Each microservice can be developed, deployed, and scaled independently, leading to faster development cycles and easier maintenance.
Monolithic architecture involves building an entire application as a single unit, making it harder to scale and update.
Microser...read more
Q9. What is Hashmap in java collections
HashMap is a data structure in Java collections that stores key-value pairs.
HashMap implements the Map interface and uses hashing to store elements.
It allows null values and one null key.
Example: HashMap
map = new HashMap<>();
Q10. Explain about SOLID principles in java?
SOLID principles are a set of five design principles in object-oriented programming to make software designs more understandable, flexible, and maintainable.
S - Single Responsibility Principle: A class should have only one reason to change.
O - Open/Closed Principle: Classes should be open for extension but closed for modification.
L - Liskov Substitution Principle: Objects of a superclass should be replaceable with objects of its subclasses without affecting the functionality....read more
Q11. Write a program on java8 ?
Program using Java 8 features to filter a list of strings starting with 'A' and convert them to uppercase.
Use Java 8 stream API to filter the strings starting with 'A'.
Use map() function to convert the filtered strings to uppercase.
Collect the results into a new list using collect() function.
Q12. Multiple threading in Spring boot
Spring Boot supports multiple threading through the use of Java's Executor framework.
Spring Boot provides a TaskExecutor interface for executing tasks asynchronously.
The @Async annotation can be used to mark a method as asynchronous.
Spring Boot also supports scheduling tasks using the @Scheduled annotation.
Thread safety can be ensured through the use of synchronized blocks or locks.
Examples: implementing a background task to send emails, scheduling a task to update a cache pe...read more
Q13. Future vs Completable Future differenes
Future is a concurrent programming construct while Completable Future is an extension of Future with more features.
Future is a simple interface that represents the result of an asynchronous computation.
Completable Future is an extension of Future that provides more features like chaining, combining, and exception handling.
Completable Future can be used to create a pipeline of asynchronous tasks.
Completable Future can also be used to handle exceptions in a more elegant way.
Com...read more
Q14. What is IOC in spring
IOC stands for Inversion of Control in Spring, a design principle where the control of object creation and lifecycle is shifted to a container.
IOC is a design principle in which the flow of control is inverted compared to traditional programming.
In Spring, IOC is achieved through dependency injection, where objects are provided their dependencies rather than creating them themselves.
IOC helps in decoupling components, making the code more modular, testable, and maintainable.
E...read more
Q15. Microservices design patterns?
Design patterns in microservices architecture help in solving common problems and improving scalability, maintainability, and flexibility.
Service Registry pattern - used for service discovery and registration, such as Netflix Eureka
Circuit Breaker pattern - prevents cascading failures by failing fast and providing fallback mechanisms, like Hystrix
API Gateway pattern - acts as a single entry point for clients to access multiple services, for example, Zuul
Saga pattern - manages...read more
Q16. Find duplicate character using Stream
Using Java Stream to find duplicate characters in an array of strings
Use flatMap to convert the array of strings into a stream of characters
Use Collectors.groupingBy to group the characters by count
Filter the grouped characters to find duplicates
Q17. JPA connection from spring boot
JPA connection in Spring Boot allows for easy integration of Java Persistence API with the Spring framework.
Use @Entity annotation to mark a class as an entity for JPA
Configure data source properties in application.properties file
Use @Repository annotation to enable JPA repository functionality
Q18. Index in MySQL?
An index in MySQL is a data structure that improves the speed of data retrieval operations on a database table.
Indexes are used to quickly locate rows in a table without having to search every row.
They can be created on one or more columns in a table.
Indexes can be unique, which means that the indexed columns must contain unique values.
Examples of indexes include primary keys, unique keys, and regular indexes.
More about working at Capgemini
Interview Process at Goutham Institution
Top Senior Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month