JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA

SCEA Mock Exams - 3

51    You are working for a web design company and one of your clients would like to convert their website that currently uses Perl and CGI scripts over to a language that is easier to maintain and reuse. Their website is a sports betting website where the customer is able to logon and place bets on a variety of different sporting events. What would you replace this with?

 

A     JSP/Servlets

B     JSP/Servlets/EJBs

C     JMS

D     ASP

 

Choice B is correct.

 

The key to this question is that the site offers the facility to place bets online. Therefore transactions are involved and this means that Enterprise Java Beans need to be used. It is very hard to implement transactions with just Servlets and JSPs. Hence choice B is correct.Choice A is incorrect because transactions are involved. JMS is the messaging package of the J2EE and therefore C is incorrect. And choice D well, enough said!

 

 

52    You are in charge on converting an existing web based solution over to the appropriate J2EE technology. What should you use? The website offers the customers price comparisons on a variety of different products. Revenue is generated by click through sales when the customer has found the best price.

 

A     JSP, Servlets

B     JSP, Servlets, EJBs

C     Applets, EJBs

D     No need to change it PERL/CGI scripts is the best solution.

 

Choice A is correct.

 

The key to this question is that the revenue is generated by click through sales; this implies that there are no transactions involved. If transactions were involved then you would use EJBs as well.Choices B and C are incorrect because there are no transactions involved in this application. PERL/CGI scripts are harder to maintain than Java code so choice D is not the best option.

 

 

 

 

53    Your 3-tier application has been deployed in a production environment and has been running smoothly for over 3 months. However recently due to a Television campaign you're getting 3 times the normal volume of traffic. To cope with this you decided to introduce Round-Robin load balancing. How is round robin load balancing going to help with the extra traffic?

 

A     Splitting requests evenly amongst all back end servers

B     The proxy sits behind the backend servers monitoring the performance of each one. When it notices one is being used too much it will automatically forward requests to a different server.

C     Splitting requests amongst all back end servers depending on the amount of spare CPU time each server has available.

D     A technique used to target certain requests to certain backend servers, e.g. All Servlet requests from one server. All static HTML from another.

 

Choice A is correct.

 

Round-Robin load balancing is the process of splitting requests evenly irrespective of the request type (i.e. SSL, JSP, HTML). If you have 3 servers as the first request comes in it goes to the first sever, second request to the second server and the third request to the third server. As the fourth request comes in the process starts again and so this request is forwarded to the first server.Choices B and C are not descriptions of any known load-balancing technique. Choice D is a description of reverse proxy load balancing. This is generally used when you have servers with different amounts of CPUs and Memory. You might have some really powerful servers just to be used for SSL sessions and others to handle static html. Using this will maximise the performance of your application.

 

 

 

54    A Fortune 500 company wishes to add new functionality to its existing sales system and has contracted you as the lead architect for the project. The legacy system has been written in C++ and they wish to keep this system running although they may switch over to full Java solution later, depending on the performance of the new extra functionality. How will connect to this legacy system?

 

A     Wrap the application using JNI and make it accessible using RMI.

B     Rewrite the C++ code in Java. This shouldn't be too hard because it's converting from one object-orientated language to another.

C     Use a screen scraper.

D     Use CORBA to talk to the C program then get the CORBA to talk to the RMI server.

 

Choice A is correct.

 

JNI stands for Java Native Interface and is used to allow Java to communicate with programs written in languages like C. In effect you are wrapping the C code to make it available to Java. For example you will wrap a C method called debitAccount(int amount) with a similar Java method, the Java method will just call the C method. This means you can now make the method accessible via RMIChoice B is incorrect because this is not what customer wants, you must stick to the requirements. It would be inappropriate to use a screen scraper here so choice C is incorrect. Although choice D might be possible, to get this to work would take far more work than is actually required. You would need to get the C and CORBA programs working first then try and interface CORBA and RMI, which is not necessary, in this case.

 

 

 

 

 

55    The IT company you are working currently doesn't offer the facility for customers to buy PCs bundled with printers. Luckily they have just struck a deal with another printer company. The list of printers they offer is maintained in a database that runs on one of the printer companies servers. You need to connect to this database however you don't have a JDBC driver that you can install on the server. The database server does have an ODBC driver installed on it. How do you connect to the database?

 

A     You can't, change the data store.

B     Get the printer company to write a web page that you can pass SQL requests to. (You would simply send SQL queries as POST requests and the output would be the ResultSet) This should be implemented securely using SSL with client and server authentication

