Xebia
Impact Guru Interview Questions and Answers
Q1. What are the classes needed to create a GET REST API?
Classes needed to create a GET REST API
Controller class to handle the request
Service class to perform business logic
Repository class to interact with database
Model class to define data structure
RequestMapping annotation to map the URL
Q2. What is an Interface? What is default method in Interface?
An interface is a blueprint of a class. Default method is a method in an interface with a default implementation.
An interface defines a set of methods that a class must implement
Default method provides a default implementation for a method in an interface
Default methods were introduced in Java 8
Default methods can be overridden by implementing classes
Q3. What is HashMap? Difference between List and HashMap?
HashMap is a data structure that stores key-value pairs. List is a collection of ordered elements.
HashMap allows fast retrieval of values based on keys.
List maintains the order of elements and allows duplicates.
HashMap uses hashing to store and retrieve elements.
List uses indexing to access elements.
HashMap is not thread-safe while List is thread-safe.
Example: HashMap
map = new HashMap<>(); map.put("apple", 1); Example: List
list = new ArrayList<>(); list.add("apple"); list.ad...read more
Q4. What class is used to connect with the Database?
The class used to connect with the Database depends on the programming language and framework being used.
In Java, the class used is usually DriverManager or DataSource.
In Python, the class used is usually psycopg2 or mysql-connector.
In PHP, the class used is usually PDO or mysqli.
The specific class used may also depend on the type of database being used, such as MySQL, PostgreSQL, or MongoDB.
Q5. Create a new Thread and explain the ways to create Threads in Java
Creating Threads in Java
Extending the Thread class and overriding the run() method
Implementing the Runnable interface and passing it to a Thread constructor
Using Executor framework to create and manage threads
Using Callable and Future interfaces to create threads that return values
Q6. How is an interface used?
An interface is used to define a contract between two components in a system.
An interface defines a set of methods that a class must implement.
Interfaces are used to achieve abstraction and loose coupling.
Interfaces are used to create reusable code.
Interfaces are used to enable polymorphism.
Interfaces are used in many programming languages, including Java, C#, and TypeScript.
Q7. Explain MVC Lifecycle.
MVC Lifecycle is the sequence of events that occur in the Model-View-Controller architectural pattern.
MVC stands for Model-View-Controller.
The lifecycle starts with a user request.
The controller receives the request and processes it.
The controller updates the model with the necessary data.
The view is then updated with the updated model data.
The updated view is sent back to the user as a response.
Q8. Difference between HashMap and HashTree
HashMap is a non-synchronized implementation of Map interface while HashTree is a synchronized implementation of Map interface.
HashMap is faster than HashTree as it is non-synchronized.
HashTree is thread-safe while HashMap is not.
HashMap allows one null key and multiple null values while HashTree does not allow null keys or values.
HashTree maintains the order of elements while HashMap does not.
HashMap is generally used in single-threaded applications while HashTree is used in...read more
Q9. Explain polymorphism in Java
Polymorphism is the ability of an object to take on many forms.
Polymorphism allows objects of different classes to be treated as if they are objects of the same class.
It can be achieved through method overloading and method overriding.
Example: A parent class Animal can have multiple child classes like Dog, Cat, and Cow. All these child classes can have their own implementation of the method 'makeSound', which can be called using the parent class reference variable.
Polymorphis...read more
More about working at Xebia
Top Full Stack Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month