Infosys
20+ Fold Health Interview Questions and Answers
Q1. A query in backend yields to 500 results but in UI you have to sort it to 10 results per page, how will you help UI achieve this?
Implement pagination in UI by limiting results to 10 per page.
Implement pagination logic in UI to display 10 results per page.
Use backend query parameters like 'offset' and 'limit' to fetch specific results.
Utilize front-end frameworks like React or Angular for efficient pagination implementation.
Q2. If I have OS and JDK only How will you setup a Spring-Boot project in my laptop?
To set up a Spring-Boot project with only OS and JDK, you need to install Maven and then create a new project using Spring Initializr.
Install Apache Maven to manage dependencies and build the project
Use Spring Initializr to generate a new Spring Boot project with required dependencies
Import the project into your IDE and start coding
Q3. Using single API endpoint can you perform all 3 operations, 1- Get the data, 2- Supply the data, 3- delete the data?
Yes, by implementing a RESTful API with different HTTP methods for each operation.
Implement a RESTful API with different endpoints for each operation: GET for retrieving data, POST for supplying data, and DELETE for deleting data.
For example, GET /data to retrieve data, POST /data to supply data, and DELETE /data/{id} to delete data by ID.
Use proper HTTP methods and status codes to handle each operation effectively.
Q4. what about concurrent HashMap? spring framework IOC And DI
ConcurrentHashMap is a thread-safe implementation of the Map interface in Java.
ConcurrentHashMap allows multiple threads to read and write to the map concurrently without the need for external synchronization.
It is part of the java.util.concurrent package and provides better performance in multi-threaded environments compared to synchronized HashMap.
Spring framework supports the use of ConcurrentHashMap for managing beans in a concurrent environment.
Inversion of Control (IoC)...read more
Q5. What are the Spring boot annotations you use commonly?
Commonly used Spring Boot annotations include @RestController, @Autowired, @RequestMapping, @Service, @Component, @Repository.
@RestController - Used to define RESTful web services.
@Autowired - Used for automatic dependency injection.
@RequestMapping - Used to map web requests to specific handler methods.
@Service - Used to indicate that a class is a service component.
@Component - Used to indicate that a class is a Spring component.
@Repository - Used to indicate that a class is ...read more
Q6. What is the latest REST API you have developed?
I recently developed a REST API for a banking application to handle customer transactions.
Implemented CRUD operations for customer accounts and transactions
Used Spring Boot framework for building the API
Secured API endpoints using OAuth 2.0 authentication
Utilized Swagger for API documentation
Q7. What is role of pom.xml in a maven project?
pom.xml is a configuration file in a Maven project that defines project dependencies, build settings, and plugins.
Defines project dependencies and their versions
Specifies build settings such as source directory, target directory, and compiler version
Configures plugins for various tasks like compiling code, running tests, packaging the project
Helps in managing project lifecycle phases like clean, compile, test, package, install, deploy
Q8. what is difference between method reference and functional interface?
Method reference is a shorthand syntax for lambda expressions, while functional interface is an interface with a single abstract method.
Method reference is used to refer to methods or constructors without invoking them, providing a more concise way to write lambda expressions.
Functional interface is an interface that has only one abstract method, which can be implemented using lambda expressions or method references.
Example: Consumer
consumer = System.out::println; is a metho...read more
Q9. What are the main dependencies added while creating application
Main dependencies added while creating an application include libraries, frameworks, and external services.
Libraries: such as Apache Commons, Guava, or Jackson for additional functionality
Frameworks: like Spring, Hibernate, or Angular for structuring the application
External services: such as databases like MySQL or MongoDB, or APIs for integration
Q10. Explain the practical difference between GET & POST method calls?
GET is used to request data from a specified resource, while POST is used to submit data to a specified resource.
GET requests are idempotent, meaning they can be repeated without changing the result, while POST requests are not.
GET requests can be cached, bookmarked, and shared, while POST requests cannot.
GET requests have a limit on the amount of data that can be sent, while POST requests do not have such limitations.
GET requests should only be used for retrieving data, whil...read more
Q11. How do you achieve Pagination in APIs?
Pagination in APIs is achieved by using query parameters like page number and page size.
Use query parameters like 'page' and 'size' to specify the page number and number of items per page.
Implement logic in the backend to fetch and return only the specified page of data.
Calculate the total number of pages based on the total number of items and page size.
Include links to navigate to the next and previous pages in the API response.
Q12. What are actuators in Spring boot?
Actuators in Spring Boot are built-in tools that help monitor and manage the application.
Actuators provide endpoints to monitor application health, metrics, info, etc.
They can be used to interact with the application at runtime.
Examples include /actuator/health, /actuator/metrics, /actuator/info, etc.
Q13. Memory leaks and how to avoid the same.
Memory leaks occur when a program allocates memory but does not release it, leading to inefficient memory usage.
Use tools like profilers to identify memory leaks in Java applications.
Avoid creating unnecessary objects and ensure proper garbage collection.
Avoid static references to objects that can prevent them from being garbage collected.
Close resources like files, database connections, and streams after use to prevent memory leaks.
Q14. difference between throw and throws, difference between string and stringbuilder
throw vs throws: throw is used to explicitly throw an exception, throws is used in method signature to declare exceptions that can be thrown. String vs StringBuilder: String is immutable, StringBuilder is mutable.
throw is used to explicitly throw an exception, while throws is used in method signature to declare exceptions that can be thrown
String is immutable, meaning once created, its value cannot be changed. StringBuilder is mutable, allowing for modifications to the string...read more
Q15. difference between abstract and interfaces, sql queries
Abstract classes can have both abstract and non-abstract methods, while interfaces can only have abstract methods. SQL queries are used to retrieve data from databases.
Abstract classes can have abstract and non-abstract methods, while interfaces can only have abstract methods
Abstract classes can have constructors, while interfaces cannot
A class can implement multiple interfaces, but can only extend one abstract class
SQL queries are used to retrieve data from databases based o...read more
Q16. differnce between final, finally and finalize..
final, finally and finalize are all related to Java programming language.
final is a keyword used to declare a constant variable or to prevent method overriding.
finally is a block used in try-catch to execute code after try and catch blocks.
finalize is a method used to perform cleanup operations on an object before it is garbage collected.
final and finally are keywords, while finalize is a method.
final and finally are used in code, while finalize is called by the garbage colle...read more
Q17. What the flow of spring boot application
The flow of a Spring Boot application involves initialization, configuration, component scanning, and request handling.
Spring Boot application starts by initializing the application context.
Component scanning is done to find and register beans within the application context.
Configuration classes are used to define beans and their dependencies.
Request handling is done through controllers that map incoming requests to appropriate methods.
Spring Boot auto-configures many feature...read more
Q18. Do you have cloud exposure?
Yes, I have experience working with cloud technologies such as AWS, Azure, and Google Cloud Platform.
Experience with AWS, Azure, and Google Cloud Platform
Deploying applications on cloud infrastructure
Working with cloud services like EC2, S3, and RDS
Q19. can static method be overloaded?
Yes, static methods can be overloaded in Java.
Static methods can be overloaded in Java by having multiple static methods in the same class with the same name but different parameters.
The method signature (name + parameters) must be different for each overloaded static method.
Example: public static void method(int x) and public static void method(String s) are overloaded static methods.
Q20. Versions used in tomcat and springboot
Tomcat and Spring Boot versions are independent of each other, but they can be compatible with each other.
Tomcat versions can range from 7.x to 10.x, with the latest stable version being 10.0.12.
Spring Boot versions are typically aligned with Spring Framework versions, with the latest stable version being 2.5.4.
It is important to ensure compatibility between the Tomcat and Spring Boot versions being used in a project.
Q21. what is oops concept
OOPs is a programming paradigm based on the concept of objects, which can contain data and code.
OOPs stands for Object-Oriented Programming.
It focuses on creating objects that interact with each other to solve a problem.
It includes concepts like inheritance, polymorphism, encapsulation, and abstraction.
Inheritance allows a class to inherit properties and methods from another class.
Polymorphism allows objects to take on multiple forms.
Encapsulation hides the implementation det...read more
Q22. Comparable vs comparator
Comparable is an interface used for natural ordering, while Comparator is an interface used for custom ordering.
Comparable is implemented by the class itself to define the natural ordering of objects.
Comparator is implemented by a separate class to define custom ordering of objects.
Example: String class implements Comparable interface for natural ordering, while Collections class uses Comparator for custom sorting.
Q23. annotations in spring
Annotations in Spring are used to provide metadata about the application's components, such as controllers, services, and repositories.
Annotations are used to simplify configuration and reduce the amount of XML configuration in Spring applications.
Examples of annotations in Spring include @Controller, @Service, @Repository, and @Autowired.
Annotations can be used to define transactional behavior, request mappings, and dependency injection in Spring applications.
Top HR Questions asked in Fold Health
Interview Process at Fold Health
Top Senior Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month