C     Wrap some JNI access code around the OBDC driver then connect using JDBC.

D     (Don't implement the solution using Java.

E     Send the database requests as JMS method calls

F     Use the JDBC-OBDC bridge driver.

 

Choice F is correct.

 

The key to this question is that with the JDBC-ODBC you are not connecting to the database directly you are connecting to the ODBC driver instead. So it doesn't matter what the database is as along as there is an ODBC driver available.Choice A is incorrect because it can be done. Although choice B may work it is not the best solution, the JDBC-ODBC Bridge is the best solution. You don't need to wrap JNI code around the ODBC driver to connect to it. Hence choice C is incorrect. Choice D is incorrect because it is possible to connect to the data source using Java. Choice E is incorrect because there is no mention of any Message server in the question and this is not suitable technology for the job.

 

 

 

 

 

56    A work colleague has been describing a mainframe application that your company uses to maintain their sales data. He says that the next application you will need to design will involve screen scraping, as he can't see how else the connection to the mainframe will be possible. What is screen scraping?

 

A     A plastic tool to get ice off a car windscreen.

B     A program that interacts with a mainframe passing requests from the users directly to custom written code that you have added in the mainframe.

C     A program that emulates a mainframe terminal and passes user input to the mainframe.

D     A program that's supplied by the mainframe for Java programs to interact with.

E     Your colleague is wrong. It will be quite easy to connect directly to the mainframe using Java.

F     A program that uses JNI to access the mainframe.

G     A program that use JMS to send messages to the mainframe. Note this only works if the mainframe has a message server built into it.

 

Choice C is correct.

 

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 maybe true but it's not the right kind of screen scraper! Choices B and F require that you have access to the mainframes source code. Screen scrapers are written as and when they are needed, the mainframe vendor does not supply them so choice D is incorrect. Your colleague is right. Therefore choice E is incorrect. Choice G is incorrect because although you can communicate with mainframes via JMS the process is different from screen scraping.

 

 

 

 

57    You are working for a company with a worldwide presence; their offices are spread across many countries and over many computer networks. Virtual private networks have been set up to increase security. What are Virtual Private Networks are where are they created? (VPNs)

 

A     A network created between two other networks (these are not located in the same place, geographically). Encryption and Authentication are used in the VPN. Normally the VPN is a network on top of an untrusted network (like the Internet).

B     The area between two firewalls. You let traffic from the Internet into this area (through the first firewall) but not through the second firewall (to your secure network).

C     The secure (inner) network as described in answer B.

D     A network created between two other networks (these are not located in the same place, geographically). Encryption and Authentication are NOT used in the VPN. Normally the VPN is a network on top of a trusted network (like the Internet).

 

Choice A is correct.

 

The answer given in choice A explains what a Virtual Private Network is (VPN). Choice B describes a DMZ; choice C the local area network in the DMZ and choice D is incorrect because encryption and authentication are used in the VPN.

 

 

 

58    What is object mapping?

 

A     The process of converting a class diagram to Java code.

B     A program that emulates a mainframe terminal and passes user input to the mainframe.

C     The process of building object wrappers around Java interfaces. This allows the legacy system to interact with your Java application.

D     The process of building object wrappers around legacy interfaces. This makes the legacy system available in an OO fashion.

 

Choice D is correct.

 

Object mapping is used when accessing legacy systems. You need access to the legacy system's source code in order to do this.Choice A sounds plausible but is incorrect. Choice B is a description of a screen scraper. There is no need to build object wrappers around Java interfaces. Choice C describes the opposite. Hence choice C is incorrect.

 

 

 

 

59    You are the lead architect for a project that will require you interfacing with existing CORBA systems. You are planning to use Java IDL to integrate with these other systems. Which of the following statements about Java IDL are true?

 

A     Allows Java to use CORBA

B     Should be used when most of your new Java applications will be entirely Java based.

C     Should be used if you have already been using CORBA for a while and wish to carry on with some CORBA systems

D     Java IDL has nothing to do with CORBA. To communicate with CORBA you will need to use JNI (Java native interface) and J2C (Java 2 CORBA)t+Same as E expect you won't need to use JNI.

E     Java IDL should be used when servicing messaging requests from CORBA clients.

 

Choices A and C are correct.

 

The following is taken from:http://java.sun.com/j2se/1.3/docs/guide/idl/index.htmlJava IDL adds CORBA (Common Object Request Broker Architecture) capability to the Java platform, providing standards-based interoperability and connectivity. Java IDL enables distributed Web-enabled Java applications to transparently invoke operations on remote network services using the industry standard IDL (Object Management Group Interface Definition Language) and IIOP (Internet Inter-ORB Protocol) defined by the Object Management Group. Runtime components include Java ORB for distributed computing using IIOP communication.Choice B is incorrect because you should use RMI-IIOP instead of Java IDL. Choices D and E are not true as Java IDL adds CORBA capability to the Java platform. Choice F is incorrect because Java IDL shouldn't be used when servicing requests from CORBA clients and the reference to messaging is a red herring.

 

 

 

 

60    You are designing an Enterprise Application to provide a way for customers to buy products from many companies through one standard site. The application servers you have use the EJB specification 1.1. You have a customer bean and are not sure whether to use CMP or BMP.  When should you use CMP?

 

A     When performance is essential and you are storing standard data types.

B     When performance is not essential and you are storing standard data types.

C     When performance is essential and you are storing complex data types.

D     When performance is not essential and you are storing complex data types.

 

Choice B is correct.

 

Please note that this is referencing EJB1.1This is a time dependent question as technologies have changed. When Sun wrote the EJB specification 1.1 Application Servers weren't very efficient at generating SQL used for persistence and it used to be recommended that you use BMP instead. However App Servers have improved and some would argue that CMP is now more efficient than BMP. In the SCEA guidebook by Cade it says BMP will out perform CMP. When the exam is updated to EJB 2.0, the answer to this question would probably change.Choice A is incorrect because BMP can be more efficient than CMP. CMP cannot cope with mapping complex data types to a database very efficiently. Hence choice C is incorrect. Even if performance is not an issue, it is still recommended that you use BMP when storing complex data types. Therefore choice D is incorrect.

 

 

 

 

 

 

 

 

 

61    You've written all the UML diagrams you need for your companies online store. Other developers and architects have approved them. Now you are deciding which Enterprise Beans will use Container Managed Persistence (CMP) and which will use Bean Managed Persistence (BMP). When should you use BMP?

 

 

A     When performance is essential and you are storing standard data types.

B     When performance is not essential and you are storing standard data types.

C     When performance is essential and you are storing complex data types.

D     When performance is not essential and you are storing complex data types.

 

Choices A, C and D are correct.

 

Please note that this is referencing EJB1.1This is a time dependent question as technologies have changed. When Sun wrote the EJB specification 1.1 Application Servers weren't very efficient at generating SQL used for persistence and it used to be recommended that you use BMP instead. However App Servers have improved and some would argue that CMP is now more efficient than BMP. In the SCEA guidebook by Cade it says BMP will out perform CMP. When the exam is updated to EJB 2.0, the answer to this question would probably change.Choice C is incorrect because using Container Managed Persistence will increase the portability of the Enterprise Bean and should be used wherever possible.

 

 

 

62    Your company has won a contract with a major supermarket company to allow customers to do their grocery shopping online. As this will involve a huge number of shoppers you have decided to opt for a J2EE solution. When creating the Enterprise Beans to be used in this application what components do you need?

 

A     A Home interface, A Remote Interface and a class that implements either the SessionBean or EntityBean interfaces.

B     A Home interface and a class that implements either the SessionBean or EntityBean interfaces.

C     A Remote interface and a class that implements either the SessionBean or EntityBean interfaces.

D     A Remote interface and a class that implements the EnterpriseBean interface.

E     An EJBObject interface, a Remote interface and a class that implements either the SessionBean or EntityBean interfaces.

F     An EJBObject interface, a Home interface and a class that implements either the SessionBean or EntityBean interfaces.

 

Choice A is correct.

 

You need a Home interface that has create() and find() methods, a Remote interface to define your business methods, and a class that implements either the SessionBean or EntityBean interfaces.Choice B is incorrect because you also need a Remote interface. Choice C is incorrect because you also need a Home interface. Choice D is incorrect because you need the Home interface and a class that implements either the SessionBean or EntityBean interfaces. Choices E and F are incorrect because you don't need an EJBObject interface.

 

 

 

 

63    What is the difference between Stateful session beans and stateless session beans?

 

A     Stateful session beans are pooled and Stateless session beans aren't.

B     A Stateful session bean can persist its state through a server crash but a Stateless session bean can't.

C     A Stateful session bean can remember its state with a client, like a conversation but a Stateless session bean can't.

D     A Stateful session bean uses a Primary Key interface to maintain persistence.

 

Choice C is correct.

 

An example use for a stateful session bean would be a shopping basket because it maintains its state. However a stateless session bean can't and instead should be used as a service e.g. credit card validation. A stateful session bean cannot survive a server crash, as none of its data is permanently stored like Entity beans.Choice A is incorrect because Stateless session beans are pooled. Choice B is incorrect because a stateful session bean cannot survive a server crash. Choice D is incorrect because the data in a stateful session bean is not stored on a database and therefore there is no Primary Key interface for stateful session beans.

 

 

 

64    What is the difference between stateful Session beans and Entity beans?

 

 

A     Stateful session beans can survive a server crash but Entity beans can't.

B     Entity beans can survive a server crash but Stateful session beans can't.

C     Session beans are typically used to make calls on Entity beans.

D     Entity beans are typically used to make calls on Session beans.

 

Choices B and C are correct.

 

Entity beans represent data on a database whereas session beans represent workflow. It is very expensive to create Entity beans and the code can become quite complicated. Hence you should use the Session-Fašade pattern, where the customer talks to a Session bean which in turn talks to the Entity bean.Choice B is incorrect because session beans cannot survive a server crash and in choice D the description is the other way around.

 

 

 

65    You have an application that will be used for customers to buy service engineers time and extend warranties online. You have several different Enterprise Beans in this application for example, Customer, Warranties, CreditCardValidation etc. It's a long time since you've coded EJBs (normally your time is spent designing applications at a higher level) and you've forgotten which methods should go in which interface. What methods do you put in the Remote interface?

 

A     Defines create(), find(), remove(Object) methods.

B     Defines signatures of EJB's business methods.

C     Defines the persistence of the bean, e.g. how to persist etc.

D     Defines all methods that the client can call on the EJB.

E     You don't need a Remote interface for an EJB. An EJB consists of a Home interface and an EJBObject interface.

 

 

Choices B and D are correct.

 

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 hasn't been defined here you will get a RemoteException.The methods in choice A are defined the Home interface. Choice C describes information that would be found in the deployment descriptor and application server. Choice E is incorrect because a remote interface (that implements javax.ejb.EJBObject) is required.

 

 

 

 

 

66    You are designing an Enterprise Bean to represent a customer in your new application. You have many methods for this EJB for example:createAccount()deductAmount()create()find()Which of these methods needs to go in the Home Interface and what is it used for?

 

A     Defines create(), find(), remove (Object) methods.

B     Defines signatures of EJB's business methods.

C     Defines the persistence of the bean, e.g. how to persist etc.

D     Defines all methods that the client can call on the EJB.

E     The createAccount(), deductAmount() methods need to go in the Home interface as it defines the business methods.

 

Choice A is 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 hasn't been defined in the remote interface, you will get a RemoteException.Choice B is incorrect because these are methods defined in the Remote interface. Choice C describes information that would be found in the deployment descriptor and the application server. Choices D and E describe the Remote interface.

 

 

67    Select the most appropriate use for an Entity Bean?

 

A     Store state for a particular client.

B     To store data permanently such as financial data.

C     Store state for any client, not any in particular.

D     Provide a service to the client.

 

Choice B is correct.

 

The key to this question is"select the most appropriate" there are a two possible right answers. (B) Is the most correct because it has the word permanently in the answer. Entity beans represent data on a database. It might be possible to argue that (A) is also right because maybe that is a customer Entity Bean storing their address and personal details. But there is no reference to permanent data storage. Hence (B) is the better answer.Choice C would require either a stateless or stateful session bean. The reason it could be either is because it says"not any particular client". Choice D would typically require a stateless session bean.

 

 

 

 

68    You've managed to work out what the next big online shop will be way ahead of everyone else, and are currently designing it. Although the design is still in a rough stage and you have yet to secure sponsors to take it into production you have already decided on some of the Enterprise Beans that you will need. You know you will need a customer EJB, Shopping basket EJB, another EJB to be used when accessing data on a legacy system. You know you will need many more but what would be an appropriate use for a Stateless Session Bean?

 

A     To represent a shopping basket.

B     Provide a service to the client.

C     Store state for a particular client.

D     To access data on a legacy system.

 

Choice B is correct.

 

Stateless session beans can't remember which client they were last talking to and any data they might hold is not saved in a database. Stateless session beans are used to provide a service. E.g. credit card validation.Choice A is incorrect because a shopping basket would require state (a Stateful Session Bean). Choice C would require a Stateful Session Bean or Entity Bean depending on whether the data needed to be permanently stored for that client. Although choice D is possible this isn't the most appropriate use for a stateless session bean.

 

 

 

69    In a Catalog Enterprise Bean, (used in an online sports shopping site) you have code that will be executed when ejbPassivate() and ejbActivate() are called. The code is used to perform basic house keeping tasks. You need to know when the code will execute so which of the following statements are true?

 

A     ejbPassivate() is called prior to passivation.

B     ejbPassivate() is called immediately after passivation.

C     ejbActivate() is called prior to activation.

D     ejbActivate() is called immediately after activation.

 

Choices A and D are correct.

 

The descriptions in choices B and C are the wrong way round.

 

 

 

 

 

 

 

 

70    You have never worked with J2EE application servers before and are about to release your first 3-Tier application. Your company already has a strong customer base so you expect a huge volume of traffic over the first few days of the launch. You're not to sure how your application server will cope with all the customers but a colleague reassures you that the Enterprise beans are pooled and the performance of the system will be fine. What are the benefits of bean pooling?

 

A     Improves response time between client and bean

B     Means you need fewer instances of the beans and therefore increases scalability.

C     Means you need fewer instances of the beans but this does nothing for increasing scalability.

D     Means you keep more instances of the beans in memory but this improves performance of the Application server ten fold.

 

Choice B is correct.

 

Bean pooling is just like database connection pooling. There is no point having a few thousand instances in memory when you could get by with 50. When a bean is in a pooled state it is not associated with any particular client.The following are wrong because:You could argue that by bean pooling it reduces the load on the application server and this indirectly improves the response time. However this choice (A) is not the most appropriate. Choice C is incorrect because bean pooling does increase scalability. Choice D is incorrect because you keep fewer instances of the beans in memory.

 

 

 

71    Which of the following statements are true with regards to bean pooling?

 

A     The EJB specifies how many instances to pool at deployment time.

B     Although bean pooling improves performance it doesn't offer any advantages in Scalability terms.

C     If your server has enough memory you should avoid bean pooling.

D     The application server depending on the beans usage decides the number of instances to pool.

 

Choice A is correct.

 

You can say how many instances should be pooled at deployment time.Choice B is incorrect because bean pooling does increase scalability. There is no need to avoid bean pooling and if you didn't do it the amount of memory you would need would be far too expensive. Hence choice C is incorrect. The number of beans to pool is set at deployment time. Hence choice D is also incorrect.

 

 

 

72    Its not just Stateless Session beans that are pooled, Entity beans are as well. True/False?

 

A     TRUE

B     FALSE

 

The above statement is true.

 

Yes they are both pooled to reduce the load on the Application server.

 

 

 

73    When should RMI over IIOP be used?

 

A     RMI over IIOP is used all the time with standard RMI.

B     When performance doesn't matter.

C     When you are dealing with a pure Java system, no legacy systems etc.

D     When RMI is used with Enterprise Javabeans.

 

Choice D is correct.

 

The following is taken from:http://java.sun.com/j2se/1.3/docs/guide/idl/jidlFAQ.htmlRMI-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 A is incorrect because JRMP is the standard for RMI. Whether you use IIOP or JRMP is irrelevant in terms of performance. Hence choice B is incorrect. You should use standard JRMP in the case choice C describes.

 

 

 

74    As part of your online shopping site you need customers to be able to pay for their goods securely. You have decided that you will use SSL with 128bit encryption to transmit the credit card details. What port number does HTTPS run on and can it be configured to run elsewhere?

 

A     8443 and yes it can run elsewhere

B     8443 and no it can not run elsewhere it must run on this port

C     443 and yes it can run elsewhere

D     622 and yes it can run elsewhere

E     443 and no it can not run elsewhere it must run on this port

 

Choice C is correct.

 

As a standard HTTPS runs on port 443 but it can be configured to run elsewhere. With web servers such as Tomcat the SSL port is 8443.

 

 

 

75    You are designing an application that will use JRMP over IIOP. The Network engineers at your company would like to know what port you intend to use to access the internet and other networks so that they can make it available on the companies firewall. What port do you ask for?

 

A     443

B     535

C     1099

D     8443

E     80

 

Choice C is correct.

 

JRMP runs on port 1099 as standard although it is possible to run it on a different port.Choice A is the standard SSL port number. IIOP uses port 535. Web servers such as Tomcat use the port 8443 for SSL. And choice E is the standard HTTP port. Although you wish to access the internet you are not making http requests.For more information please refer to the following URL:http://www.iana.org/assignments/port-numbers

 


javabeat | advertise | about us | contact | useful resources
Copyright (2004 - 2013), JavaBeat