Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Design - Interview Questions and Answers for 'Pattern' - 55 question(s) found - Order By Rating | ||||
| ||||
Ans. Struts controller uses the Command design pattern and the action classes use the Adapter design pattern. The process() method of the RequestProcessor uses the Template method design pattern. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Struts Design patterns Asked in 1 Companies | ||||
| ||||
Ans. I would choose Eager as the cost for 1 additional object is too minute for any such consideration. Eager Loading results in Faster access ( Object available at load time) at the cost of additional space. Lazy loading results in space saving ( Object available at first use ) at the cost of access speed. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design Pattern  Singleton  Lazy vs Eager Loading | ||||
| ||||
Ans. Deserialization. In serialization, we can save the object of a byte stream into a file or send over a network. Suppose if you serialize the Singleton class, and then again de-serialize that object, it will create a new instance, hence deserialization will break the Singleton pattern. To overcome this issue, we need to override readResolve() method in the Singleton class and return the same Singleton instance. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  singleton  design patterns Asked in 1 Companies | ||||
| ||||
Ans. It depends on how complex it is and if in future it would need any sort opf debugging. It's not easy to debug code if it's making heavy use of shortcuts like Lambda , Patterns etc. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  pattern matching  String  design | ||||
| ||||
Ans. The Model/View/Controller pattern, a strategy for dividing responsibility in a GUI component. The model is the data for the component. The view is the visual presentation of the component on the screen. The controller is responsible for reacting to events by changing the model. According to the MVC pattern, these responsibilities should be handled by different objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  mvc  design pattern Asked in 1 Companies   rare | ||||
| ||||
This question was recently asked at 'deutche bank'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design pattern   singleton Asked in 1 Companies | ||||
| ||||
Ans. 1. Design patterns are abstraction heavy and hence sometimes creates memory and performance overheads. 2. Sometimes they create unnecessary complexity without much added advantage. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   Asked in 1 Companies | ||||
| ||||
This question was recently asked at 'Bloomberg'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  code  coding  cloning  design pattern   cloning design pattern Asked in 1 Companies | ||||
| ||||
Ans. Subject has state, it keeps a list of observers. On the other hand, an Observable is really just a function that sets up observation. While Subjects are Observables, Subjects also implement an Observer interface. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  RxJava  Design  Design Pattern | ||||
| ||||
Ans. Observable is emiting data and Observer is subscribing to catch the data | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  RxJava  Design  Deaign Pattern | ||||
| ||||
This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Design Patterns | ||||
| ||||
Ans. Single gateway of the entire application is called Facade Design Pattern. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design pattern  facade Asked in 1 Companies | ||||
| ||||
This question was recently asked at 'Capgemini'.This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  singleton Asked in 1 Companies | ||||
| ||||
Ans. Setter injection Constructor injection Interface injection Look-up method/method injection | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  dependency injection   design patterns Asked in 1 Companies | ||||
| ||||
This question is still unanswered. Can you please provide an answer. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  antipattern  anti pattern | ||||
| ||||
Ans. Public constructor is simple and easy as it's the default way of object creation. So there are no additional coding overheads as compiler provides the default constructor if none is provided by coder. With static final methods, it facilitates loose coupling by segregating the responsibility of object creation to a separate method. Validation can be done on the constructor arguments before calling it. Moreover if any adaption on the arguments is required that can achieved easily with factory method.On the flip side, there is coding overhead and additional method call. | ||||
Sample Code for constructor Sample Code for factory | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  constructor  factory design pattern  factory method | ||||
| ||||
Ans. Voltage converters / Power Adapters | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Adapter Design Pattern  Design Pattern | ||||
| ||||
Ans. It introduces a layer of adaptations before it reaches the final and desired interface. Moreover sometimes all requests are forwarded to adapter class. Some of such requests doesn't even require any sort of adaptions as they are qualified to call the final interface directly and introducing overheads. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Adapter Design Pattern  design pattern | ||||
| ||||
Ans. Authentication / Authorization URL forwarding Auditing / Logging Localization | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  interceptors  interceptor design pattern | ||||
| ||||
Ans. It is used for intercepting the request. It's primary use is to implement security policy. All or specific request types can be intercepted and hence forwarded to authentication / authorization module so as to facilitate authorized requests to application. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  interceptors  interceptor design pattern | ||||
| ||||
Ans. Builder ( While Writing Unit Tests ) Prototype ( Cloning ) Adapter ( asList , toString ) Chain Of Responsibility ( Logging ) Singleton Factory ( Action Mapping ) Proxy Observer ( Event Listener ) MVC ( Web frameworks ) Filter ( Criteria ) | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Design Patterns  widely used Design patterns intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. [Open Ended Answer] | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Design Patterns Intermediate | ||||
| ||||
Ans. Interpreter,Chain of Responsibility,Command,Iterator,Observer,Mediator,Memento | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Behavioral Design Patterns Intermediate | ||||
| ||||
Ans. Adapter,Bridge,Composite,Decorator,Facade,Flyweight,Proxy | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Design Patterns  Structural Design Patterns Intermediate | ||||
| ||||
Ans. Factory,Abstract Factory,Singleton,Prototype and Builder | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Design Pattrns  Creational Design Patterns Intermediate | ||||
| ||||
Ans. Both are creational design patterns but singleton facilitates in creation and reuse of single object whereas Factory deals with creation of multiple objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  Design pattern  singleton  factory  singleton vs factory Asked in 4 Companies | ||||
| ||||
Ans. Factory Design Patterns is the pattern that recommends creation of separate Factory Object for creation of other object. So its like saying - If you want to create an object of ClassA, Talk to FactoryObject ( which is an object of FactoryClass ). FactoryObject in itself encapsulates the inputs and logic required to make the decision regarding the creation and construction of object. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design pattern  factory design pattern Asked in 9 Companies | ||||
| ||||
Ans. public class SingleTon { private SingleTon() { if (singleTon != null) { throw new RuntimeException("cant not create the object"); } } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException("can not be create"); } static private volatile SingleTon singleTon; public static SingleTon getInstance() { SingleTon singleTon = this.sample; if (singleTon == null) { synchronized (this) { singleTon = this.singleTon; if (singleTon == null) { singleTon = this.singleton = new SingleTon(); } } } return singleTon; } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  singleton  design pattern Asked in 2 Companies | ||||
Very Frequently asked to Senior Software Engineers or Developers. | ||||
| ||||
Ans. [Open Ended Answer] | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design patterns Asked in 17 Companies intermediate   frequent | ||||
Frequently asked Design Pattern interview question. | ||||
| ||||
Ans. The prototype pattern is a creational design pattern. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. Prototype is used when we need duplicate copies of objects. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  design pattern  prototype design pattern  cloning Asked in 11 Companies intermediate | ||||