QUESTION NO: 121
Which three are valid values for the body-content attribute of a tag directive in a tag file? (Choose
three.)
A. EL
B. JSP
C. empty
D. dynamic
E. scriptless
F. tagdependent
Answer: C,E,F
QUESTION NO: 122
The Squeaky Bean company has decided to port their web application to a new J2EE 1.4
container. While reviewing the application, a developer realizes that in multiple places within the
current application, nearly duplicate code exists that finds enterprise beans. Which pattern should
be used to eliminate this duplicate code?
A. Transfer Object
B. Front Controller
C. Service Locator
D. Intercepting Filter
E. Business Delegate
F. Model-View-Controller
Answer: C
QUESTION NO: 123
A developer is designing a web application that makes many fine-grained remote data requests for
each client request. During testing, the developer discovers that the volume of remote requests
significantly degrades performance of the application. Which design pattern provides a solution for
this problem?
A. Flyweight
B. Transfer Object
C. Service Locator
D. Dispatcher View
E. Business Delegate
F. Model-View-Controller
Answer: B
QUESTION NO: 124
In an n-tier application, which two invocations are typically remote, not local? (Choose two.)
A. JSP to Transfer Object
B. Service Locator to JNDI
C. Controller to request object
D. Transfer Object to Entity Bean
E. Controller to Business Delegate
F. Business Delegate to Service Locator
Answer: B,D
QUESTION NO: 125
A developer has created a special servlet that is responsible for generating XML content that is
sent to a data warehousing subsystem. This subsystem uses HTTP to request these large data
files, which are compressed by the servlet to save internal network bandwidth. The developer has
received a request from management to create several more of these data warehousing servlets.
The developer is about to copy and paste the compression code into each new servlet. Which
design pattern can consolidate this compression code to be used by all of the data warehousing
servlets?
A. Facade
B. View Helper
C. Transfer Object
D. Intercepting Filter
E. Composite Facade
Answer: D
QUESTION NO: 126
A developer is designing the presentation tier for a web application which requires a centralized
request handling to complete common processing required by each request. Which design pattern
provides a solution to this problem?
A. Remote Proxy
B. Front Controller
C. Service Activator
D. Intercepting Filter
E. Business Delegate
F. Data Access Object
Answer: B
QUESTION NO: 127
You are designing an n-tier Java EE application. You have already decided that some of your
JSPs will need to get data from a Customer entity bean. You are trying to decide whether to use a
Customer stub object or a Transfer Object. Which two statements are true? (Choose two.)
A. The stub will increase network traffic.
B. The Transfer Object will decrease data staleness.
C. The stub will increase the logic necessary in the JSPs.
D. In both cases, the JSPs can use EL expressions to get data.
E. Only the Transfer Object will need to use a Business Delegate.
F. Using the stub approach allows you to design the application without using a Service Locator.
Answer: A,D
QUESTION NO: 128
You have a simple web application that has a single Front Controller servlet that dispatches to
JSPs to generate a variety of views. Several of these views require further database processing to
retrieve the necessary order object using the orderID request parameter. To do this additional
processing, you pass the request first to a servlet that is mapped to the URL pattern /WEBINF/
retreiveOrder.do in the deployment descriptor. This servlet takes two request parameters, the
orderID and the jspURL. It handles the database calls to retrieve and build the complex order
objects and then it dispatches to the jspURL.
Which code snippet in the Front Controller servlet dispatches the request to the order retrieval
servlet?
A. request.setAttribute("orderID", orderID);
request.setAttribute("jspURL", jspURL);
RequestDispatcher view
= context.getRequestDispatcher("/WEB-INF/retreiveOrder.do");
view.forward(request, response);
B. request.setParameter("orderID", orderID);
request.setParameter("jspURL", jspURL);
Dispatcher view
= request.getDispatcher("/WEB-INF/retreiveOrder.do");
view.forwardRequest(request, response);
C. String T="/WEB-INF/retreiveOrder.do?orderID=%d&jspURL=%s";
String url = String.format(T, orderID, jspURL);
RequestDispatcher view
= context.getRequestDispatcher(url);
view.forward(request, response);
D. String T="/WEB-INF/retreiveOrder.do?orderID=%d&jspURL=%s";
String url = String.format(T, orderID, jspURL);
Dispatcher view
= context.getDispatcher(url);
view.forwardRequest(request, response);
Answer: C
QUESTION NO: 129
You have built a web application that you license to small businesses. The webapp uses a context
parameter, called licenseExtension, which enables certain advanced features based on your
client's license package. When a client pays for a specific service, you provide them with a license
extension key that they insert into the <context-param> of the deployment descriptor. Not every
client will have this context parameter so you need to create a context listener to set up a default
value in the licenseExtension parameter. Which code snippet will accomplish this goal?
A. You cannot do this because context parameters CANNOT be altered programmatically.
B. String ext = context.getParameter('licenseExtension');
if ( ext == null ) {
context.setParameter('licenseExtension', DEFAULT);
}
C. String ext = context.getAttribute('licenseExtension');
if ( ext == null ) {
context.setAttribute('licenseExtension', DEFAULT);
}
D. String ext = context.getInitParameter('licenseExtension');
if ( ext == null ) {
context.resetInitParameter('licenseExtension', DEFAULT);
}
E. String ext = context.getInitParameter('licenseExtension');
if ( ext == null ) {
context.setInitParameter('licenseExtension', DEFAULT);
}
Answer: A
QUESTION NO: 130
You have a use case in your web application that adds several session-scoped attributes. At the
end of the use case, one of these objects, the manager attribute, is removed and then it needs to
decide which of the other session-scoped attributes to remove.
How can this goal be accomplished?
A. The object of the manager attribute should implement the HttpSessionBindingListener and it
should call the removeAttribute method on the appropriate session attributes.
B. The object of the manager attribute should implement the HttpSessionListener and it should call
the removeAttribute method on the appropriate session attributes.
C. The object of the manager attribute should implement the HttpSessionBindingListener and it
should call the deleteAttribute method on the appropriate session attributes.
D. The object of the manager attribute should implement the HttpSessionListener and it should call
the deleteAttribute method on the appropriate session attributes.
Answer: A
No comments:
Post a Comment