Design Pattern Questions

What are Design Patterns?

Design patterns are successful solutions to recurring design problems. It is an abstraction of a solution at a very high level.

Below are some Questions:


1. This Design Pattern object resides on the presentation tier and on behalf of other presentation tier components calls remote methods on the objects in the business tier?

A: Business Delegate.


2 In the Business Tiger of the J2EE Pattern catalog, this Design pattern acts as a serializable object for transferring data over the network.

A: Transfer Object

3. Which Design pattern is appropriate if the system needs to locate and access resources and services across networks, and if the service or resources are unavailable, the system must create local implementations.

A: Service Locator


4. Which Design pattern would be appropriate for this issue: The System has to accept data from the user, update the database, and return the data to the user at a later point in time?

A: MVC

5. Which Category pattern does MVC fall into?

A: Structural Pattern

6. Which Design pattern uses distributed objects with external resource connections, and caches external requests.

A: Service Locator

7. Which Category pattern is the Service Locator associated with?

A: Behavioral category because service locator assists with network communications by reducing the coupling between the business logic and external resources.

8. Which Design pattern would solve this problem: The system receives requests using multiple protocols,, HTTP etc, it must be able to authorize/authenticate some requests while handling others directly. It needs to add/remove information from requests before processing.

A: Intercepting Filter.

9. Which Design pattern is kept under the presentation tier because it directly deals with the client’s requests and dispatches them to the appropriate handler or worker components?

A: Front Controller

10. Which Design pattern can be described as follows: Separation of data presentation and data representation, Multiple views, single controller:

A: MVC

11. Which Category does the intercepting filter belong to?

A: Behavioral since it reduces coupling between the requesting processing and the rest of the application

12. Which Design pattern object performs the task of locating business services on behalf of other components in the tier that is usually present in the presentation tier. It is used by the Business Delegates to look up business service objects?

A: Service Locator

13. Which Design pattern controls the application’s view and navigation, and is able to perform security processing to determine which resources and services are available for the user?

A: Front Controller

14. Which Category pattern does the Business Delegate pattern associated with?

A: Since it is concerned with the communication between the presentation and business tiers, it is a behavioral pattern.

15. Which Design Pattern provides access to networks and services such as JNDI, and is a single point of contact for managing distributed connections and resources?

A: Service Locator

16. Which Category pattern does the Front Controller lie in?

A: Behavioral Pattern.

17. Gang of Four (GoF), Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides documented 23 software design patterns into three types: Besides the Structural and Behavioral patterns, what is the other type?

A: Creational.

18. Which Category of Design Pattern describes how classes and objects can be combined to form larger structures and provide new functionality?

A: Structural.

19. Which Category of Design Pattern help us define the communication and interaction between the objects of a system that reduce coupling between objects?

A: Behavioral

20. Which Category of Design Pattern is associated with Transfer Object.

A: Behavioral because it is involved in communication.

21. Which Design pattern reduces the coupling between presentation and business tiers?

A: Business Delegate

22. Which Design pattern creates an object to encapsulate all of the attribute values that are required by the client application?
A: Transfer Object.

23. Which Category of Design Patterns deal with abstracting the instantiation process and hiding the details of how objects are initialized?

A: Creational

24. For distributed environments, the book CORBA (Common object request broker Architecture) patterns describes design patterns at 7 architectural levels: They include Enterprise, system, application, Macrocomponent, Microcomponent, and Object. Which is missing?

A: Global.

25. Which Design pattern solves the situation where there are separate components to interact with the end users and to handle business logic?

A: Business Delegate.

26. What are the 5 Tiers of the J2EE Architecture?

A: Client (Web browser) , Presentation (Servlets, filters, JSPs), Business (Enterprise JavaBeans), Integration (JDBC), Resource (Database).

27. Another name for the J2EE pattern called Decorating Filter which is an object that sits between the client and the web component, that pre-processes a request and post-processes the response is …

A: Intercepting Filter.


28. Which Design Pattern has the benefit of having a central point for selecting and screening requests, and controls the view for incoming requests?

A: Front Controller.

29. Which Design Pattern is responsible for reducing coupling between presentation and business tiers, and provides proxy for the client?

A: Business Delegate

30. Which Design pattern acts as a central point of receiving requests, and applies policies consistently across applications?

A: Front Controller

31. Which Design Pattern receives requests before other elements, performs necessary post processing on outgoing responses?

A: Intercepting Filter.

32. Which Design pattern provides services to different clients, WAP client etc, and Multiple views such as HTML or WML.

A: Model-View Controller.

33. Which Design pattern is previously know n as “value Object”, and groups information, and reduces network traffic?
A: Transfer Object

34. Which Design pattern has the benefit of reduced coupling between presentation and business tiers, and allows cached business service results for presentation tier components?

A: Business Delegate.

35. Which Design pattern centralizes methods of connection and access and makes use of JNDI (Java Naming Directory Interface)?

A: Service Locator.

36. Which Design pattern has the benefit of fewer remote calls, a reduction in network traffic, and increased response speed?

A: Transfer Object

37. Which Design pattern encapsulates business service lookup and access, and decouples clients from business service API?

A: Business Delegate

38. Which Tier does the Intercepting filter, MVC, and Front Controller models belong to?

A: Presentation

39. Which Tier does the Service Locator and Business delegate belong to?

A: Business.

40. Which Design pattern is associated with dispatching requests, managing workflow of a web application, and managing use cases?

A: Front Controller

41. Which Tier does the Transfer Object belong to?

A: Presentation.

42. Which Design pattern is used where requests and or responses need to be processed in a consistent manner, that wraps around the application, receiving requests as they come in and processing responses?

A: Intercepting Filter.

43. Which design pattern is applicable in situations where the same data is to be presented in different formats , but is to be managed centrally by a single controlling entity?

A: MVC

44. Which design pattern serves as the primary gate for requests entering the application. The object ensures security restrictions and controls the view shown to the client.

A: Front Controller.

45. Which design pattern provides a central directory for resources to locate services around the enterprise, and controls the communication (Java Naming and Directory Interface JNDI)?

A: Service Locator.

46. Which design pattern is an object that communicates with business service components on behalf of the client components.

A: Business Delegate.

47. Which design pattern reduces coupling between presentation and business tiers, and decouples clients from business services?

A: Business Delegate.

48. Which design pattern uses a small-sized serializable Java object for transferring data over the network in a distributed application?

A: Transfer Object.

49. Which design pattern has the potential benefits of flexible design, centrally managed data, and multiple ways of presentation?

A: MVC.

50. Which design pattern has the benefit of applying request pre-processing consistently, and is used to redirect requests to specific resources?

A: Intercepting Filter.

51. Which Design pattern has the benefit of centralizing the process of looking up services, and controls connectivity and the means of directory access?

A: Service Locator.