Capgemini
80+ Redington Interview Questions and Answers
Q1. Is Java platform-independent, if yes why?
Yes, Java is platform-independent because of its 'write once, run anywhere' principle.
Java programs are compiled into bytecode, which can be executed on any platform with a Java Virtual Machine (JVM).
The JVM acts as an interpreter, translating the bytecode into machine code specific to the underlying platform.
This allows Java programs to run on different operating systems and hardware architectures without modification.
For example, a Java program developed on a Windows machin...read more
Q2. What is tha difference between object and object reference and object reference variable
Object is an instance of a class while object reference is a variable that holds the memory address of the object.
Object is a real-world entity while object reference is a pointer to the memory location of the object.
Object reference variable is a variable that holds the reference of an object.
Object reference can be null while object cannot be null.
Multiple object references can refer to the same object.
Object reference can be reassigned to another object while object cannot...read more
Q3. //design patterns //markers interface // example of functional interface . can you override Default method. Can you directly or do you need object. give some examples of functional interface //one try catch fin...
read moreThe interview questions cover a wide range of topics including design patterns, exception handling, Hibernate, MongoDB, Java collections, Spring framework, and microservices.
Design patterns like markers interface, functional interface, and Singleton pattern are important in Java development.
Understanding exception handling with try-catch-finally blocks is crucial for handling errors in Java applications.
Knowing the differences between load and get in Hibernate, as well as the...read more
Q4. What are the internal partitions of the java virtual machine .
Internal partitions of Java Virtual Machine
Java Virtual Machine has three internal partitions: Heap, Stack, and Method Area
Heap is used for dynamic memory allocation of objects and arrays
Stack is used for storing method frames and local variables
Method Area is used for storing class-level data such as method code and static variables
Q5. Explain public static void main (String args []) in Java.
Entry point for Java programs.
public: Access modifier that allows the method to be called from anywhere.
static: Method belongs to the class and not to any instance of the class.
void: Method does not return any value.
main: Method name that is recognized by JVM as the entry point for the program.
String args[]: Command line arguments passed to the program as an array of strings.
Q6. Why Java Strings are immutable in nature?
Java Strings are immutable to ensure data integrity and security.
Immutable strings prevent accidental modification of data.
String pooling optimizes memory usage by reusing existing strings.
Immutable strings are thread-safe, simplifying concurrent programming.
String immutability allows for efficient caching and hashing.
Immutable strings enable safe sharing of string references.
Q7. How would you handle a scenario where one microservice is awaiting a response from another microservice that is taking an extended time to respond?
I would implement timeout mechanisms and retries to handle the scenario of one microservice awaiting a response from another microservice taking an extended time.
Implement timeout mechanisms in the calling microservice to limit the waiting time for a response.
Set up retry logic to automatically resend the request to the slow microservice if no response is received within the specified timeout period.
Use circuit breakers to prevent cascading failures and quickly handle the sit...read more
Q8. What improvements to interfaces were introduced in Java 8 that were missing in Java 7, specifically regarding static and default methods?
Java 8 introduced static and default methods in interfaces, allowing for method implementation and code reusability.
Java 8 introduced static methods in interfaces, allowing for method implementation directly in the interface itself.
Default methods were also introduced in Java 8, enabling interfaces to have method implementations without affecting implementing classes.
Static methods in interfaces can be called using the interface name, while default methods can be overridden b...read more
Q9. In a Spring Boot application with two databases, how can you configure JDBC to specify which database to use?
Configure JDBC in Spring Boot to specify which database to use
Define multiple DataSource beans in the configuration class
Use @Primary annotation to specify the primary DataSource
Use @Qualifier annotation to specify the secondary DataSource
Inject the DataSource beans where needed in the application
Q10. What is the final keyword in Java?
The final keyword in Java is used to declare a constant variable or to prevent method overriding and class inheritance.
Final variables cannot be reassigned once initialized
Final methods cannot be overridden by subclasses
Final classes cannot be inherited by other classes
Example: final int MAX_VALUE = 100;
Example: final void printMessage() { System.out.println("Hello World!"); }
Example: final class MyClass { ... }
Q11. ArrayList(); al.add(new Employee(1,"Amanda",25000,"IT")); al.add(new Employee(2,"Berlin",35000,"HR")); al.add(new Employee(3,"Caroline",40000,"IT)); al.add(new Employee(4,"Damodar",30000,"HR")); using java 8 sl...
read moreFilter employees with salary > 25,000 and department IT using Java 8.
Use Java 8 stream API to filter employees based on salary and department.
Use lambda expressions to define the filtering criteria.
Example: employees.stream().filter(e -> e.getSalary() > 25000 && e.getDepartment().equals("IT")).collect(Collectors.toList());
Q12. Explain JDK, JRE & JVM?
JDK is a development kit, JRE is a runtime environment, and JVM is a virtual machine for executing Java code.
JDK includes JRE and development tools like compiler and debugger
JRE includes JVM and necessary libraries to run Java applications
JVM is responsible for interpreting Java bytecode and executing it
JDK is used for developing Java applications, JRE is used for running them
Example: JDK 8 includes JRE 8 and tools like javac and jdb
Example: JRE 11 includes JVM 11 and librari...read more
Q13. How to use a jetty server in your spring boot application ?
To use a Jetty server in a Spring Boot application, you can configure it as a dependency and customize its settings.
Add Jetty server dependency in your pom.xml file
Exclude Tomcat server dependency if it's included by default in Spring Boot
Configure Jetty server settings in application.properties or application.yml file
Example: Add Jetty dependency - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency>
Q14. Explain internal working of HashMap ? How to synchronize it ?
HashMap is a data structure that stores key-value pairs and uses hashing to efficiently retrieve values.
HashMap uses an array of linked lists to store key-value pairs.
When a key-value pair is added, the key is hashed to determine the index in the array where it will be stored.
If multiple keys hash to the same index, a linked list is used to handle collisions.
To synchronize a HashMap, you can use the synchronizedMap() method from the Collections class.
Example: Map<String, Inte...read more
Q15. What is your Java String Pool?
Java String Pool is a cache of String objects stored in heap memory.
String literals are automatically added to the pool.
String objects created using the 'new' keyword are not added to the pool.
String.intern() method can be used to add a String object to the pool.
String pool helps in saving memory by reusing common String literals.
Q16. Will the program compile if the parent class throws a runtime exception while the child class throws an arithmetic exception?
No, the program will not compile if the parent class throws a runtime exception while the child class throws an arithmetic exception.
In Java, if a parent class method throws a checked exception, the child class method can only throw the same exception or its subclasses.
ArithmeticException is an unchecked exception, so if the parent class throws a checked exception and the child class throws an unchecked exception, the program will not compile.
Example: If the parent class meth...read more
Q17. What is hash collision. From which class is hashCode() and equals() method from
Hash collision occurs when two different inputs produce the same hash value. hashCode() and equals() methods are from Object class.
Hash collision can occur when two different objects have the same hash code value.
hashCode() method is used to get the hash code value of an object.
equals() method is used to compare two objects for equality.
Q18. SOLID principles in java. Any features in java8 which are there which follows SOLID principle
SOLID principles in Java focus on object-oriented design principles. Java 8 features like lambdas and streams adhere to these principles.
S - Single Responsibility Principle: Java 8 lambdas allow for defining single-purpose functions.
O - Open/Closed Principle: Java 8 streams enable extending behavior without modifying existing code.
L - Liskov Substitution Principle: Java 8 interfaces support polymorphism and substitution of implementations.
I - Interface Segregation Principle: ...read more
Q19. Singleton class in Java. How to write a code in java to make a class singleton
A Singleton class in Java ensures that only one instance of the class is created and provides a global point of access to it.
Use a private static instance variable to hold the single instance of the class.
Make the constructor private to prevent instantiation from outside the class.
Provide a public static method to access the single instance, creating it if necessary.
Q20. How many teams involved in spiral model?
The number of teams involved in spiral model varies based on the project requirements.
Spiral model is a flexible model that allows for multiple teams to work on different phases simultaneously.
The number of teams involved can range from one to many depending on the size and complexity of the project.
Each team is responsible for a specific phase of the project, such as planning, design, implementation, and testing.
For example, a large software development project may involve m...read more
Q21. What are constructors in Java?
Constructors are special methods used to initialize objects in Java.
Constructors have the same name as the class they belong to.
They are called automatically when an object is created.
They can be overloaded to accept different parameters.
Example: public class Car { public Car(String make, String model) { ... } }
Example: Car myCar = new Car("Toyota", "Camry");
Q22. Explain circuit breaker, and how to practically implement it
Circuit breaker is a design pattern used to prevent cascading failures in distributed systems.
Circuit breaker monitors for failures and trips when a threshold is reached
It then redirects calls to a fallback mechanism to prevent further failures
Once the system stabilizes, the circuit breaker can be reset to allow normal operation
Q23. Exception handling in springboot. How to implement controllerAdvice
ControllerAdvice in Spring Boot is used for global exception handling in RESTful APIs.
Create a class annotated with @ControllerAdvice
Use @ExceptionHandler to define methods to handle specific exceptions
Use @RestControllerAdvice for returning JSON responses
Q24. Java 8 features' Spring boot annotation what is Qualifier annotation Diff between comparable and comparator HTTP Methods @Autowire annotation
Java 8 features include Qualifier annotation, Comparable vs Comparator, HTTP Methods, and @Autowired annotation in Spring Boot.
Qualifier annotation in Spring is used to distinguish between beans of the same type.
Comparable interface is used to define the natural ordering of objects, while Comparator interface is used for custom sorting logic.
HTTP Methods like GET, POST, PUT, DELETE are used to perform different operations on resources.
@Autowired annotation in Spring is used f...read more
Q25. how you do testing, code quality, deployment activities,
I use automated testing tools for testing, follow coding standards for code quality, and use CI/CD pipelines for deployment.
I use JUnit and Mockito for unit testing, Selenium for UI testing, and Postman for API testing.
I follow coding standards like SOLID principles, design patterns, and code reviews to ensure code quality.
I use Jenkins or GitLab CI/CD pipelines for automated deployment to various environments like development, testing, and production.
Q26. Write a code so that unique elements from an array can be printed
Code to print unique elements from an array of strings
Create a HashSet to store unique elements
Iterate through the array and add elements to the HashSet
Print out the elements in the HashSet to get unique elements
Q27. Write a code to find the second largest element in an array
Code to find the second largest element in an array
Iterate through the array and keep track of the largest and second largest elements
Initialize variables to store the largest and second largest elements
Compare each element with the largest and second largest elements and update accordingly
Q28. what is static binding and dynamic binding?
Static binding is resolved at compile time, while dynamic binding is resolved at runtime.
Static binding is also known as early binding, where the method call is resolved at compile time based on the type of reference variable.
Dynamic binding is also known as late binding, where the method call is resolved at runtime based on the actual object type.
Example of static binding: method overloading.
Example of dynamic binding: method overriding.
Q29. Difference between @RequestParam and @PathVariable ?
RequestParam is used to extract query parameters from the URL, while PathVariable is used to extract values from the URI path.
RequestParam is used for query parameters in the URL, while PathVariable is used for values in the URI path.
RequestParam is optional, while PathVariable is required.
RequestParam is used with the @RequestParam annotation, while PathVariable is used with the @PathVariable annotation.
Example: @RequestParam is used for ?id=123 in the URL, while @PathVariab...read more
Q30. take your name as string, remove vowels and get back your name
Remove vowels from a given string to get the original name back.
Create a function to iterate through each character of the string
Check if the character is a vowel (a, e, i, o, u) and remove it
Return the modified string
Q31. Difference between @controller and @ restCOntroller,
Difference between @Controller and @RestController in Java.
Both are used for creating RESTful web services in Java.
@Controller returns the view while @RestController returns the data in JSON or XML format.
@RestController is a combination of @Controller and @ResponseBody annotations.
Use @Controller for traditional web applications and @RestController for RESTful web services.
Q32. write code on to list employee salary greater than 30,000 using predicate in Java8
Code to list employee salary greater than 30,000 using predicate in Java8
Use Java8 Predicate interface to filter employees based on salary
Create a Predicate to check if employee salary is greater than 30,000
Apply the Predicate to filter the list of employees
Q33. How to handel global exception in spring boot
Global exception handling in Spring Boot can be achieved using @ControllerAdvice and @ExceptionHandler annotations.
Create a class annotated with @ControllerAdvice to handle global exceptions
Define methods in this class annotated with @ExceptionHandler for specific exception types
Return a ResponseEntity with appropriate status code and error message in the @ExceptionHandler methods
Q34. What tool you have used
I have used various tools including Eclipse, IntelliJ IDEA, Maven, Git, JIRA, and Jenkins.
Eclipse - for Java development and debugging
IntelliJ IDEA - for Java development and debugging
Maven - for project management and build automation
Git - for version control and collaboration
JIRA - for issue tracking and project management
Jenkins - for continuous integration and deployment
Q35. What is spiral model?
Spiral model is a software development model where the process is divided into smaller cycles.
It is a combination of waterfall and iterative model
Each cycle involves planning, risk analysis, development, and testing
It is suitable for large and complex projects
Example: Microsoft Office was developed using the spiral model
Q36. How spring boot will work two databases
Spring Boot can work with two databases by configuring multiple data sources and using @Primary annotation.
Configure multiple data sources in application.properties or application.yml
Use @Primary annotation to specify the primary data source
Use @Qualifier annotation to specify the secondary data source
Example: @Configuration @EnableTransactionManagement public class DatabaseConfig { @Primary @Bean(name = "primaryDataSource") @ConfigurationProperties(prefix = "spring.datasourc...read more
Q37. What is method overloading?
Method overloading is when a class has multiple methods with the same name but different parameters.
Method overloading allows for more flexibility in method calls
The methods must have different parameters, either in number or type
Example: public void print(int num) and public void print(String str)
Overloading constructors is also common in Java
Q38. How many steps spiral model?
The spiral model has four steps.
The four steps are: Planning, Risk Analysis, Engineering, and Evaluation.
Each step involves iterative development and feedback from stakeholders.
The model is used in software development to manage risk and ensure quality.
Example: A software development team may use the spiral model to create a new product.
The team would start with planning, then move on to risk analysis, engineering, and evaluation.
Q39. take 2 arrays, merge them and get back an array
Merge two arrays of strings into a single array
Create a new array with the combined length of the two input arrays
Copy elements from the first array to the new array
Copy elements from the second array to the new array starting from the end of the first array
Q40. Diff between linked list and array list Hashmap
Linked list and array list are both data structures in Java, but they have key differences in terms of implementation and performance.
Linked list uses nodes with pointers to the next node, while array list uses a dynamic array to store elements.
Linked list allows for efficient insertion and deletion of elements, while array list is faster for random access.
HashMap is a data structure that stores key-value pairs and uses hashing to quickly retrieve values based on keys.
Q41. What is java?
Java is a high-level, object-oriented programming language used to develop applications for various platforms.
Java is platform-independent and can run on any device with a Java Virtual Machine (JVM)
It is known for its security features and is commonly used for developing web and mobile applications
Java is also used for developing enterprise-level applications and software tools
Examples of popular Java-based applications include Minecraft, Android OS, and Apache Hadoop
Q42. What is method overriding?
Method overriding is when a subclass provides its own implementation of a method that is already defined in its superclass.
The method in the subclass must have the same name, return type, and parameters as the method in the superclass.
The access level of the overriding method cannot be more restrictive than the overridden method.
Example: class Dog extends Animal { public void makeSound() { System.out.println("Bark"); } }
Example: Animal myAnimal = new Dog(); myAnimal.makeSound...read more
Q43. Write a code to remove duplicate number from list
Code to remove duplicate numbers from a list in Java
Create a Set to store unique numbers
Iterate through the list and add each number to the Set
Convert the Set back to a list to get the list without duplicates
Q44. What is data?
Data is information that is stored and can be processed by a computer.
Data can be in various forms such as text, numbers, images, audio, video, etc.
Data can be structured or unstructured.
Examples of data include customer information, financial records, sensor readings, social media posts, etc.
Q45. What is method?
A method is a block of code that performs a specific task and can be called by other parts of the program.
Methods are used to break down a program into smaller, more manageable pieces.
They can take input parameters and return values.
Examples of methods include print(), sort(), and calculateArea().
Q46. What is oops?
OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.
OOPs focuses on creating objects that contain both data and functions to manipulate that data.
It emphasizes on encapsulation, inheritance, and polymorphism.
Java is an OOPs language. Example: A car is an object that has properties like color, model, and functions like start, stop, etc.
Q47. What is oops concepts
OOPs concepts are the fundamental principles of Object-Oriented Programming.
Encapsulation: Binding data and functions that manipulate the data within a single unit.
Inheritance: A mechanism that allows a new class to be based on an existing class.
Polymorphism: The ability of an object to take on many forms.
Abstraction: Hiding the implementation details and showing only the functionality to the user.
Q48. explain the oops concepts
OOPs concepts are the fundamental principles of object-oriented programming.
Abstraction: hiding implementation details
Encapsulation: binding data and methods together
Inheritance: creating new classes from existing ones
Polymorphism: using a single interface to represent multiple entities
Objects: instances of classes with their own state and behavior
Q49. Explain OOPS Concepts in detail with examples
OOPS concepts revolve around the principles of Encapsulation, Inheritance, Polymorphism, and Abstraction in object-oriented programming.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class). Example: Class Car with properties like make, model, and methods like start(), stop().
Inheritance: Allows a class to inherit properties and behavior from another class. Example: Class Truck inheriting from class Vehicle.
Polymorphism: Ability of a met...read more
Q50. what is functional interface?
Functional interface is an interface with only one abstract method, used for lambda expressions.
Functional interface can have multiple default or static methods.
It can also have methods from Object class, like equals(), hashCode(), etc.
Example: java.util.function.Function is a functional interface with apply() method.
Q51. Difference between java 8 and Java 11
Java 11 has more features and improvements than Java 8.
Java 11 has introduced new features like var keyword, HTTP client API, and local variable syntax for lambda parameters.
Java 11 has removed some features like JavaFX and Nashorn JavaScript engine.
Java 11 has improved performance and security.
Java 8 is no longer supported for commercial use.
Java 11 requires a higher version of the operating system than Java 8.
Q52. What is circuit breaker pattern
Circuit breaker pattern is a design pattern used in software development to prevent system failures and improve resilience.
Circuit breaker pattern is used to handle faults in distributed systems.
It monitors for failures and trips when a threshold is reached, preventing further requests.
Once the circuit breaker trips, it can be configured to allow some requests through to check if the system has recovered.
If the system has recovered, the circuit breaker closes and normal opera...read more
Q53. What is a controller.
A controller is a component in the Model-View-Controller (MVC) design pattern that handles user input and updates the model and view accordingly.
Controls the flow of the application
Interacts with the model to update data
Receives input from the user and processes it
Updates the view based on changes in the model
Examples: Spring MVC Controller, JavaFX Controller
Q54. What is optional class
Optional class is a container object which may or may not contain a non-null value.
Optional class was introduced in Java 8 to handle NullPointerExceptions.
It is used to avoid null checks and make the code more readable.
Methods like isPresent(), ifPresent(), orElse() are commonly used with Optional class.
Q55. Create a singleton class in Java
Singleton class in Java ensures only one instance of the class is created
Create a private static instance of the class
Private constructor to prevent instantiation
Provide a public static method to access the instance
Q56. what is Normalization
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalization helps in reducing data redundancy by breaking down data into smaller, manageable parts.
It improves data integrity by ensuring that each piece of data is stored in only one place.
Normalization involves dividing a database into multiple tables and defining relationships between them.
There are different levels of normalization, such as First Normal Form (1N...read more
Q57. Difference between Array and ArrayList
Array is a fixed-size data structure while ArrayList is a dynamic-size data structure.
Array is a primitive data type while ArrayList is a class in Java.
Array can hold only homogeneous data types while ArrayList can hold heterogeneous data types.
Array uses [] to declare while ArrayList uses <>.
Array can be multidimensional while ArrayList is always one-dimensional.
Array length is fixed while ArrayList size is dynamic and can be changed during runtime.
Q58. workflow in a Spring boot appln
Workflow in a Spring Boot application involves defining the sequence of steps and actions to be executed.
Define the sequence of steps using Spring's @Bean annotation
Use Spring's @Autowired annotation to inject dependencies
Utilize Spring's @Service annotation to mark classes as service components
Implement business logic in service classes
Use Spring's @RestController annotation to create RESTful APIs
Q59. What are solid principles
SOLID principles are a set of five design principles that help developers create more maintainable and scalable software.
S - Single Responsibility Principle: A class should have only one reason to change.
O - Open/Closed Principle: Software entities 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.
I - Interface Segregation ...read more
Q60. String literal count in a string.
Count the number of occurrences of a specific string literal within a given string.
Iterate through the string and check for occurrences of the specified string literal.
Use the indexOf method to find the position of the specified string literal within the string.
Keep track of the count of occurrences found.
Q61. Internal working of circuit breaker
Circuit breaker is a design pattern used in software development to prevent system failures by temporarily stopping requests to a failing service.
Circuit breaker monitors the number of failures and opens when a threshold is reached.
When the circuit is open, requests are not sent to the failing service, preventing further failures.
After a specified time, the circuit breaker closes and allows requests to be sent again.
Example: Netflix's Hystrix library implements circuit breake...read more
Q62. Frequency of occurrence of words
Frequency of occurrence of words in a given text can be calculated by counting each word and storing it in a data structure.
Split the text into words using whitespace as delimiter
Create a map to store word frequencies
Iterate through the words and update the frequency count in the map
Return the map with word frequencies
Q63. What is Spring Security
Spring Security is a powerful and customizable authentication and access control framework for Java applications.
Provides authentication and authorization capabilities for Java applications
Integrates with Spring Framework for easy configuration and usage
Supports various authentication mechanisms like form-based, basic, OAuth, etc.
Allows for fine-grained access control through roles and permissions
Can be easily extended and customized to fit specific security requirements
Q64. Difference between equals and ==
Equals method compares the content of objects, while == compares the memory addresses of objects.
Equals method is used to compare the content of objects, while == is used to compare the memory addresses of objects.
Equals method is overridden in the Object class to provide a meaningful comparison for objects.
Example: String str1 = new String("hello"); String str2 = new String("hello"); str1.equals(str2) will return true, but str1 == str2 will return false.
Q65. Characters finding using Stream Api
Using Stream API to find characters in a string
Use the chars() method to convert the string to an IntStream of characters
Use filter() method to filter out specific characters
Use collect() method to collect the characters into an array of strings
Q66. what is Serialization ?
Serialization is the process of converting an object into a stream of bytes to store or transmit data.
Serialization is used to save the state of an object and recreate it when needed.
It is commonly used in Java for saving objects to a file or sending them over a network.
The Serializable interface in Java is used to mark classes as serializable.
Objects can be serialized and deserialized using ObjectOutputStream and ObjectInputStream classes.
Q67. sql query to get even row data
Use SQL query with MOD function to get even row data
Use MOD function to filter out even rows
Example: SELECT * FROM table_name WHERE MOD(row_number, 2) = 0;
Q68. What are abstraction
Abstraction is the process of hiding complex implementation details and showing only the necessary information to the user.
Abstraction is achieved through abstract classes and interfaces in Java.
It helps in reducing complexity and improving maintainability of code.
For example, a car dashboard abstracts the complex internal workings of the car and shows only the necessary information to the driver.
Abstraction also helps in achieving loose coupling between different components ...read more
Q69. What are java 8 features
Java 8 introduced several new features including lambda expressions, streams, functional interfaces, and default methods.
Lambda expressions allow you to write code in a more concise and readable way.
Streams provide a way to work with collections of objects in a functional style.
Functional interfaces are interfaces with a single abstract method, which can be implemented using lambda expressions.
Default methods allow interfaces to have method implementations.
Other features incl...read more
Q70. What is actuator?
Actuator is a Spring Boot module that provides production-ready features to help monitor and manage your application.
Actuator endpoints provide information about your application such as health, metrics, and environment details.
It allows you to interact with your application through HTTP endpoints to monitor and manage it.
Actuator can be used to check the health of your application, gather metrics, view thread dump, and more.
Examples of actuator endpoints include /actuator/he...read more
Q71. Design patterns used in Microservices
Design patterns commonly used in Microservices include Service Registry, Circuit Breaker, and API Gateway.
Service Registry: Used to register and discover services within a microservices architecture. Example: Netflix Eureka.
Circuit Breaker: Prevents cascading failures by temporarily halting requests to a service that is failing. Example: Netflix Hystrix.
API Gateway: Acts as a single entry point for clients to access multiple microservices. Example: Netflix Zuul.
Q72. type of indexes in sql
Types of indexes in SQL include clustered, non-clustered, unique, and composite indexes.
Clustered index physically reorders the table based on the index key
Non-clustered index creates a separate structure for the index
Unique index ensures that no two rows have the same key values
Composite index uses multiple columns as the index key
Q73. Multithreading vs multitasking
Multithreading involves multiple threads within a single process, while multitasking involves running multiple processes simultaneously.
Multithreading allows multiple threads to share the same memory space and resources, leading to more efficient resource utilization.
Multitasking involves running multiple processes concurrently, each with its own memory space and resources.
Example: A web server handling multiple client requests concurrently using multithreading, while a compu...read more
Q74. Explain Oops concept in details
OOPs (Object-Oriented Programming) is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOPs focuses on creating objects that interact with each other to solve a problem.
Key principles of OOPs include Inheritance, Encapsulation, Polymorphism, and Abstraction.
Inheritance allows a class to inherit properties and behavior from another class.
Encapsulation involves bundling data and methods that ...read more
Q75. Exception handling in spring
Exception handling in Spring allows for graceful handling of errors and exceptions in a Spring application.
Spring provides a centralized way to handle exceptions using @ControllerAdvice annotation.
You can define custom exception classes and handle them using @ExceptionHandler annotation.
Global exception handling can be configured using @ExceptionHandler and @ResponseStatus annotations.
Q76. explain polymorphism in Java
Polymorphism in Java allows objects of different classes to be treated as objects of a common superclass.
Polymorphism is achieved through method overriding and method overloading.
Method overriding allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
Method overloading allows multiple methods with the same name but different parameters to coexist in the same class.
Polymorphism helps in achieving flexibility and extensibi...read more
Q77. Explain java datatypes in java
Java datatypes are used to define the type of data that a variable can hold.
Java has two categories of datatypes: primitive and non-primitive
Primitive datatypes include int, double, char, boolean, etc.
Non-primitive datatypes include classes, interfaces, arrays, etc.
Each datatype has a specific size and range of values it can hold
Q78. Explain SQL data types
SQL data types define the type of data that can be stored in a database table columns.
SQL data types include numeric, character, date/time, and binary types
Examples: INT, VARCHAR, DATE, BLOB
Data types determine the storage format, constraints, and operations that can be performed on the data
Q79. Functional interface in Java
Functional interface in Java is an interface with only one abstract method.
Functional interfaces can have multiple default or static methods.
Examples include Runnable, Callable, and Comparator interfaces.
Lambda expressions can be used to implement functional interfaces concisely.
Q80. Predicate supplier consumer
Predicate, Supplier, and Consumer are functional interfaces in Java used for different purposes.
Predicate: Represents a boolean-valued function of one argument. Used for filtering collections.
Supplier: Represents a supplier of results. Does not take any arguments but produces a result.
Consumer: Represents an operation that accepts a single input argument and returns no result.
Q81. Oops concepts in details
Object-oriented programming concepts in Java
Encapsulation: bundling data and methods together
Inheritance: creating new classes from existing ones
Polymorphism: using a single interface to represent multiple types
Abstraction: hiding implementation details
Encapsulation: grouping related data and methods into a class
Association: relationship between two or more objects
Composition: creating complex objects by combining simpler ones
Aggregation: relationship where one object contain...read more
Q82. constants in sql
Constants in SQL are values that remain the same throughout the execution of a query or program.
Constants can be defined using the 'CONST' keyword in SQL.
They are used to store values that do not change during the execution of a query.
Constants can be used in WHERE clauses, JOIN conditions, and other parts of a SQL query.
Example: CONST MAX_VALUE = 100;
Q83. rotate 2d array in ide
To rotate a 2D array in an IDE, you can use nested loops to transpose the array and then reverse each row.
Use nested loops to transpose the array (swap rows with columns)
Reverse each row of the transposed array to rotate it clockwise
Ensure to handle edge cases like empty arrays or non-square arrays
Example: [[1, 2, 3], [4, 5, 6], [7, 8, 9]] can be rotated to [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
Q84. Jax rs definition
JAX-RS (Java API for RESTful Web Services) is a Java programming language API that provides support in creating web services according to the Representational State Transfer (REST) architectural style.
JAX-RS is used to simplify the development of web services in Java.
It provides annotations to define resources and their methods in a RESTful manner.
JAX-RS implementations include Jersey, RESTEasy, and Apache CXF.
Q85. explain Oops in java
Object-oriented programming concepts in Java
Oops stands for Object-oriented programming
It involves concepts like classes, objects, inheritance, polymorphism, encapsulation
Java is an object-oriented programming language
Example: class Car { String color; void start() { //code here } }
Q86. Write a java Program
A Java program to find the sum of elements in an array
Create an array of integers
Iterate through the array and add each element to a sum variable
Return the sum
More about working at Capgemini
Interview Process at Redington
Top Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month