|
151 You have
just started a new job working for a top finance company and you have been
asked to provide a user-friendly interface to an existing mainframe
application. You don't have any access to the mainframes source code. What is
the best technique for this?
A It can't be done.
B Use a screen scraper.
C Re-write the main frame using
Java and high-end Unix servers. Although it may take some time to do this in
the long run this will benefit the company.
D Write a Java front end then
use CORBA to communicate with the mainframe.
E Use the Java Native Interface
(JNI) to communicate with the mainframe.
F Use object Mapping
G Use JMS
Choice B is correct.
The key to this question is that you don't have access to the mainframes
source code. A screen scraper emulates a mainframe terminal. Basically the
screen scraper logs on to the mainframe like a normal user and sends requests
to the mainframe and then reads the response. The problem with a screen
scraper is that if you change any of the mainframes code there is always the
possibility that the screen scraper will stop working.Choice A is incorrect
because it is possible to add a GUI to the system. Choice C would take far too
long, cost too much and is not what the customer wants. Choices D, E and F
would all require access to the mainframes source code. Choice G is incorrect
because there is no mention that the mainframe supports a messaging system.
Some of them do and even provide interfaces for JMS however as it is not
stated in the question it is not the right answer.
152 You are working
for a company that has yet to realise the full potential of Java. You offer to
show them some of the great things Java can do by integrating a new
application with an existing CORBA system. Your bosses will then assess the
performance and reliability of this new system. How will you connect your
RMI
application to the CORBA system?
A Use Java-IDL
B This is a standard feature of
RMI.
C Can't be done.
D Can only be done by using JNI.
E Use RMI-IIOP
Choice A is correct.
The following is taken
from:http://java.sun.com/j2se/1.3/docs/guide/idl/jidlFAQ.htmThere are several
scenarios that will define how you will want to create distributed CORBA
applications. Here are some of them: Java IDL - If you have been developing
CORBA applications using IDL for some time, you will probably want to stay in
this environment. Create the interfaces using IDL, and define the client and
server applications using the Java programming language to take advantage of
its "Write Once, Run Anywhere TM" portability, its highly productive
implementation environment, and its very robust platform. RMI-JRMP - If all of
your applications are written in the Java programming language, you will
probably want to use Java RMI to enable communication between Java objects on
different virtual machines and different physical machines. Using Java RMI
without its IIOP option leverages its strengths of code portability, security,
and garbage collection. RMI-IIOP - If you are writing most of your new
applications using the Java programming language, but need to maintain legacy
applications written in other programming languages as well, you will probably
want to use Java RMI with its IIOP compiler option.Choice B is incorrect
because this is not a standard feature of RMI. Choice C is incorrect because
it can be done. You don't need to use JNI to do this so choice D is incorrect.
At present the existing systems all use CORBA. Therefore it is better to use
Java IDL. Hence choice E is also incorrect.
153 You are working
for a car leasing company and you need to integrate with one of their
mainframe applications. You should do this using either object mapping or
screen scraping. When should you use object mapping?
A You should always use screen
scrapers when you have the option.
B When you have access to the
mainframes code.
C When you don't have access to
the mainframes code.
D When you are short of time and
need a quick solution.
Choice B is correct.
Object mapping is the process of building object wrappers around legacy
interfaces. This makes the legacy system available in an OO fashion. You need
access to the legacy systems source code in order to do this.A screen scraper
emulates a mainframe terminal. Basically the screen scraper logs on to the
mainframe like a normal user and sends requests to the mainframe and then
reads the response. The problem with a screen scraper is that if you change
any of the mainframes code there is always the possibility that the screen
scraper will stop working.Any change to the mainframe might break the screen
scraper and screen scrapers are only really used when you don't have access to
the mainframes source code so choice A is incorrect. Choice C is incorrect
because you would use a screen scraper if you didn't have access to the
mainframes source code. In choice D you would probably use a screen scraper.
154 You have just
joined a new company and have spent some time chatting with the network
administrator. He has mentioned that one of the
servers is an off-board server. What is an off-board server?
A Another way to describe a
standard proxy server.
B Another type of a
screen-scraping program, (Like an object mapping one).
C A server that runs within the
DMZ.
D A proxy for a legacy system.
Choice D is correct.
An off-board server is simply a proxy server for a legacy system.
155 You are
designing an online cinema ticket booking application. At the moment you plan
to have a controller to maintain user sessions, a customer component to hold
personal details, a credit card validation component, a set of GUI screens and
a cinema component with details of all movies and seating capacities. What
should be used for each component?
A The controller should be a
Stateful Session bean. The customer should be a Stateful Session bean. The
cinema component should be a Stateful Session bean. The credit card validation
component should be an Entity bean.
B The controller should be a
Servlet. The customer should be a Stateful Session bean. The cinema component
should be a Stateful Session bean. The credit card validation component should
be an Entity bean.
C The controller should be a
Stateful Session bean. The customer should be a Servlet. The cinema component
should be a Stateful Session bean. The credit card validation component should
be a Stateful Session bean.
D The controller should be a
Servlet. The customer should be a Servlet. The cinema component should be a
Stateful Session bean. The credit card validation component should be a
Stateful Session bean.
E The controller should be a
Stateful Session bean. The customer should be an Entity bean. The cinema
component should be an Entity bean. The credit card validation component
should be a Stateless Session bean.
F The controller should be a
Servlet. The cinema component should be a Stateful Session bean. The cinema
component should be an Entity bean. The credit card validation component
should be a Stateless Session bean.
G The controller should be a
Stateful Session bean. The customer should be an Entity bean. The cinema
component should be an Entity bean. The credit card validation component
should be a Stateless Session bean.
H The controller should be a
Servlet. The customer should be an Entity bean. The cinema component should be
an Entity bean. The credit card validation component should be a Stateless
Session bean.
I Make the GUI using JSP pages
J Make the GUI an applet
Choices H and I are correct.
The controller could be implemented as either a Servlet or a Stateful Session
Bean but it makes more sense from a resources point of view to implement this
as a Servlet. The customer and cinema component need data to be stored
permanently so these should be Entity beans. The process of validating the
credit card is a service so this should be a Stateless Session Bean. JSP pages
is a better choice than the applet because it means that the system can be
used by a greater number of people because there is no dependency on the Java
plug in.
156 You have an
Enterprise Bean that represents a customer's account. One of the methods that
this bean provides is deductCost(float amount) This method is used when a
customer buys something from your company's website. This method must be
executed as part of an existing transaction. What is the correct attribute
setting in the deployment descriptor?
A REQUIRED
B REQUIRES NEW
C SUPPORTS
D MANDATORY
Choice D is correct.
If the calling client does not have a transaction (i.e. the transaction hasn't
already started) a javax.transaction.TransactionRequiredException will be
thrown.Choice A is incorrect as REQUIRED will create a new Transaction if a
transaction does not already exist whereas the question says it must be part
of an existing transaction. Choice B is incorrect because REQUIRES NEW will
create a new Transaction anyway. SUPPORTS will not force the method to execute
in a transaction. Hence choice C is also incorrect.
157 You have a
method that can't be executed in a transaction. What is the correct attribute
in the deployment descriptor?
A Leave it empty this is the
default.
B NEVER
C NOT SUPPORTED
D NO_TRANSACTIONS
Choice B is correct.
As the name suggests"NEVER" is the right answerChoice A is incorrect because
leaving the deployment descriptor empty is not the default for NEVER. NOT
SUPPORTED just suspends the transaction making choice C incorrect.
NO_TRANSACTIONS is not a valid attribute. Hence choice D is also incorrect.
158 You have been
reading up of the Gang of Four patterns and you notice that the Home interface
of an Enterprise Javabean is actually based on one of the patterns. Which
pattern is the Home Interface of an Enterprise Javabean based on?
A Singleton
B Facade
C Builder
D Factory Method
Choice D is correct.
This Factory Method pattern provides an interface for creating an object that
allows either sub classes or helper classes to create that object.The
Singleton pattern creates either 1 or a variable number of instances of a
class. So choice A is incorrect. The Façade pattern provides a simple
interface to a complex subsystem. Thus choice B is incorrect. The Builder
pattern separates the construction and representation of an object. The client
is shielded from the object's construction and it only needs to specify
content and type. Hence choice C is also incorrect.
159 You've been
developing a chat application so that members of your team can keep in touch
with each other irrespective of their location. You decided to implement the
application as a Java Applet. In order to make sure the user has the latest
version, you require the applet to connect back to the server it was
downloaded from and check with a file there. Can this be done with JDK 1.3 or
1.4 without modifying the browser's policy files? True/False?
A True
B False
The above statement is True.
The key to this question is that the applet is only connecting back to the
server it was downloaded from, and reading a file. This has always been
permitted and is permitted with both JDK 1.3 and 1.4. The applet wouldn't be
allowed to read a file on the client's machine or connect to machines other
than the one it was downloaded from.Note: You may think that if the applet has
been downloaded then it must automatically be the latest one, this isn't true
as most browser cache applets.
160 You are writing
an Enterprise Javabean to represent a Flight in a Travel agency application.
One of the developers recommended that you use Bean Managed Persistence (BMP)
for the EJB. What is true about BMP?
A Improves your ability to move
your EJB from one Application server to another.
B Reduces your ability to move
your EJB from one Application server to another.
C Improves your ability to move
your EJB from one data store to another.
D Reduces your ability to move
your EJB from one data store to another.
Choice C is correct.
When you use Bean Managed Persistence you are writing all the SQL needed to
persist the bean yourself. This means that the SQL would have been tailored to
the data store you are using and the same SQL might not work with a different
database vendor. You can cancel this out by using a Data Access Object. The
Data Access Object pattern (DAO) is used to reduce the dependency between
Enterprise Beans and the underlying database. This means that the data object
manages the connection to the data source and if the data source changes you
only need update this one object, the change doesn't affect the rest of your
application.
161 What do Atomic
and Consistent mean in reference to ACID?
A Atomic means a transaction
must execute completely or not at all.
B Atomic means a transaction
must execute completely or log where it was stopped.
C Consistent means a transaction
must execute completely or log where it was stopped.
D Atomic means the transaction
is the same as other transactions in structure.
E Consistent means the
transaction is the same as other transactions in structure.
F Consistent means the
transaction was started and finished within the specified time.
G Consistent means that the
integrity of the underlying data source is always maintained.
Choices A and G are correct.
ACID stands for Atomic, Consistent, Isolatable and Durable. All transactions
must adhere to this. Atomic means 'a transaction must execute completely or
not at all.' Consistent means 'the integrity of the underlying data source is
always maintained.'
162 You are working
late at the office one day when the security guard informs that you have to
leave as the building is closed for the evening. As you are working on a big
project you decide to continue your work at home. However when you try to
connect to the application from home you get no response. You are trying to
connect to your
RMI-JRMP
application; the port is available on the firewall, what is the most likely
reason why you can't connect?
A The port on the firewall isn't
really available.
B The company's proxy servers
are filtering out your request based upon your IP address.
C You have typed the connection
address incorrectly.
D Your application is only
listening for internal requests and you will need to change setting in the
security.policy file if you wish to connect from home.
E Your company knows that most
hacking takes place at night and takes all of its systems off-line during the
night.
Choice B is correct.
The most likely explanation here is that your company's firewall is filtering
your requests out based upon your IP address. You would need to get your home
IP address added to the list that the firewall trusts (and this won't be easy
if you're using DHCP!)Choices A and C are both possible but not the very
likely here. Hence these answers are incorrect. Choices D and E are not
factually correct.
163 How are Entity
Beans persisted?
A Entity beans are stored in
memory by the Application server.
B Entity beans are not persisted
C They are serialized and stored
on a database.
D They are NOT serialized but
rather stored in a persistent storage medium such as a database.
E It is up to the developer,
than can either be serialized or mapped directly.
Choice D is correct.
A bean normally represents a row in the database. Each field that is persisted
is typically mapped to a database. The bean itself is not stored in the
database, as the class is the same for all bean instances of the same
type…it's just the values that change. If beans were serialized when they
where stored on the database you would have to de-serialize each one when you
were doing a find operation (by criteria). When Entity Beans are passivated
(the state to the bean is written to file), serialization may be used
depending on the Application server, although most servers probably also
synchronize the state with the database as well.Storing them in memory is not
persistence. If the server crashes, all the data would be lost. Therefore
choice A is incorrect. As Entity beans are persisted, choice B is incorrect.
Choices C and E are incorrect because Entity Beans are not serialized.
164 Which of the
following statements are true?Note: This question assumes that the no-args
constructor and setEntityContext() method have already been called.
A Entity Beans start in
the"ready" state and move into the"pooled" state only after ejbActivate() has
been called on them.
B Entity Beans start in
the"pooled" state and move into the"ready" state only after ejbActivate() has
been called on them.
C Entity Beans aren't pooled.
D Entity Beans are never in
either state.
Choice B is correct.
Entity Beans start in the pooled state (this is assuming that the no-args
constructor and setEntityContext method has been called). Then when
ejbActivate() is called, they move into the ready state and return to the
pooled state when ejbPassivate() is called.
165 How do you find
a particular Entity Bean?
A Call various find methods
defined in the Home interface.
B Call various find methods
defined in the Remote interface.
Choice A is correct.
The Home interface defines the create(), find(), and remove() methods and the
finder methods are used for locating beans.The Remote Interface is used to
define all of the methods that can be called by the client on the Enterprise
Bean. If you try and call a method that exists in the Enterprise bean class
but not in the Remote Interface, you will get a RemoteException.
166 Which
statements are true?
A ejbFind() returns the Primary
Key.
B The find method/s in the Home
interface return an EJBObject or an Enumeration.
C The find method/s in the Home
interface return a Primary Key.
D ejbFind() returns an
EJBObject.
E The find method/s in the
Remote interface return an EJBObject.
F The find method/s in the
Remote interface return a Primary Key.
Choices A and B are correct.
The Home interface defines the create(), find(), and remove() methods.The
Remote Interface is used to define all of the methods that can be called by
the client on the Enterprise Bean. If you try and call a method that exists in
the Enterprise bean class but not in the Remote Interface, you will get a
RemoteException.Choice C is incorrect because the find method in the Home
interface returns an EJBObject or an Enumeration. Choice D is incorrect
because ejbFind() returns the Primary Key. The find methods are not defined in
the Remote interface so choices E and F are incorrect.
167 You are at home
trying to work on an application you're developing for your company. You want
to log on to your machine at work and develop code for your application
however you are having some trouble connecting directly to the application
(running on port 1099). What is the most likely reason that you can't
connect?
A A typing error in the
connection details.
B Your company is filtering
traffic based upon IP address
C Traffic is being filtered
based upon the port number requested.
D You need to update the
security manager that is being used with the application to allow external
connections.
E There is a bug in your program
stopping anyone from connecting whether internal or external.
Choice C is correct.
As you are able to connect to your desktop PC you know that your company
doesn't filter traffic based upon IP address. Therefore the most likely reason
you can't connect is because you are requesting a different port and the
firewall is filtering that traffic.Although it's possible that a typing error
in the connection details may be stopping you connecting it isn't the most
likely reason. So choice A is incorrect. You wouldn't be able to connect to
your desktop PC if your company was filtering traffic based upon IP address.
So choice B is incorrect. When you connect to your application from within the
office you are still connecting via a socket. So you would not be able to
connect at work either if there was a problem with the security manager. Hence
choice D is incorrect. Although choice E is possible it is not the most likely
reason.
168 You know that
Java allows you to run JRMP over HTTP, to tunnel through firewalls but does
Java allow you to run CORBA over HTTP?(CORBA uses IIOP). True/False?
A Yes
B No
Choice B is correct.
The key to the question is what does Java allow you to do. Java has no direct
relationship with CORBA so the answer is No. However if the question was
rephrased slightly for example using Java is it possible to tunnel IIOP over
HTTP then the answer would be yes (most firewalls are configured to only let
HTTP / HTTPS requests through).
169 You are working
for an investment bank. You have written an applet to display the current
price of the shares that traders have selected for monitoring. For the applet
to work, it needs to authenticate who the client is. It does this by reading a
file held locally on the client's machine. You know that applets can't read
files stored on a local machine by default. So you have placed the applet in a
jar file and that is code signed by a trusted certificate authority. Is
signing the code enough for the applet to be able to read the local file?Note:
This is based on JDK 1.3 and 1.4
A Yes it would work fine without
limitation as the code is signed.
B No the security manager of the
browser would prohibit this.
C The applet would have been
able to read the file already under JDK 1.3 and 1.4.
D As long as the code is signed
is doesn't matter which certificate authority signed it.
E It may or may not work
depending on the browser's security policy.
Choice E is correct.
Even if the code is signed, the browser's policy file may refuse it permission
to perform certain tasks. The policy file will need to grant necessary
permissions such as:grant signedBy"signingKey"
{ Permission
java.io.FilePermission"local_file","read";}to allow the applet to read local
files.Choice A is incorrect because it depends on the browsers security policy
file. Choice B is incorrect because the security manager might not prohibit
this. The applet wouldn't automatically be able to read the file. So choice C
is incorrect. It would matter which certificate authority signed it, if you
have not chosen to trust a particular certificate authority the code might as
well not be signed at all! So choice D is also incorrect.
170 You are
developing an application to be used at a major bank. Security is a crucial
element and you have decided to use JAAS. The GUI will be based on the MVC
framework and it uses swing. The application will connect people in the same
office so that they can all securely review the same financial data. What
protocol should you use to do this?
A IIOP
B JRMP
C HTTP
D HTTPS
Choice B is correct.
As there is no reference to this being a web based solution and all of the
staff are in the same office there is no need to use HTTPS. JRMP is the most
appropriate answer.There is no mention of the need for Entity Beans or
interfacing with a CORBA system so choice A is incorrect. Choices C and D are
incorrect because this is not being used over the web.
171 What are the
benefits of using the Service Locator pattern?
A It is used primary by Servlets
to locate other services such as JMS. A good example of this pattern would be
a web based login facility. If a client enters an incorrect password their
need to be redirected to a different but their session needs to be maintained
across the application.
B It is used to catalog
Enterprise Beans so that other beans can find them quickly and efficiently.
For example if you need to forward request from a Session Bean to an Entity
Bean then the Session Bean requests the location of the Entity Bean from the
Service Locator object. The Service Locator looks in a table (like a HashMap)
and returns the Entity Beans location.
C The Service Locator pattern
can improve performance by introducing a caching facility.
D There is a slight loss of
performance when using the Service Locator pattern but this is out weighed by
the improved maintainability of the code.
E None of the definitions of the
Service Locator pattern are accurate.
F The Service Locator pattern is
used to hide the complexities of initial object creation, EJB lookups and
object re-creation.
G Multiple clients can reuse the
same Service Locator pattern.
Choices C, F and G are correct.
The following is taken from Core J2EE Patterns: Best Practices and Design
Strategies page 369 "Use a Service Locator object to abstract all JNDI usage
and to hide the complexities of initial context creation, EJB home object
lookup, and EJB object re-creation. Multiple clients can reuse the Service
Locator object to reduce code complexity, provide a single point of control,
and improve performance by providing a caching facility."Choice A is
describing a standard web based login but this has nothing to do with the
Service Locator pattern. Choice B sounds plausible but this is not how the
Service Locator pattern is used. Choice D is incorrect as there is an increase
not a loss of performance when using this pattern. Choice E is incorrect as
there are accurate descriptions of the Service Locator pattern amongst the
answers.Some useful links:
http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
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.
172 When would you
use Tunnelling?
A When you don't have access to
any spare ports of the Firewall and need to tunnel your application through an
existing port.
B To break out of prison.
C When you do have access to
spare ports of the Firewall and are able to use them. So you tunnel your
application out of one of these new ports that was created just for your
application.
D When you are using IIOP with
RMI.
Choice A is correct.
Tunnelling is used to pass one protocol through a port that it does not, by
default run on. For example if the only free port on the firewall was port 80
and you needed to pass JRMP through the firewall you would "tunnel" JRMP
through the firewall. (JRMP by standard runs on port 1099). Basically JRMP
would run on top of HTTP. However Tunnelling should generally be avoided and
should only be used as a last resort. You use tunnelling when you don't have
access to a particular port. So choice C is incorrect. RMI-IIOP is unrelated
to tunnelling. Choice B is incorrect because stealing the key from the guard
would be easier!
173 You are working
for a small to medium sized business that has just started to use servers to
host J2EE Applications (its own and clients'.) However since its launch into
this new area there have been three separate instances of hacks involving
access of sensitive sales information. A security consultant has been brought
in to assess the situation and he recommends that your company use a DMZ. What
is a DMZ?
A The network behind a firewall
that's protected from the Internet.
B The region inside the inner
firewall (we are assuming that there are two firewalls). This network is
called the DMZ.
C The network outside of the
outer firewall. This could be the Internet or other client networks. (We are
assuming that there are two firewalls).
D A region between two
firewalls. The Internet would come in through the first firewall but only
systems within the first firewall in the DMZ can go through the second
firewall.
Choice D is correct.
DMZ stands for Demilitarized zone. To set up a DMZ you need two firewalls with
which you create 3 separate regions. The different regions are the internet,
DMZ (in the middle) and your network. You would have a server in the DMZ that
would be accessible to both the public and employees in your local network.
The internet connections will not have access your network though they will be
able to access the server in the DMZ. Your network will access the internet
through the server in the DMZ.Choice A is just describing the process of using
a firewall. The region described in choice B is your network the DMZ is the
area between the two firewalls. Choice C describes the internet not a DMZ.A
Useful link: http://www.saintrochtree.com/network-advices/000004.htm
174 You are
designing a web-based application for an online recipe site. Although this may
not seem that popular, the estimated number of unique visitors to the site is
100000 per day. The site is purely informational, you can't buy recipes or
upload your own (if you wish to add your own recipes they have to be emailed
to the webmaster). Despite that fact that there no transaction and persistence
requirement it is still recommended that you use an Application server and
Enterprise
beans. The main reason for using the Application server and Enterprise Beans
is that it allows you to remove some of the processing from the web servers
and this increases the performance of the site. True/False?
A TRUE
B FALSE
The above statement is False.
The key to this question is that there are no transactions and there is no
data to persist. All you are sending to the client are HTML web pages; even if
you were to use JSPs/Servlets you still wouldn't use an Application server. In
a situation like this you have to think of what the Application server should
actually do? In this case there is nothing for it to do.
175 You are an
enterprise consultant for one of the Fortune 500 companies. You have been
discussing a possible design for a 3-tier application with a prospective
client. They know very little about Java and are asking you if Java is always
the best solution. Your response is that although normally for each project
many factors have to be considered before selecting the programming language
and framework, because this is a 3-tier architecture Java is definitely the
best solution. Is this true? True/False?
A TRUE
B FALSE
The above statement is False.
It is impossible to make sweeping statements such as Java is always the best
solution for 3-tier architectures. A project needs to be looked at
individually and then assessed. You may think that one project naturally suits
a full Java implementation only to find out that a company has already heavily
invested in a different technology or that you don't have the resources
(employees with skills in Java based technologies) to implement a solution.
\ |