A Presentation Tier Component Is Requesting Data Attributes
A Presentation Tier Component Is Requesting Data Attributes
Which pattern is best suited for this scenario, providing the client with the required data causing
no significant performance degradation?
You
No. Answers Correct
selected
1 You want to avoid embedding business logic in the view
You want to avoid passing protocol-specific information outside its
2
context
You want to provide the clients with an efficient search and iterate
3
mechanism over a large results set
4 You want to maintain the search results on the client side
Your online shop application maintains the customers information, like their personal
information,contact lists and lists of purchases.
The remote descktop clients usually require only parts of these information. Which pattern
would be most appropriate for this scenario and would improve your system?
Your application's performance is affected due to the significant number of remote calls to your
business logic. The business logic is exposed as fine grained methods to the clients.
Which refactoring can be done to improve the application's performance? (choose two)
(choose 2)
You
No. Answers Correct
selected
1 Add a Front Controller to centralize requests processing
Implement a Session Facade, which provides a coarse grained
service-oriented interface
2
to clients
3 Move the frequently called business logic to the presentation tier
Encapsulate multiple business data attributes into smaller set of
4
serializable transfer objects, to reduce remote invocations
ABC university library system is available to students over different campuses in the world and
installed in one server in the main campus. Queries results are usually large result sets returned
all to clients which causes a heavy load on both client and server.
What do you think can be done to alleviate this problem on a tight budget?
You
No. Answers Correct
selected
Place a server in each campus to serve the students in this campus
to
1
distribute the load
2 apply Transfer Object Pattern
3 apply a Value List Handler Pattern
You
No. Answers Correct
selected
It is used when the client needs not only to read the business
component attributes
1
but also to be able to modify them
It reduces the complexity of the system in terms of update
2
propagation and synchronization
It adds on complexity to the system in terms of update propagation
3
and synchronization
4 Transfer Objects in general can reduce network overhead
You want to expose part of your application as services to other client applications. The client
application will request a service through standard web protocols. The requests are received by a
servlet which in turn delegetes them to the bussiness tier.
You
No. Answers Correct
selected
1 A Service Activator acts as a centralized point to process http
You
No. Answers Correct
selected
requests
A Service Activator allows an asynchronous messages to invoke
2
business components, including the EJBs
A Service Activator enables business logic in EJBs to be exposed
3
as web services
What benefits does Data Access Object (DAO) pattern provide? (choose two) (choose 2)
You
No. Answers Correct
selected
it increases the cohesiveness of the business objects by extracting
1
out the data acess code from them
2 it reduces network overhead by caching queries results
it enhances loose coupling between the business tier and the data
3
sources
Presentation Tier----------------
How to secure you web application against security risks such as cross site scripting (css) and
SQL injection in a centralized manner that avoids code duplicate and ensures that every HTTP
request would be inspected? (choose 2)
Which of the following patterns would you use to transfer certain state to the next tier without
passing on protocol-specific system information?
Your job is to refactor an application ,which uses JSP technology as a View. The JSP pages are
dominated by scriptlet code.
In your web application you decided to use Javascript to validate each user input on the client
browser.
You
No. Answers Correct
selected
No double check on the server side is needed as the input is already
1
checked on the client side
You
No. Answers Correct
selected
2 double check in the presentation tier
3 double check in the integration tier
4 double check in the business tier
Explanation:
You always need to double check the user input as it not guaranteed that user is actually using
the intended interface as you planned.
You would like to raise the security level of your system by examining incoming HTTP
requests. You would like to log information about each request and to filter requests with
malicious scripts.
Currently the clients can track their parcels using web browsers, and your company wants to
expose it's business to it's partners as web-services.
However; when you inspected the code base, you discovered that the application passes
HttpServletRequest parameters to the business tier for further processing.
Your job is to refactor this existing code base to avoid duplicating the business logic to handle
the two request channels (http and web service requests).
you are in charge of developing an e-commerce web application, the client expects high traffic
volumes and the security is of essence.
A pattern that is intended to provide a means to define a family of algorithms and encapsulate
each one as an object for interchangeable use:
Which are considered forces to select a Strategy Pattern? (choose two) (choose 2)
In the Publish-Subscribe messaging model, the subscribers register themselves in a topic and are
notified when new messages arrive to the topic. Which pattern does most describe this model?
The Observer pattern is used to define a one-to-many dependency so that when one object
changes state, all its dependents are notified and updated automatically.
This definition is perfectly describe Publish-Subscribe model, actually the Observer pattern is
also known as Publish-Subscribe.
Which pattern to use when more than one object can handle a request, and the handler is
unknown?
Which pattern is most appropriate when a decision must be made at the time a class is
instantiated?
Creational Design Patterns are used when a decision must be made at the time a class is
instantiated.
1. Abstract Factory
2. Builder
3. Factory Method
4. Prototype
5. Singleton
Which of the following are participants in the GOF builder design pattern? (choose 3)
When would you use the GOF Singleton design pattern? (choose all that apply) (choose 2)
Which design pattern you would you use to limit the class instantiation to one object?
When would you use the GOF builder design pattern? (choose all that apply) (choose 2)
You
No. Answers Correct
selected
1 to abstract steps of construction of complex objects
to build different representations of complex objects based on the
2
concrete implementations of construction procedure
to establish an interface for creating an object, but let the concrete
3
implementations decide which subclass to instantiate
to encapsulate a family of individual factories that have a common
4
theme
You want to create families of related objects, to be used interchangeably to configure you
application. What is the most appropriate GoF pattern to use?
Which design pattern you would you use to control the creation of an object based on a
established interface, while allowing the concrete implementation to determine the subclass to
construct.
What are the consequences of applying the Builder design pattern? (choose 3)
What are the consequences of applying the GOF Singleton pattern? (choose 1)
You
No. Answers Correct
selected
it introduces thread safety issue when the singleton instance is
1
instantiated on demand
2 the client code can creates multiple instances at run time
it reduces of the class hierarchy as compared to the other factory
3
design patterns
4 it makes it easier for a certain family of objects to work together
Which design pattern you would you use to have a prototypical instance determine the concrete
class of object being created?
Which of the following code snippet represents a Singleton design pattern implementation?
public PrintSpooler () {}
return INSTANCE;
}
public class PrintSpooler {
private PrintSpooler () {}
return INSTANCE;
}
public class PrintSpooler {
private PrintSpooler () {}
return INSTANCE;
}
4 public class PrintSpooler {
private PrintSpooler () {}
No. Answers CorrectYou selected
return INSTANCE;
What are the consequences of applying the GOF Prototype pattern? (choose 3)
You
No. Answers Correct
selected
1 each concrete prototype class must implement the clone method
2 it makes it easier for a certain family of objects to work together
it enable the client code to register an new concrete prototype
3
instance at run time
it reduces of the class hierarchy as compared to the other factory
4
design patterns
What are the consequences of applying the GOF factory method pattern? (choose 2)
You
No. Answers Correct
selected
1 it decouples the client code from the application specific classes
2 it makes the designed product families exchangeable
it establishes a flexible mechanism for instantiating an object in
3
comparison to the usual java constructor instantiation.
What are the consequences of applying the GOF Composite pattern? (choose 2)
You
No. Answers Correct
selected
1 the client code can traverse tree structures of arbitrary depth
You
No. Answers Correct
selected
recursively
increases the coupling between the client code and the composite
2
structre
3 it will improve the system performance
the client code can access both the individual objects and
4
compositions in a uniform manner
What are the consequences of applying the GOF Decorator pattern? (choose 3)
You
No. Answers Correct
selected
the client code can gradually add more functionality as it nests more
1
layers of decorators
2 it assigns more functionality to an object without sub-classing it
it makes it harder to identify the the decorated and the decorator
3
objects
the client code can traverse tree structures of arbitrary depth
4
recursively
You are trying to add a class already written in another application to serve clients, beside other
classes, in your system. All other classes have the same interface, the incoming class has a
totally different interface than the clients expect, but contains all required functionalities.
What kind of refactoring is needed to make this class fit in with minimum changes in your
system?
You
No. Answers Correct
selected
1 apply the Proxy Pattern
2 apply the Adapter Pattern
create a new class which implements the expected interface and
copy and paste
3
the code from the class in the other application to this new class
Explanation:
The Adapter pattern converts the interface of a class into an interface that a client expects.
Which design pattern is used in the Java InputStream, OutputStream, Reader, Writer hierarchies?
What is the difference between an adapter and a decorator? (choose two) (choose 2)
You
No. Answers Correct
selected
The adapter adds no functionalities to the adaptee class, whereas the
Decorator
1
extends the functionality of the object
The adapter is a creational pattern, whereas the decorator is a
2
structural design pattern
Both introduce a level of indirection between a client class and a
3
class it uses
Explanation:
Both the adapter and the decorator are structural design patterns
Big portion of clients are remotely invoking methods in your system, the surface area exposed
to clients includes fine-grained methods, which of course causes network overhead.
Facade pattern provides a simpler interface to a complex subsystem. This way a coarse-grained
methods are available to clients instead of fine-grained ones, this way the network overhead is
reduced, thus performance if improved.
You are building an online makeup website, which provides beside text articles, makeup
tutorials as videos files.
Which pattern is recommended to use in such a website to deliver these media resources?
Which design pattern you would you use to decouple an abstraction from its implementation so
that the two can vary independently?
No. Answers Correct You selected
1 Adapter design pattern
2 bridge design pattern
3 Facade design pattern
4 Composite bridge design pattern
Which design pattern you would you use to translates an existing class interface into a
compatible target interface?
It is also known as Wrapper, it is used when subclassing is not possible or practical to add
functionality and it is used to add functionality at runtime. This pattern is :
You
No. Answers Correct
selected
1 control access to a remote object
You
No. Answers Correct
selected
2 assemble complex objects
3 fetch a resource-intensive object when requested by a client
4 store common redundant data between large number of objects
extract out from the calling client the access or connection logic
5
needed to call an object
Which of the following is a Gang of Four (GoF) Structural Design Pattern? (choose 2)
Composite and Flyweight are Gang of Four (GoF) Structural Design Patterns, whereas Singleton
and Method Factory are Creational Design Patterns
When would you use the GOF Adapter design pattern? (choose all that apply) (choose 3)
You
No. Answers Correct
selected
to translates an existing class interface into a compatible target
1
interface
2 to improve your system performance
to transforming the client code data into appropriate format
3
expected by the target interface
4 to allow classes with incompatible interfaces to work together
In EJB 2.x, the client can directly access the session bean by invoking their business methods:
session bean methods, they use instances of EJBObject . Therefore any method, in the session
bean, designated to be available to clients, must be added to the EJBObject of the bean.
Like the stateless session beans and the entity beans, message driven beans can be pooled by the
EJB container
What is the default transaction attribute to a method in an EJB? (no explicit transaction attribute
is declared in both class and method levels)
What is the typical order of life cycle stages an average stateless session bean goes through
starting from its instantiation till retiring?
You
No. Answers Correct
selected
Instantiation by the EJB container, PostConstruct call back,
1
Dependency injection, PrePassivate
Instantiation by the EJB container, PostConstruct call back,
2
Dependency injection, PreDestroy
Instantiation by the client code, Dependency injection,
3
PostConstruct call back, PreDestroy
Instantiation by the EJB container, Dependency injection,
4
PostConstruct call back, PreDestroy
Which of the following transactional settings would throw an exception when calling a method
while the presence of an already existing transaction context?
What are the requirements of a message-driven bean (EJB 2.x) class? (choose 3)
Message Driven Beans (MDBs) can be directly accessed by internal or external clients.