Infosys
100+ Globiva Interview Questions and Answers
Q2. write a code to filter out loans with incomplete status using java 8 features.
Code to filter out loans with incomplete status using Java 8 features.
Use stream() method to convert the list of loans into a stream
Use filter() method to filter out loans with incomplete status
Use collect() method to collect the filtered loans into a new list
Q3. 1.What is Singleton in java and create your own singleton class countering all breakable conditions? 2. What is Auto Configuration? 3. @Primary vs @Qualifier 4. What is idempotent? 5. What is class loader? Type...
read moreThe interview questions cover various topics related to Java development, including Singleton pattern, memory management, exception handling, Spring framework, and design patterns.
Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Auto Configuration in Spring Boot automatically configures the Spring application based on dependencies present in the classpath.
@Primary annotation is used to give higher preference to a bean when mu...read more
Q9. Difference Between Comparator and Comparable. What is fully qualified domain name? What is the working principle for an ArrayList? How do you handle an exception? What is custom exception? What is the differenc...
read moreComparator is used to compare objects for sorting, while Comparable is implemented by objects to define their natural ordering.
Comparator is an external class, while Comparable is implemented by the object itself.
Comparator can compare objects of different classes, while Comparable can only compare objects of the same class.
Comparator uses the compare() method, while Comparable uses the compareTo() method.
Q19. What is java and what is inheritance and what is oops concepts and what is method
Java is an object-oriented programming language. Inheritance is a mechanism to create new classes based on existing ones. OOPs is a programming paradigm. Method is a block of code that performs a specific task.
Java is a high-level, class-based, and object-oriented programming language.
Inheritance is a mechanism in which one class acquires the properties and behaviors of another class.
OOPs is a programming paradigm that focuses on objects and their interactions.
Method is a blo...read more
Q23. What is polymorphism in both overloading and overriding way?
Polymorphism is the ability of an object to take on multiple forms. It can be achieved through method overloading and overriding.
Method overloading is when multiple methods have the same name but different parameters. The compiler decides which method to call based on the arguments passed.
Method overriding is when a subclass provides its own implementation of a method that is already present in its parent class. The method signature remains the same.
Polymorphism allows for co...read more
Q29. Is java object oriented language or not ?
Yes, Java is an object-oriented language.
Java supports all the features of object-oriented programming such as encapsulation, inheritance, and polymorphism.
All code in Java is written inside classes, which are objects.
Java also has interfaces, which allow for multiple inheritance.
Example: Java's String class is an object that has methods and properties.
Example: Inheritance in Java allows a subclass to inherit properties and methods from a superclass.
Q30. Actuator,what is dependency injection, how to change imbeded server in spring boot,W.A.P permutation of string
Answering questions related to Actuator, Dependency Injection, changing embedded server in Spring Boot, and permutation of string.
Actuator is a Spring Boot feature that provides endpoints for monitoring and managing the application.
Dependency Injection is a design pattern that allows objects to be created with their dependencies injected from outside.
To change the embedded server in Spring Boot, you can exclude the default server dependency and add a new one.
Permutation of st...read more
Q35. What is java and what is oops concepts and what is inheritance and what is method
Java is an object-oriented programming language. OOPs concepts include inheritance, encapsulation, polymorphism, and abstraction.
Java is a high-level programming language that is platform-independent.
OOPs concepts are the foundation of Java programming.
Inheritance is a mechanism in which one class acquires the properties and behaviors of another class.
A method is a collection of statements that perform a specific task.
Examples of OOPs concepts in Java include encapsulation, p...read more
Q36. What is java and what is method and what is oops concepts and what is method
Java is an object-oriented programming language. Method is a block of code that performs a specific task. OOPs concepts are principles of object-oriented programming.
Java is a high-level programming language that is platform-independent.
Method is a block of code that performs a specific task and can be called multiple times.
OOPs concepts include inheritance, encapsulation, polymorphism, and abstraction.
Inheritance allows a class to inherit properties and methods from another ...read more
Q38. Where should use for constructor injection?
Constructor injection should be used for mandatory dependencies.
Constructor injection is used to inject mandatory dependencies into a class.
It ensures that the class cannot be instantiated without the required dependencies.
It also makes the code more testable and maintainable.
Example: A Car class requires an Engine object to function. The Engine object is injected via constructor injection.
Constructor injection is preferred over setter injection as it ensures that the depende...read more
Q39. What are aggregate and terminal operations in java8 streams
Aggregate operations perform operations on a stream of elements, while terminal operations produce a result or side-effect.
Aggregate operations include map, filter, reduce, etc.
Terminal operations include forEach, collect, reduce, etc.
Example: stream.filter(x -> x > 5).map(x -> x * 2).forEach(System.out::println);
Q40. What is java and what is method and what is oops concepts
Java is a programming language. Method is a block of code that performs a specific task. OOPs is a programming paradigm.
Java is an object-oriented programming language used to develop applications and software.
A method is a block of code that performs a specific task and can be called by other parts of the program.
OOPs is a programming paradigm that focuses on objects and their interactions to solve problems.
OOPs concepts include encapsulation, inheritance, polymorphism, and ...read more
Q41. Can we use try and finally without catch?
Yes, try and finally can be used without catch to handle exceptions.
try block is used to enclose the code that may throw an exception
finally block is used to execute code regardless of whether an exception is thrown or not
If catch block is not present, exceptions will not be caught and handled
Q42. Code in stream api - to find all the numbers less than 10 in a given array list
Using stream api to find numbers less than 10 in an array list
Use stream() method on the array list to create a stream of elements
Use filter() method with a lambda expression to filter out numbers less than 10
Collect the filtered elements using collect() method to get the result
Q45. What would you rate yourself in java on the scale of 1 to 10?
I would rate myself as an 8 in Java.
I have extensive experience in Java programming and have successfully completed multiple projects using Java.
I am familiar with various Java frameworks and libraries.
I have a strong understanding of object-oriented programming principles in Java.
I am comfortable working with Java's core features and APIs.
I continuously strive to improve my Java skills through self-learning and staying updated with the latest developments in the Java ecosyst...read more
Q47. Explain project . How encapsulation and abstraction is used in your project
The project is a web application for managing inventory and sales of a retail store.
Encapsulation is used to hide the internal implementation details of classes and only expose necessary methods and properties.
Abstraction is used to define a common interface for interacting with different types of inventory items, such as products and services.
For example, the Product class encapsulates details like name, price, and quantity, while the InventoryManager class abstracts the ope...read more
Q48. String s1=new String(null); what is the answer
The code will throw a NullPointerException.
The code tries to create a new String object with a null value, which is not allowed.
The constructor of String class does not accept null as a parameter.
The code will throw a NullPointerException at runtime.
Q49. Write a functional interface. Refer it to a Lamda Expression. Show it practically while explaining each step
A functional interface is a single abstract method interface. It can be referred to using a lambda expression.
Functional interfaces have only one abstract method
Lambda expressions can be used to implement functional interfaces
Lambda expressions provide a concise way to write anonymous functions
Functional interfaces can be used as method parameters or return types
Q50. What is HashMap? While Interating through it is it mutable?
HashMap is a data structure in Java that stores key-value pairs. It is mutable while iterating through it.
HashMap is part of the Java Collections Framework.
It allows null values and at most one null key.
It provides constant-time performance for basic operations like get and put.
While iterating through a HashMap, it is mutable and can throw ConcurrentModificationException if modified.
To avoid this, use an Iterator or ConcurrentHashMap.
Q51. what is collection and collections, what is collection framework?
Collection is a group of objects, Collections is a utility class, Collection framework is a set of interfaces and classes for handling collections.
Collection is an interface in Java that represents a group of objects known as elements.
Collections is a utility class in Java that contains static methods for operating on collections.
Collection framework is a set of interfaces and classes in Java that provides an architecture to store and manipulate groups of objects.
Examples: Li...read more
Q52. What are the various annotations used in SpringBoot (explain)
Various annotations used in SpringBoot
1. @SpringBootApplication: Marks the main class of a Spring Boot application
2. @RestController: Marks a class as a RESTful controller
3. @RequestMapping: Maps HTTP requests to handler methods
4. @Autowired: Injects dependencies automatically
5. @Component: Marks a class as a Spring component
6. @Service: Marks a class as a service component
7. @Repository: Marks a class as a repository component
8. @Configuration: Marks a class as a source of b...read more
Q53. What are Java Generics, Collections, wrapper classes?
Java Generics are used to create classes, interfaces, and methods that operate on objects of specified types. Collections are data structures to store and manipulate groups of objects. Wrapper classes provide a way to use primitive data types as objects.
Java Generics allow for type-safe operations on objects of specified types. Example: List
list = new ArrayList<>(); Collections provide data structures like List, Set, and Map to store and manipulate groups of objects. Example:...read more
Q54. Explain Final,Finally,Finalize() in Java?
Final, Finally, Finalize() are keywords in Java used for different purposes.
Final is used to declare a variable as constant.
Finally is used to execute a block of code after try-catch block.
Finalize() is a method used for garbage collection.
Final can be used with classes, methods, and variables.
Finally block is always executed whether an exception is thrown or not.
Q55. what is the difference between string and stringbuffer, difference between throw and throws
String is immutable while StringBuffer is mutable. throw is used to explicitly throw an exception, throws is used in method signature to declare exceptions that can be thrown.
String is immutable, meaning its value cannot be changed once it is created. StringBuffer is mutable, meaning its value can be changed.
StringBuffer is synchronized, making it thread-safe. String is not synchronized.
throw keyword is used to explicitly throw an exception in a method. throws keyword is used...read more
Q57. What is difference between Java and C, explain features of java
Java is a high-level programming language, while C is a low-level language. Java is platform-independent and has automatic memory management.
Java is an object-oriented language, while C is a procedural language.
Java uses a virtual machine (JVM) for execution, while C directly compiles to machine code.
Java has built-in garbage collection, while C requires manual memory management.
Java supports multithreading and exception handling, while C has limited support for these feature...read more
Q58. 1.tell me about class loader in java and how it works? 2.Types of operators in java. etc
Class loader in Java is responsible for loading classes into memory at runtime. It follows a delegation hierarchy to find and load classes.
Class loader loads classes into memory dynamically at runtime
It follows a delegation hierarchy to find and load classes
Types of operators in Java include arithmetic, bitwise, logical, assignment, etc.
Q59. What is the jQuery ajax GET request syntax?
The jQuery ajax GET request syntax is used to send an HTTP GET request to a server and retrieve data.
Use the $.ajax() method with the 'type' parameter set to 'GET'
Specify the URL of the server endpoint as the 'url' parameter
Handle the response using the 'success' callback function
Optionally, pass data to the server using the 'data' parameter
Q60. Find the duplicate element in a given array using Java 8 features.
Find duplicate element in array using Java 8 features.
Convert array to stream using Arrays.stream()
Use Collectors.groupingBy() to group elements by their occurrence
Filter the grouped elements to find duplicates
Q61. What is Functional Interface? What is Flat Map? What is Method Reference? What is stream API
Functional Interface is an interface with only one abstract method. Flat Map is used to flatten nested collections. Method Reference is a shorthand notation for lambda expressions. Stream API is used to process collections of objects.
Functional Interface is an interface with a single abstract method, such as Runnable or Comparator.
Flat Map is a method in Java that is used to flatten nested collections, like List
- > to List
. Method Reference is a shorthand notation for lambda exp...read more
Q62. have you worked on spring security then explain ?
Yes, I have worked on Spring Security. It is a powerful and customizable authentication and access control framework for Java applications.
Implemented authentication and authorization using Spring Security annotations like @Secured, @PreAuthorize, @PostAuthorize
Configured security settings in XML or Java configuration files
Used Spring Security filters for protecting URLs, CSRF protection, session management, etc.
Integrated with various authentication providers like LDAP, OAut...read more
Q63. Why java is not 100% object oriented? Explain in detail?
Java is not 100% object oriented because it supports primitive data types and static methods.
Java supports primitive data types like int, float, and boolean which are not objects.
Static methods in Java belong to the class itself and not to any specific object.
Java allows procedural programming constructs like static variables and methods.
Inheritance in Java is limited to single inheritance for classes, unlike pure object-oriented languages like Smalltalk.
Q64. Prerequisites: Payment gateway If your order fails and payment has been deducted, how do you manage this situation.
In case of order failure with payment deducted, refund the payment and investigate the issue.
Initiate refund process for the deducted payment
Investigate the reason for the order failure
Communicate with the customer about the issue and resolution
Ensure the payment gateway is functioning correctly to prevent future occurrences
Q65. What are @annotations in springboot? explain about @springBootApplication
Annotations in Spring Boot are used to provide metadata about the code. @SpringBootApplication is a meta-annotation that combines @Configuration, @EnableAutoConfiguration, and @ComponentScan.
Annotations in Spring Boot are used to simplify configuration and reduce boilerplate code.
@SpringBootApplication is a meta-annotation that enables the auto-configuration feature in Spring Boot.
It combines @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations.
Example: @S...read more
Q66. Write code to put all the zeroes of an array to the end
Move all zeroes in an array to the end without changing the order of other elements.
Iterate through the array and keep track of the index where non-zero elements should be placed.
After the iteration, fill the remaining positions with zeroes.
Q67. What are the different bean scopes in Spring
The different bean scopes in Spring are singleton, prototype, request, session, and application.
Singleton scope creates a single instance of a bean per Spring IoC container.
Prototype scope creates a new instance of a bean every time it is requested.
Request scope creates a new instance of a bean for each HTTP request.
Session scope creates a new instance of a bean for each HTTP session.
Application scope creates a single instance of a bean per ServletContext.
Q68. WAJP to establish a JDBC connection and fetch results from a database and print those results.
Establish a JDBC connection and fetch results from a database using Java.
Import the necessary JDBC packages
Load and register the JDBC driver
Establish a connection to the database
Create a statement object
Execute a query to fetch results
Iterate over the result set and print the results
Close the result set, statement, and connection
Q69. What is static variables?
Static variables are variables that belong to the class itself, rather than an instance of the class.
Static variables are declared using the 'static' keyword.
They are shared among all instances of the class.
They can be accessed without creating an object of the class.
Static variables are initialized only once, at the start of the program.
They are useful for storing data that is common to all instances of a class.
Q70. Coding: Sort list of student details using mark.
Sort list of student details by mark.
Create a custom class Student with attributes like name, mark.
Implement Comparator interface to sort by mark.
Use Collections.sort() method to sort the list of students.
Q71. How can you write custom exception in Java?
To write a custom exception in Java, create a new class that extends Exception or a subclass of Exception.
Create a new class that extends Exception or a subclass of Exception.
Add a constructor to the custom exception class to pass a message to the superclass constructor.
Throw the custom exception using the 'throw' keyword in your code.
Handle the custom exception using try-catch blocks or propagate it up the call stack.
Q72. What is transient keyword in Java?
The transient keyword in Java is used to indicate that a variable should not be serialized.
Variables marked as transient are not included in the serialization process
Transient variables are not saved when an object is serialized and are set to their default values when the object is deserialized
Useful for excluding sensitive or unnecessary data from being serialized
Q73. What is agile?How it is used in your project?
Agile is a project management methodology that emphasizes flexibility, collaboration, and iterative development.
Agile involves breaking down projects into small, manageable tasks called user stories.
It promotes frequent communication and collaboration among team members.
Iterations, or sprints, are used to deliver working software incrementally.
Adaptability and responding to change are key principles of agile.
Examples of agile methodologies include Scrum, Kanban, and Extreme P...read more
Q74. java code to explain exceptions using throws and throw
Using throws and throw in Java to handle exceptions
Use 'throws' to declare an exception in a method signature
Use 'throw' to manually throw an exception within a method
Example: public void divide(int a, int b) throws ArithmeticException { if(b == 0) throw new ArithmeticException(); }
Q75. what is oops conecpts and give example?
OOPs concepts refer to Object-Oriented Programming principles like inheritance, encapsulation, polymorphism, and abstraction.
Inheritance: Allows a class to inherit properties and behaviors from another class. Example: class Dog extends Animal.
Encapsulation: Bundling data and methods that operate on the data into a single unit. Example: private variables with public getter and setter methods.
Polymorphism: Ability to present the same interface for different data types. Example:...read more
Q76. What are functional Interfaces?
Functional interfaces are interfaces with only one abstract method, used for functional programming in Java.
Functional interfaces can have multiple default or static methods, but only one abstract method.
They are used in lambda expressions and method references for functional programming.
Examples include java.lang.Runnable, java.util.Comparator, and java.util.function.Function.
Q77. Write a program to find the missing element from the array.
Program to find missing element from array of strings
Iterate through the array and store elements in a HashSet
Iterate through another array and check if each element is present in the HashSet
Return the element that is not present in the HashSet
Q78. What are Java8 streams
Java8 streams are a sequence of elements that support functional-style operations.
Streams allow for processing sequences of elements in a functional way
They can be created from collections, arrays, or other sources
Operations like map, filter, reduce can be applied to streams
Streams are lazy, meaning they only process elements when needed
Example: List
names = Arrays.asList("Alice", "Bob", "Charlie"); Stream stream = names.stream();
Q79. What is String, collection, multithreading
String is a sequence of characters. Collection is a group of objects. Multithreading is executing multiple threads simultaneously.
String is an immutable class in Java.
Collection is an interface that provides a way to store and manipulate groups of objects.
Multithreading is used to improve the performance of an application by executing multiple threads simultaneously.
Example of collection: ArrayList, LinkedList, HashSet, TreeSet.
Example of multithreading: creating and running ...read more
Q80. How to manage during strict deadlines
Prioritize tasks, break down work into smaller chunks, communicate with team, utilize time management techniques
Prioritize tasks based on importance and urgency
Break down work into smaller, manageable chunks to make progress
Communicate with team members to ensure everyone is on the same page
Utilize time management techniques such as Pomodoro technique or Agile methodologies
Q81. Difference between list and set
List is an ordered collection that allows duplicate elements, while Set is an unordered collection that does not allow duplicates.
List maintains the insertion order of elements, while Set does not guarantee any specific order.
List allows duplicate elements, while Set does not allow duplicates.
Examples of List implementations in Java are ArrayList and LinkedList, while examples of Set implementations are HashSet and TreeSet.
Q82. Can we run Java program without main
No, a Java program cannot be run without a main method.
The main method is the entry point of a Java program, without it the program cannot be executed.
The JVM looks for the main method to start the execution of the program.
Attempting to run a Java program without a main method will result in a compilation error.
Q83. Annotations in @springbootApplication
Annotations in @SpringBootApplication are used to configure the Spring Boot application.
Annotations like @SpringBootApplication are used to enable auto-configuration and component scanning in a Spring Boot application.
Other commonly used annotations include @RestController, @Service, @Repository, and @Component for defining different types of Spring beans.
Annotations like @Autowired are used for dependency injection in Spring applications.
Annotations like @RequestMapping are ...read more
Q84. Is Java pass by value or by reference
Java is pass by value
Java is pass by value, meaning a copy of the variable is passed to a method
Changes made to the copy inside the method do not affect the original variable
However, if the variable is an object reference, the reference is passed by value
Q85. what is microservices ,how its works
Microservices are a software development technique where an application is composed of small, independent services that communicate with each other.
Microservices break down a large application into smaller, loosely coupled services
Each service is responsible for a specific function and can be developed, deployed, and scaled independently
Communication between services is typically done through APIs or messaging queues
Microservices architecture allows for better scalability, fl...read more
Q86. What is comparator annotation in Java?
Comparator annotation in Java is used to define custom sorting logic for objects.
Comparator annotation is used to define custom sorting logic for objects in Java.
It is used in conjunction with the Comparator interface to provide custom sorting behavior.
The annotation can be applied to fields or methods within a class to specify the sorting order.
Example: @Comparator(order = Order.ASCENDING) private int age;
Q87. Features of java 8,oops,Custom Exception ,Collections
Java 8 introduced new features like lambda expressions and streams, OOPs concepts include inheritance and polymorphism, custom exceptions allow for user-defined exceptions, and collections provide data structures like lists and maps.
Java 8 features include lambda expressions and streams
OOPs concepts in Java include inheritance and polymorphism
Custom exceptions in Java allow for user-defined exceptions
Collections in Java provide data structures like lists and maps
Q88. what is serialization, deserialization, transient
Serialization is the process of converting an object into a byte stream, deserialization is the reverse process. 'transient' keyword is used to exclude a field from serialization.
Serialization is used to persist object state or transmit objects over a network
Deserialization is used to reconstruct the object from the byte stream
The 'transient' keyword in Java is used to indicate that a field should not be serialized
Q89. What is Method Overloading vs Overriding
Method Overloading is having multiple methods with the same name but different parameters. Method Overriding is having a method in a subclass with the same name and parameters as in the superclass.
Method Overloading is used to provide different ways of calling the same method with different parameters.
Method Overriding is used to provide a specific implementation of a method that is already provided by its superclass.
Method Overloading is resolved at compile-time based on the...read more
Q90. Java collection use cases Hashmap working principle
Hashmap is a key-value pair data structure in Java used for fast retrieval of data.
Hashmap stores data in key-value pairs
It uses hashing to store and retrieve data efficiently
Allows null keys and values
Example: HashMap
map = new HashMap<>()
Q91. Write code to demonstrate the flow of Spring MVC
Demonstrate the flow of Spring MVC through code
Create a controller class with request mapping annotations
Define methods in the controller to handle different requests
Configure the dispatcher servlet in web.xml
Create a view resolver to map logical view names to actual views
Q92. Difference btw string builder, and buffer
String Builder is not synchronized, while String Buffer is synchronized.
String Builder is faster than String Buffer because it is not synchronized.
String Buffer is thread-safe, while String Builder is not.
Use String Builder when you do not need thread safety, and String Buffer when you do.
Q93. diffrenece between interafce and abstract class
Interface is a blueprint for classes to implement, while abstract class can have both abstract and concrete methods.
Interface can only have abstract methods and constants, while abstract class can have abstract and concrete methods.
A class can implement multiple interfaces but can only extend one abstract class.
Interfaces are used to achieve multiple inheritance in Java.
Abstract classes can have instance variables, constructors, and non-abstract methods.
Example: interface Ani...read more
Q94. What are Stream terminal operators?
Stream terminal operators are used to trigger the execution of intermediate operations in Java Streams.
Terminal operators return a result or a side effect, and the stream is consumed after their execution.
Examples of terminal operators include forEach, collect, reduce, count, anyMatch, allMatch, noneMatch, findFirst, findAny, etc.
Q95. What is JIT? Explain in Detail?
JIT stands for Just-In-Time compiler, which compiles Java bytecode into native machine code at runtime for improved performance.
JIT compiler is a part of Java Virtual Machine (JVM) that helps in optimizing the performance of Java applications by compiling bytecode into native machine code on-the-fly.
It identifies frequently executed code and compiles it into native code for faster execution.
JIT compilation occurs during the execution of the program, unlike ahead-of-time compi...read more
Q96. Difference Between Interface and Abstract Classes?
Interface is a blueprint of a class with only abstract methods, while abstract class can have both abstract and concrete methods.
Interfaces can only have abstract methods and cannot have any implementation, while abstract classes can have both abstract and concrete methods.
A class can implement multiple interfaces but can only extend one abstract class.
Interfaces are used to achieve multiple inheritance in Java, while abstract classes are used to provide a common base for sub...read more
Q97. What are the features of Java8
Java 8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow writing concise and functional code.
Functional interfaces provide a way to define and use lambda expressions.
Streams enable processing collections of data in a functional and parallel way.
Default methods allow adding new methods to existing interfaces without breaking compatibility.
Other features include the new Date and Time API, i...read more
Q98. Print some thing java 8 lambda expression
Using lambda expressions in Java 8 to print a message
Use the lambda syntax (parameters) -> { body } to define the behavior
Example: () -> System.out.println("Hello, World!")
Q99. What are constructors and its types
Constructors are special methods used to initialize objects in Java.
Constructors have the same name as the class and do not have a return type.
Types of constructors include default constructor, parameterized constructor, and copy constructor.
Default constructor is provided by Java if no constructor is defined.
Parameterized constructor takes parameters to initialize an object with specific values.
Copy constructor creates a new object by copying the values of an existing object...read more
Q100. How to check logs in an app
To check logs in an app, access log files or use logging frameworks like Log4j.
Access log files directly in the application directory
Use logging frameworks like Log4j to log messages at different levels
Analyze log files for errors or debugging information
Top HR Questions asked in Globiva
Interview Process at Globiva
Top Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month