Capgemini
20+ Ford Motor 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. Find the average sal of employee in each department using java 8 Stream?
Calculate average salary of employees in each department using Java 8 Stream.
Use Java 8 Stream to group employees by department
Calculate average salary for each department using Stream's 'collect' method
Use 'Collectors.averagingDouble' to calculate average salary
Q6. Difference between HashMap and TreeMap? Internal working of HashMap?
HashMap is unordered, uses hashing for key-value pairs. TreeMap is ordered, uses Red-Black tree for key-value pairs.
HashMap uses hashing to store key-value pairs, allowing for O(1) retrieval time on average.
TreeMap uses Red-Black tree to store key-value pairs, maintaining order based on keys.
HashMap allows one null key and multiple null values, while TreeMap does not allow null keys.
Example: HashMap<String, Integer> map = new HashMap<>(); TreeMap<String, Integer> treeMap = ne...read more
Q7. 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
Q8. How to handle Exception in SpringBoot?
Exception handling in SpringBoot involves using @ExceptionHandler, @ControllerAdvice, and global exception handling.
Use @ExceptionHandler annotation in controller classes to handle specific exceptions.
Use @ControllerAdvice annotation to define global exception handling for all controllers.
Implement a custom exception handler class to handle exceptions globally.
Use ResponseEntity to return custom error messages and status codes.
Handle exceptions gracefully to provide meaningfu...read more
Q9. 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
Q10. 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
Q11. 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
Q12. 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<>();
Q13. 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
Q14. What is Eureka Server?
Eureka Server is a service registry for microservices in a cloud environment.
Eureka Server is part of Netflix OSS and allows microservices to register themselves and discover other services.
It helps in load balancing and failover of services by keeping track of available instances.
Eureka Server uses a REST API for communication between services and the server.
Example: Microservices A, B, and C register themselves with Eureka Server and can discover each other using service na...read more
Q15. What is circuit Breaker?
Circuit Breaker is a design pattern used in software development to prevent cascading failures in distributed systems.
Circuit Breaker monitors the health of a service and stops sending requests if the service is not responding properly.
It helps in improving the resilience of the system by providing a fallback mechanism when a service is down.
Circuit Breaker can be configured with thresholds for error rates or response times to trigger opening or closing.
Examples of Circuit Br...read more
Q16. What is docker and kubernates?
Docker is a platform for developing, shipping, and running applications in containers. Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
Docker allows developers to package applications and dependencies into containers for easy deployment and scalability.
Kubernetes helps in automating the deployment, scaling, and management of containerized applications across clusters of hosts.
Docker and Kubernetes work well ...read more
Q17. 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.
Q18. 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
Q19. 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
Q20. 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
Q21. 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
Q22. 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
Q23. 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
Q24. 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 Ford Motor
Top Senior Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month