InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Is Observer Design Pattern In Java? When Do You Use Observer Pattern In Java? |
|
Answer» Observer PATTERN is BASED upon notification, there are TWO kinds of object Subject and Observer.Whenever there is change on subject's STATE observer will receive notification. Observer pattern is based upon notification, there are two kinds of object Subject and Observer.Whenever there is change on subject's state observer will receive notification. |
|
| 2. |
What Is Factory Pattern In Java? What Is Advantage Of Using Static Factory Method To Create Object? |
|
Answer» Factory pattern used to create OBJECT by providing static factory methods. There are MANY ADVANTAGE of providing factory methods e.g. caching immutable OBJECTS, easy to introduce new objects etc. Factory pattern used to create object by providing static factory methods. There are many advantage of providing factory methods e.g. caching immutable objects, easy to introduce new objects etc. |
|
| 3. |
Can You Write Thread-safe Singleton In Java? |
|
Answer» There are multiple ways to write thread-safe singleton in Java e.g by writing singleton using double checked LOCKING, by using STATIC Singleton instance initialized during class loading. By the way using Java enum to CREATE thread-safe singleton is most SIMPLE way. There are multiple ways to write thread-safe singleton in Java e.g by writing singleton using double checked locking, by using static Singleton instance initialized during class loading. By the way using Java enum to create thread-safe singleton is most simple way. |
|
| 4. |
What Is Singleton Pattern In Java? |
|
Answer» Singleton pattern in Java is a pattern which ALLOWS only one instance of Singleton CLASS AVAILABLE in WHOLE application. Singleton pattern in Java is a pattern which allows only one instance of Singleton class available in whole application. |
|
| 5. |
When To Use Composite Design Pattern In Java? Have You Used Previously In Your Project? |
Answer»
|
|
| 6. |
When Will You Use A Factory Pattern? |
|
Answer» The factory pattern is PREFERRED in the following cases: - a class does not know which class of objects it must CREATE - factory pattern can be used where we need to create an object of any one of sub-classes DEPENDING on the DATA provided The factory pattern is preferred in the following cases: - a class does not know which class of objects it must create - factory pattern can be used where we need to create an object of any one of sub-classes depending on the data provided |
|
| 7. |
Define A Factory With Respect To Software Development? |
| Answer» | |
| 8. |
Which Object Oriented Method Is Used By The Creational Patterns To Instantiate Object? |
|
Answer» CREATIONAL PATTERNS use inheritance to decide the object to be INSTANTIATED. Creational patterns use inheritance to decide the object to be instantiated. |
|
| 9. |
A Class Instance Can Be Created Using New Operator. Why Should We Use Creational Design Patterns To Create Objects? |
Answer»
|
|
| 10. |
Define Creational Design Patterns? |
Answer»
|
|
| 11. |
Give Example Of Decorator Design Pattern In Java ? Does It Operate On Object Level Or Class Level? |
| Answer» | |
| 12. |
What Is Observer Design Pattern In Java? |
Answer»
|
|
| 13. |
What Is Data Access Object Patterndao Pattern? |
|
Answer» Data Access Object Pattern or DAO pattern is used to separate LOW level data accessing API or operations from high level business services. Following are the participants in Data Access Object Pattern:
Data Access Object Pattern or DAO pattern is used to separate low level data accessing API or operations from high level business services. Following are the participants in Data Access Object Pattern: |
|
| 14. |
What Is Gang Of Four Gof? |
|
Answer» In 1994, FOUR authors Erich Gamma, Richard Helm, RALPH Johnson and John Vlissides published a book titled DESIGN Patterns - Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development. These authors are collectively KNOWN as GANG of Four GOF. In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled Design Patterns - Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development. These authors are collectively known as Gang of Four GOF. |
|