Feathersoft Info Solutions
InTechHub Interview Questions and Answers
Q1. Find the lowest number from an arraylist using streams
Find the lowest number from an arraylist using streams
Use stream.min() method to find the lowest number
Pass Comparator.naturalOrder() to get the lowest number
Handle empty list scenario using OptionalInt
Q2. Demonstrate inheritance in java with code
Inheritance in Java allows a class to inherit properties and methods from another class.
Use the 'extends' keyword to create a subclass that inherits from a superclass
The subclass can access all public and protected members of the superclass
Example: class Dog extends Animal { ... }
The 'super' keyword is used to call the superclass constructor or method
Q3. Configuring server port in a spring boot app
To configure server port in a Spring Boot app, modify the application.properties file.
Open the application.properties file
Add the following line: server.port=8080 (or any desired port number)
Save the file and restart the application
Q4. Find duplicate alphabets in a string
Program to find duplicate alphabets in a string
Create a HashMap to store the frequency of each alphabet
Iterate through the string and update the frequency in the HashMap
Iterate through the HashMap and print the alphabets with frequency greater than 1
Q5. Abstract and anonymous classes in java
Abstract classes are incomplete classes that cannot be instantiated. Anonymous classes are unnamed classes that can be created on the fly.
Abstract classes are declared with the 'abstract' keyword and can have abstract and non-abstract methods.
Anonymous classes are created using the 'new' keyword and can extend a class or implement an interface.
Anonymous classes are often used for event handling and callbacks.
Example of abstract class: abstract class Shape { abstract void draw...read more
Q6. Reverse a given string
Reverse a given string
Iterate through the string from end to start and append each character to a new string
Use StringBuilder or StringBuffer for better performance
Convert the string to a character array and swap the first and last characters, then move towards the middle until the entire string is reversed
Q7. Find vowels from a string
A Java program to find vowels from a given string.
Create a string variable and initialize it with the given string.
Use a for loop to iterate through each character of the string.
Check if the character is a vowel using if statement and add it to a new string variable.
Print the new string variable containing all the vowels.
Q8. Explain controller in spring
Controller in Spring is responsible for handling user requests and returning appropriate responses.
Controller receives requests from the client and delegates them to appropriate handlers
It maps the incoming requests to the corresponding handler methods
It returns the response to the client after processing the request
It can also handle exceptions and errors that occur during request processing
Q9. Use of refresh scope
Refresh scope is used in Spring framework to control the lifecycle of beans.
Refresh scope is used to create a new instance of a bean every time it is requested.
It is useful when the state of a bean needs to be reset on every request.
To use refresh scope, add @RefreshScope annotation to the bean definition.
Example: @Bean @RefreshScope public MyBean myBean() { return new MyBean(); }
Interview Process at InTechHub
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month