Member Research & Development
Member Research & Development Interview Questions and Answers
Q1. Give a real life example of implementing interfaces vs abstract classes
Implementing interfaces vs abstract classes in real life
Interfaces are useful when implementing multiple inheritance in Java
Abstract classes are useful when creating a base class with some implementation
Example of interface: implementing Runnable interface in a class to create a thread
Example of abstract class: creating a base class for different types of vehicles
Q2. Site an example for Singleton pattern implementation in java
Singleton pattern ensures only one instance of a class is created and provides a global point of access to it.
Private constructor to restrict object creation
Private static instance variable to hold the single instance
Public static method to get the instance
Lazy initialization or eager initialization
Thread-safe implementation using synchronized keyword or static block
Examples: java.lang.Runtime, java.awt.Desktop, java.util.Calendar
Q3. Sort map entries based on value
Sort map entries based on value
Use a TreeMap to sort the entries based on value
Implement a Comparator to compare the values
Convert the TreeMap to a LinkedHashMap to maintain the order of insertion
Q4. SOLID design principles
SOLID design principles are a set of guidelines for writing maintainable and scalable code.
S - Single Responsibility Principle: A class should have only one reason to change.
O - Open/Closed Principle: A class should be open for extension but closed for modification.
L - Liskov Substitution Principle: Subtypes should be substitutable for their base types.
I - Interface Segregation Principle: A client should not be forced to depend on methods it does not use.
D - Dependency Invers...read more
Q5. Law of Thermodynamics
The laws of thermodynamics describe the behavior of energy in physical systems.
The first law of thermodynamics states that energy cannot be created or destroyed, only transferred or converted.
The second law of thermodynamics states that the entropy of an isolated system always increases over time.
The third law of thermodynamics states that as the temperature approaches absolute zero, the entropy of a system approaches a minimum value.
Thermodynamics is used in various fields s...read more
Member Research & Development Jobs
0Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month