|
176 You are designing
a 3-tier architecture for a new application your company intends to deploy as
part of it's marketing strategy. This application will allow users to book
rental cars over the web and is estimated to save the company millions over the
next few years. Due to the sheer number of users, you have decided to use the
Front Controller pattern. Which of the following statements describe the Front
Controller pattern?
A The Front Controller pattern
is primarily used as a cheap alternative to a CISCO router. It is used as a
software alternative to a hardware load balancer.
B Provides a central point of
entry
C Provides a central point of
entry for load balancing
D The controller manages client
requests, security, delegation of business processing, error handling, view
selection and content creation strategies.
E The controller manages the
client's request including delegating business processing, error handling,
view selection and content creation strategies. But is does not have anything
to do with security.
F The Front Controller is just
another way of describing the Controller out of the Model View Controller
architecture.
G The Front Controller is just
using the Controller out of the Model View Controller architecture for load
balancing.
Choices B and D are correct.
The following is taken from Core J2EE Patterns: Best Practices and Design
Strategies page 369"Use a controller as the initial point of contact for
handling a request. The controller manages the handling of the request,
including invoking security services such as authentication and authorization,
delegating business processing, managing the choice of an appropriate view,
handling errors, and managing the selection of content creation strategies.
The main aim of the Front Controller pattern is to centralize view management.
For example if a web page is moved all the links to it would need to be
updated by using this pattern you can pass all requests through the Front
Controller only needing to make changes in one place. The Front Controller is
classified by Sun as a Presentation Tier pattern. Choices A and B are
incorrect because the Front Controller has nothing to do with load balancing.
Choice E is incorrect as the Front Controller can invoke security services and
choices F and G are incorrect because the Front Controller does not represent
the Controller out of the MVC architecture.
Some useful links:
http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
http://java.sun.com/blueprints/patterns/j2ee_patterns/front_controller/index.html
http://java.sun.com/blueprints/
Useful book:
Core J2EE Patterns: Best Practices and Design Strategies - ISBN: 0130648841A
sample chapter is available here:
http://www.sun.com/books/catalog/crupi/index_Table+of+Contents.html
Note: This type of question will probably feature in the new EJB 2.0
specification version of the SCEA certification.
177 You are
designing a complex set of classes that provides a secure framework for other
programmers to use. The idea behind this framework is that it will allow other
programmers to write secure programs without getting bogged down with the
complexities of writing secure applications. What sort of design pattern is
being used here?
A Composite
B Faade
C Decorator
D Adapter
Mediator
Choice B is correct.
Facade - (GOF 185): "Provide a unified interface to a set of interfaces in a
subsystem. Facade defines a higher-level interface that makes the subsystem
easier to use. "The other patterns are described below:
Adapter - (GOF 139):"Convert the interface of a class into another interface
clients expect. Adapter lets classes work together that couldn't otherwise
because of incompatible interfaces. "Composite - (GOF 163):"Compose objects
into tree structures to represent part-whole hierarchies. Composite lets
clients treat individual objects and compositions of objects uniformly.
"Decorator - (GOF 175):"Attach additional responsibilities to an object
dynamically. Decorators provide a flexible alternative to sub classing for
extending functionality. "Mediator - (GOF 273):"Define an object that
encapsulates how a set of objects interact. Mediator promotes loose coupling
by keeping objects from referring to each other explicitly, and it lets you
vary their interaction independently."
178 What is the
difference between the abstract factory pattern and the factory method
pattern?
A The factory method makes
objects that should be used together. This is not the case for the abstract
factory.
B The abstract factory pattern
provides an interface for creating a family of objects whereas factory method
provides an interface for creating one object
C In the abstract factory
pattern the objects that the factory makes are to be used together. This is
not necessarily true in the factory method pattern.
D The factory method pattern is
used when the class does not know the class of the object it must create. But
in the abstract factory this is known in advance.
E The factory method and
abstract factory are essentially the same pattern but two different names are
used to describe them depending on the circumstances when they are
implemented.
Choice B is correct.
Both the Abstract Factory and Factory Method are Creational patterns. Abstract
Factory - (GOF 87): "Provide an interface for
creating families of related or dependent objects without specifying their
concrete classes. "Factory Method - (GOF 107):
"Define an interface for creating an object, but let subclasses decide,
which class to instantiate. Factory Method lets a class defer instantiation to
subclasses. "Choice A offers a description of the abstract factory pattern not
the factory method. The descriptions in choices C and D are the wrong way
round. Choice E is incorrect as the two patterns are different.
179 You're
designing a paint application and as part of the user interface you have a
toolbar along the left hand side of the screen. Each of the icons on the
toolbar has different actions when you are using different tools. The way
you've structured it, the application is required to pass commands from one
object to another. When the appropriate object receives the command, it
handles the request. This is an example of which pattern?
A Command
B Chain of Responsibility
C Adapter
D Interpreter
E Strategy
Choice B is correct.
Chain of Responsibility - (GOF 223):"Avoid coupling the sender of a request to
its receiver by giving more than one object a chance to handle the request.
Chain the receiving objects and pass the request along the chain until an
object handles it. "Below are descriptions of the other patterns: Command -
(GOF 233):"Encapsulate a request as an object, thereby letting you
parameterize clients with different requests, queue or log requests, and
support undoable operations "Interpreter - (GOF 243):"Given a language, define
a representation for its grammar along with an interpreter that uses the
representation to interpret sentences in the language. "Adapter - (GOF
139):"Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn't otherwise because of
incompatible interfaces. "Strategy - (GOF 315):"Define a family of algorithms,
encapsulate each one, and make them interchangeable. Strategy lets the
algorithm vary independently from clients that use it."
180 You've had
enough of you existing IDE (Integrated Development Environment) and have
started work on designing your own. At the moment you're working on the undo
part of the application, basically you need to be able to roll an object back
so its previous state. What pattern would you use to do this?
A Memento
B State
C Mediator
D Rollback
E Transaction
F ACID
Choice A is correct.
Memento - (GOF 283):"Without violating encapsulation, capture and externalise
an object's internal state so that the object can be restored to this state
later. "Choices D, E and F are not names of patterns. Rollback is something
you would do if a transaction were terminated halfway through. Transaction is
self-explanatory. ACID stands for Atomic, Consistent, Isolatable and Durable.
All transactions must adhere to this. Below are descriptions of the other
patterns: State - (GOF 305):"Allow an object to alter its behavior when its
internal state changes. The object will appear to change its class. "Mediator
- (GOF 273):"Define an object that encapsulates how a set of objects interact.
Mediator promotes loose coupling by keeping objects from referring to each
other explicitly, and it lets you vary their interaction independently."
181 What is true
about this diagram?
A Object 1 calls the method
call1() on Object 2
B Object 2 executes its own
method call3(). This method in turn creates Object 3.
C Object 1 executes its own
method call1(). This method in turn creates Object 2.
D Object 2 calls the method
call3() on Object 3
Choices A and D are correct.
The diagram shows a UML sequence diagram. This type of diagram shows the
interaction of different objects. Time is shown from the top of the page
descending. The white rectangles on the dotted lines show the objects life.
Method calls are made from one object to another. In this diagram Object 1
calls Object 2's method call1(). Where the arrow begins, the object represents
the caller, and where it ends, the object called. The text above the arrow is
the name of the method.For more information about UML:http://www.uml.org/
182 What are the
benefits of asynchronous messaging?
A Less coupling between the
sender and receiver.
B Provides an instant response.
C Does not block the sender.
D Good for transaction
processing.
E "You can't get an instant
response.
F Network doesn't have to be
available.
Choices A, C and F are correct.
The main difference between asynchronous messaging and synchronous messaging
is that synchronous provides an instant response. This means that when using
asynchronous messaging, clients do not have not wait for responses; they send
messages and then carry on with what they were doing. This reduces the
coupling between the sender and receiver and it also means that the network
doesn't have to be available. Choices B and D are incorrect because they
describe synchronous messaging. Although choice E is correct it is not a
benefit of synchronous messaging.
183 You are
designing an online shopping application to make it easier for customers to
order products from your company. The aim is that the majority of customers
buying over the phone will start using the web instead. When customers
purchases goods online they will use credit cards and will require an instant
response as to whether the sale has been approved or not. (Note the credit
card validation is carried out by another very powerful system.) What type of
messaging should be used?
A Synchronous messaging
B Asynchronous messaging
C You shouldn't be using
messaging at all as it's not transactional.
D You could use messaging
because it is transactional however it's not advised, as the system would
never perform well enough for an instant response.
Choice A is correct.
Synchronous messaging provides an instant response and is therefore the right
answer. It is always arguable as to whether messaging should be used if you
require an instant response but if you do decide to use messaging then you
should always use synchronous messaging when needing an instant response.
Choice B is incorrect because asynchronous messaging does not provide an
instant response. You can make messaging transactional by creating your own
transactions in your code. Hence choice C is incorrect. Choice D is arguable
too, but it is not the most appropriate answer because the question suggests
that the system the messages will be sent to is very powerful and will be able
to cope with the volume of traffic. So choice D would be incorrect as it
suggests that the system will not perform well enough for an instant response.
184 What should be
used if you don't need an instant response from a message?
A Synchronous messaging
B Asynchronous messaging
Choice B is correct.
Synchronous messaging provides an instant response therefore asynchronous
messaging is correct. Synchronous, tightly coupled communication between
distributed components: This is the model of CORBA, RMI, EJB and so on. The
programming model is called Remote Procedure Call (RPC).Asynchronous, loosely
coupled communication between components: This is the Message Oriented
Middleware or MOM model. The programming model is called Messaging.
185 You overheard
two colleagues arguing about the difference between Localization and
Internationalization. They turn to you to ask you to settle the argument. What
is the difference between Localization and Internationalization?
A Internationalization is the
process of preparing a program to be used in a country other than England.
B Internationalization is the
process of preparing a program to be used in any country.
C Localization is the process of
preparing a program to be used in a country other than England.
D Localization is the process of
preparing a program to be used in any country.
Choice B is correct.
Internationalization: Adapting a program for use in any country is called
Internationalization. Localization: The process of adapting a program for use
in a particular country is referred to as Localization. During Localization
the language of the text, message icons, colors used, dialogs, number formats,
time representation and even sorting algorithms are subject to change. Choice
A is incorrect because it is the other way around. Choices C and D are not
accurate descriptions of Localization.
186 You have an
existing mail order application that runs as an applet on the customer's
browser. The applet connects to your server to retrieve product information.
(Note all data is sent securely over SSL) What would you expect to change to
meet the needs of users in different countries?
A GUI text, e.g. Message box
text etc.
B Security login procedures
C Dates
D Numbers, e.g. Currency
E The way the program writes to
binary files.
F Icons, Images
G The way the program writes to
text files.
Choices A, C, D, F and G are correct.
List of items that may be subject to Internationalization:
Language for Messages
Formats - Numeric, Date and so on
Dictionary sort order
Currency symbol and position
Tax and other legal rules
Cultural preferences
You would not need to change the way you wrote to binary files but you may
need to change the way you write to text files because of the Unicode to 8 bit
differences.
187 Your company
has a custom operating system that it developed for some robotics hardware to
be used in their research departments. One of the researchers has written a
cut down Virtual Machine to run on this OS. You have started to develop some
software to run on this VM however you need to convert the Unicode to 8 bit
characters. In order to do this you will need to use:
A FileWriter
B OutputStreamWriter
C BufferedWriter
D StreamWriter
Choice B is correct.
The OutputStreamWriter can be used to convert Unicode into 8 bit characters.
Normally this is used in Internationalization to convert Unicode into local
character encoding but it would work well in this situation. Choices A, C and
D serve different purposes in the java.io package. Java support for
Internationalization
Properties
Locale Resource
Bundle
Unicode Java.text
Package InputStreamReader
OutputStreamWriter
188 You need to
convert 8bit text to Unicode. To do this you use:
A FileReader
B InputStreamReader
C BufferedReader
D StreamReader
Choice B is correct.
The InputStreamReader can be used to convert 8 bit characters to Unicode.
Choices A, C and D serve different purposes in the java.io package.Java
support for
Internationalization:·
Properties·
Locale· Resource
Bundle· Unicode·
Java.text Package·
InputStreamReader·
OutputStreamWriter
189 What is the
difference between composite aggregation and normal aggregation?
A Aggregation defines a part of
relationship but both objects can exist independently. But with composite
aggregation if one part is removed then the other part will be removed. Think
of a plane the wings have a composite aggregation relationship with the body
of the plane.
B Composite Aggregation defines
a part of relationship but both objects can exist independently. But with
aggregation if one part is removed then the other part will be removed. Think
of a plane, the wings have an aggregation relationship with the body of the
plane.
Choice A is correct.
As the answer states aggregation defines a part of relationship but both
objects can exist independently. But with composite aggregation if one part is
removed then the other part will be removed. The following is taken from:
http://www.moskalyuk.com/edu/uml/interview_questions.htm Composition is a
stronger form of aggregation. The object which is "contained" in another
object is expected to live and die with the object which "contains" it.
Composition is represented in the UML by a darkened diamond. An example of a
composite relation is a Book and Chapter. A Book "has a" Chapter, and the
Chapter cannot exist without the Book. For more information about UML please
go to: http://www.uml.org/
190 You are looking
at a class diagram that another developer has drawn. You notice a solid black
diamond and a line linking two classes together. What does the black diamond
imply in UML?
A Aggregation
B Association
C Composite Aggregation /
Composition
D Dependency
E Inheritance/Generalization
Choice D is correct.
Composite Aggregation / Composition is shown by a solid black diamond.
Aggregation defines a part of relationship but both objects can exist
independently. But with composite aggregation if one part is removed then the
other part will be removed. Think of a plane the wings have a composite
aggregation relationship with the body of the plane. Note: Inheritance and
Generalization are used to describe the same thing. The same is also true
about Composite Aggregation and Composition. Aggregation is shown as a white
diamond (the diamond shape is a black outline with the centre white).
Association is just a single line linking classes/objects; this can have
multiplicity and direction. The following is taken
from:http://www.moskalyuk.com/edu/uml/interview_questions.htm Composition is a
stronger form of aggregation. The object which is "contained" in another
object is expected to live and die with the object which "contains" it.
Composition is represented in the UML by a darkened diamond. An example of a
composite relation is a Book and Chapter. A Book "has a" Chapter, and the
Chapter cannot exist without the Book. For more information about
UML:http://www.uml.org/
191 What does a
triangular arrow shape with a solid line mean in UML? (The triangle is an
outline, and not solid)
A Aggregation
B Association
C Composite Aggregation /
Composition
D Dependency
E Inheritance/Generalization
Choice E is correct.
In UML Inheritance/Generalization is shown with a triangular arrow shape. So
whenever you extend a class, you are inheriting from the class you are
extending. Note: Inheritance and Generalization are used to describe the same
thing. The same is also true about Composite Aggregation and Composition.
Aggregation is shown a white diamond (the diamond shape is a black outline
with the centre white). Association is just a single line linking
classes/objects; this can have multiplicity and direction. Composite
Aggregation / Composition is shown by a solid black diamond. For more
information about UML:http://www.uml.org/
192 You are
studying a class diagram of an exiting system so that the new functionality
you are adding uses the existing class attributes wherever possible. What do
the following symbols mean in UML with regards to visibility?
A # public, + protected, -
private
B + public, - protected, #
private
C + public, # protected, -
private
D # public, - protected, +
private
Choice C is correct.
As the answer states the + # - symbols represent the following levels of
visibility.+ Public# Protected- Private For more information about UML please
go to:http://www.uml.org/
193 Which of the
following are true about Vertical Scalability?
A (Achieved by adding servers to
the system
B Achieved by adding capacity
(memory, CPU and so on)
C It is generally more expensive
than Horizontal scaling
D Decreases manageability
E Requires few or no changes to
the system architecture
F Not supported by J2EE
G Has little or no impact on the
reliability and availability of the system
Choices B, E and G are correct.
Vertical Scalability, by definition means increasing a system's capacity by
adding memory, processors and so on. Of the two types of Scalability (Vertical
and Horizontal), Vertical Scalability is the easier to achieve because it
involves few changes to the existing system's architecture. Also adding more
CPU or memory to an existing system does not have any impact on reliability or
availability because if the system or component fails, in the absence of
redundant systems, availability and reliability would suffer. Hence choices B,
E and G are correct.
Choice A is incorrect because it actually describes Horizontal Scalability,
which is achieved by adding more servers to a system. Horizontal Scalability
is tougher to achieve because the architecture should inherently support a
multi-server environment. However once implemented, it has a positive impact
on the system's reliability and availability because it provides fault
tolerance capabilities.
Choice C is incorrect because generally it is cheaper to add capacity than to
add entire new systems. Choice D is incorrect because adding capacity should
have no impact on the manageability of a system. Choice F is incorrect because
Vertical Scalability is easy to achieve. Most J2EE vendors also provide
support for the more difficult Horizontal Scalability.
194 Which of the
following are not true about 2-tier architecture models?
A Clients may be validation
intensive, consequently requiring powerful hardware.
B Any change to one tier
typically affects both tiers.
C Represents a single point of
failure.
D Each client makes a direct
connection with the server
E They are not very maintainable
F They are quite manageable
Choices B, C and F are correct.
The question asks for points about 2-tier client/server systems that are not
true. Choice B is untrue because a change to one tier need not necessarily
affect the other tier. For example consider an Order Entry system where the
users need to see transaction history for individual customers. A new screen
can be developed to take data from the transaction tables and display it on
the client. In this example, no changes are required on the server. Consider
an alternate example where a stored procedure accessing data spread in
multiple tables now queries a materialized view. No changes would be required
to clients that call the stored procedure, as long as all input and output
remains the same.
Although it may be true in many cases, Client/Server architectures do not
always represent single points of failure. With single database servers, of
course if the server fails, clients may not be able to connect to the
database. However in multi-database applications, if parts of the client or
server fail, other parts of the system may still be accessible. Hence choice C
is a right answer.
2-tier architectures are not very manageable. Although the servers can be
managed centrally, client PCs are always distributed at user locations and it
is very difficult to troubleshoot them without local staff. Hence choice F is
a right answer.
Choice A correctly reflects what happens on a client in 2-tier applications.
Choice D explains how clients interact with the database and choice E clearly
lists that 2-tier architectures are not easily maintainable because of
constant software updates required on the clients. Hence they are all
incorrect answers.
195 Refer to the
following diagram:
In the above diagram
A Class A inherits from Class B
B Class B inherits from Class A
C Class B has a dependency to
Class A
D Class A has an aggregation to
Class B
Choice B is correct.
From the diagram it can be inferred that A and B are concrete classes and B
extends A. This is shown by the generalization relationship between B and A.
Hence choice B is correct.
Choice A is incorrect because class A does not inherit from class B. Choice C
is incorrect because the relationship between the classes A and B is
generalization, not dependency. Finally choice D is incorrect because A has an
aggregation relationship with Interface C, not class B.
196 In a UML class
diagram Private, Protected and Public attributes are shown by
A -, +,#
B +, -,hash
C #, -, +
D -,#, +
E +,#, -
F #, +, -
Choice D is correct.
In UML notation, access modifiers are shown by the signs -, # and + to
represent Private, Protected and Public. Hence choice D is correct. All other
choices show incorrect combinations.
197 Which of the
following may be used for synchronously communicating with legacy
systems?
A IIOP
B HTTP
C SHTML
D JRMP with JNI
E SMTP
F RMI / IIOP
G MOM
Choices A, D and F are correct.
IIOP (Internet Inter Operable Protocol) is the protocol used by CORBA. JRMP
(Java Remote Method Protocol) is the protocol used by Java-RMI. RMI / IIOP is
EJB1.1's protocol. All three of these methods are examples of RPC (Remote
Procedure calls) based communication, which is inherently synchronous in
nature. Note that there are exceptions (event handling in CORBA and Message
Driven Beans in EJB2.0), but generally speaking RPC is used for synchronous
communication. Hence A, D and F are correct.
HTTP, SHTML and SMTP are unrelated jargons, used for confusing the reader.
Message Oriented Middleware (MOM) is used for asynchronous messaging. Hence
choices B, C, E and G are incorrect.
198 What is an
off-board server used for?
A Providing Single-Sign on to a
Java based application
B Delegating complex processing
to a separate server
C Enable secure remote access to
a mainframe by forwarding SSL requests to serial connections
D As a database for storing the
public keys of valid Certification Authorities (CA)
E For performing symmetric key
cryptography
Choice C is correct.
An off-board server is used enable secure remote access to mainframes. This is
done typically done by forwarding SSL requests to the mainframes via serial
connections, as indicated by choice C.
An off-board server does not provide single sign on capabilities to a J2EE
application. It is also not an application server that can take up complex
business logic processing. An Off board server does not store public keys of
trusted Certification Authorities (CA) or perform symmetric key encryption.
Hence choices A, B, D and E are all incorrect.
199 Company ABC has
a predominantly EJB based J2EE application that has be accessed by CORBA
clients. Which connectivity option would you recommend?
A RMI-JRMP
B RMI with JNI
C Java IDL
D RMI-IIOP
E HTTP tunneling
Choice D is correct.
RMI-IIOP stands for Remote Method Invocation (using IIOP as the transport.)
This is the protocol supported by EJB1.1 Hence choice D is correct.
RMI-JRMP is used only when dealing with native Java clients. The question
talks about CORBA clients but does not say anything about pure Java clients.
Hence choice A is incorrect. There is also no mention of JNI support. Hence
choice B is incorrect. Java IDL is useful when you have a predominantly CORBA
based application. Hence choice C is incorrect. HTTP tunneling is a way to
allow protocols to masquerading as other protocols and bypass firewall
restrictions. Hence choice E is incorrect.
200 Which of the
Classes and Interfaces need to be created by a bean developer?
A Home Interface
B Distributed Interface
C Remote Interface
D Bean Class
E Bean Interface
Choices A, C and D are correct.
When developing EJB applications, developers need to create the Home
Interface, the Remote Interface and the Bean Class. Hence choices A, C and D
are correct.
There is no such thing as the Distributed Interface or the Bean Interface.
Hence choices B and E are incorrect.
|