227 . You can traverse through the elements of many Java Collection objects because they provide a way to access their elements sequentially. What design pattern is used here?
228 . Compact Computers is a small computer assembly company. Any customer currently has the following choices for a PC:
- 800 MHz processor, 40 GB HDD, 128 MB RAM
- 1 GHz processor, 60 GB HDD, 256 MB RAM
- 1.2 GHz processor, 80 GB HDD, 512 MB RAM
The use of what design pattern would ensure that only the legal combinations could be sold?
- Factory Method
- Abstract Factory
229 . Inaccu Weather has a web site where people can check the weather forecast of a city for up to five days in advance. The data comes to Inaccu Weather through a specialized custom feed that directly updates a relational database. If the company can expect between fifty to hundred concurrent hits in to their site, which of the following Java based technologies may be best suited for their needs?
- Servlets and JSP for presentation and Session Beans with DAO for retrieval
- Servlets and JSP for presentation and CMP Beans for retrieval
- Servlets and JSP for presentation and BMP Beans for retrieval
- Applets for presentation and either Entity or Session Beans for retrieval
- Servlets and JSP for presentation with Java classes encapsulating all database access
230 . Toysrfuss, a national toy store is creating a new e-front for Order processing. Customers have to create an account to transact with them, although an account is not required for browsing the catalog. Customers can browse items and add them to a shopping cart. They can then proceed to checkout. At this time, they can update quantities and submit the order. What technologies may be best suited for this application?
- JSP for presentation and Servlets as controllers
- Servlets for presentation and JSP as controller
- Stateless Session Bean for Shopping cart
- Stateless session bean for catalog retrieval
- Stateful Session bean for shopping cart
- Stateful session bean for Order update
- Entity bean for Catalog retrieval
- Entity bean for Order update
231 . Of the following scenarios, which one may be best suited for the use of Entity Enterprise Beans?
- Calculation of tax information, based on data retrieved by two other Entity Beans
- To maintain shopping cart state for an online application
- To retrieve product catalogs based on a search criteria
- To allow concurrent access to shared data, as in the case of on an online auction house’s application
232 . Most EJB servers show high degree of availability. Server clusters are an example of how this is functionality is achieved. What key advantages might server clusters offer in an EJB environment?
- Load distribution
- Location transparency
- Caching capability
- Load balancing capability
- 2PC (Two phase commit) capability
233 . Status Quo is an emerging B2C company that has a portal through which customers can purchase clay jewelry. Since the order process involves a shopping cart, session management and secure access are required. How would you manage this?
- Use HTTP since it is a stateful protocol
- Use HTTPS since it is a stateful protocol
- Use SOAP for state and security management
- Use CGI with cookies for state management
234 . Chocolate, an exotic chocolate maker in France is planning to provide an e-front for chocolate sales. FedEx would ship the packages to various national and international locations. In order to customize the customer’s interaction with the system and to make his / her overall shopping experience more pleasant, Chocolate has decided to support Internationalization?
What are some of the common things they would need to consider?
- Language for messages
- Formats (numeric, date and so on.)
- DMZ requirements
- Taxes and legal rules
235 . A sample program ships with 2 properties files – Base.properties, Base_fr.properties. If the current Locale, Locale.ENGLISH has no matching properties file, what will happen when the ResourceBundle.getBundle method is called with ‘Base’ and Locale. English as parameters?
- Since a matching properties file is not found, an exception is thrown
- This would not pose a problem because when a matching properties file is not found, the default properties file is used instead
236 . What is a Demilitarized Zone (DMZ)?
- The logical separation of tiers in a J2EE application. Example: the separation between the Web Tier and the EJB Tier
- The logical separation of layers in a J2EE application. Example: The separation between the Operating System and the EJB Container
- A type of protection offered by proxy firewalls, currently only available to the U.S armed forces under National Security laws
- The region between two firewalls
237 . ScreamWorks, a cinema multiplex, has a website from which you may download signed applets with the latest trailers, show timings and so on. The Applet works on Java 1.3 or higher. The applet needs to write user preferences to a temp file in the host machine (where it is being executed)?
Is that possible? (Note: The client has defined a usePolicy and the java.policy has granted no persmissions for the applet)
Choose the one below:
- Applets cannot be used here because even signed applets are untrusted if the necessary permissions are not granted
- The sandbox model does not apply to signed applets. Hence this will pose no problem
238 . Which of the following are valid methods in Entity EJBs?
239 . What does the term Atomicity mean in the context of ACID transactional properties and Enterprise Java Beans?
- Integrity of underlying data
- Non Interference from other processes or systems
- Complete execution or no execution at all
- Maintenance of all data changes in physical storage
240 . Which of the following statements about ‘Not Supported’ and ‘Never’ transactional attributes are true?
- ‘Not Supported’ suspends any transaction until the method is completed whereas ‘Never’ throws a RemoteException when called with a transaction
- ‘Never’ suspends any transaction until the method is completed whereas ‘Not Supported’ throws a RemoteException
- If the method is called without any transactional scope, both attributes will work identically
- If the method is called with a transactional scope, both attributes will work identically
241 . EJB1.1 has support for undefined Primary Keys. This means that the Primary Key can be undefined until deployment time. When we use defined Primary Keys, the Bean class and the Interfaces use the BeanPK type to identify the key?
What do the Bean class and the Interfaces refer to in the case of undefined Primary Keys?
Choose the one below:
- Though the Primary Key itself can be undefined, its name must be predetermined. The Bean class and the Interfaces use this name
- An instance of java.util.Enumeration
- An instance of java.lang.Class
- An instance of java.lang.Object
242 . Which of the following statements is true about DNS Round Robin?
- It considers actual load on machines before routing requests
- It uses a random generator to decide which server to route a request to
- It routs requests to one server until a configured threshold is reached and then sends subsequent requests to the next server
- Each Request is sent to subsequent server in the list, after the end is reached it starts with the first server again
243 . Generally speaking what is the relevance between Performance and Security?
- They are not related to each other in any way to High Security generally results in high performance
- High performance is a pre-requisite for secure systems
- Security and Performance are inversely proportional
- Low performance systems cannot be secure
244 . Refer to the following diagram?
Choose the one below:
- A has an association relationship with C
- C has an association relationship with A
- A has a composition relationship with C
- C has a composition relationship with A
- A has an aggregation relationship with C
- C has an aggregation relationship with A
245 . Refer to the following diagram?
The above diagram is an example of?
Choose the one below:
- Object Interaction Diagram
- Collaboration Diagram
- State Diagram
- Sequence Diagram
- Activity Diagram
246 . CORBA specification does not provide support for which of the following?
- Naming Service
- Container managed Persistence
- Transaction Service
- Event (Asynchronous Messaging)
- Concurrency Control
247 . Company ABC has a legacy application that can be accessed via CORBA. The company wants to integrate new Java based development with the existing legacy services. At this time no new services are planned. If the legacy application were primarily to be used as a CORBA server, which connectivity option would you recommend?
Choose the one below:
- RMI with JNI
- Java IDL
- HTTP tunneling
248 . Which of the following defines a standard architecture for connecting the J2EE platform to heterogeneous EIS applications?
- Java Web Start
249 . Which of the following methods is optional in the Home Interface of an Entity Bean?
- None of the above
250 . The Bean class provides implementations for which of the following methods?
- Methods in the Bean’s Home Interface
- Methods in the Bean’s Remote Interface
- EJB Callback methods
- A, B and C
- A and B
- A and C
- B and C
251 . Which of the following statements is true about Stateful Session Beans?
- They leave Method Ready Pool state to enter Does not Exist State
- They leave Method Ready state to enter Stateful State
- They leave Method Ready state to enter Passivated or Does not Exist state
- They never leave the Method Ready state
227 : 4 is correct.
Iterator (GOF 257)”Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.” Hence choice 4 is correct.
Visitor (GOF 331)”Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.” Hence choice 1 is incorrect.
Observer (GOF 293)”Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.” Hence choice 2 is incorrect.
Builder (GOF 97)”Separate the construction of a complex object from its representation so that the same construction process can create different representations.” Hence choice 3 is incorrect.
Proxy (GOF 207)”Provide a surrogate or placeholder for another object to control access to it.” Hence choice 5 is incorrect.
Decorator (GOF 175)”Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.” Hence choice 6 is incorrect.
228 : 4 is correct.
This question needs you to apply your knowledge of design patterns. We are dealing with families of related objects.
Abstract Factory (GOF 87)”Provide an interface for creating families of related or dependent objects without specifying their concrete classes.”
The applicability section of Abstract Factory (GOF 88) indicates that this pattern is to be used when:
A system should be configured with one of multiple families of products
A family of related product objects is to be used together and the constraint needs to be enforced.
Hence Abstract Factory is the right pattern for this problem. Choice 4 is therefore correct.
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.” Hence choice 1 is incorrect.
Builder (GOF 97)”Separate the construction of a complex object from its representation so that the same construction process can create different representations.” Hence choice 2 is incorrect.
Prototype (GOF 117)” Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.” Hence choice 3 is incorrect.
Singleton (GOF 127)” Ensure a class only has one instance, and provide a global point of access to it.” Hence choice 5 is incorrect.
229 : 5 is correct.
The key points are:
Low traffic that this site will be encountering
The fact that the data is not modified through the site. All database access is going to be for simple read-only data.
From these points we can summarize that the use of EJBs will be overkill for such a simple application. However you still do not want to embed data access logic directly into Servlets, as that would not be a very modular approach. Hence use Servlets and JSP for presentation and Java classes to encapsulate interactions with the database. Choice 5 is therefore correct.
While choice 1 is a straightforward Model2 technique for this system, the use of EJB is not required here. Hence choice 1 is incorrect. Note that if the traffic becomes much higher and they wish to migrate to an EJB solution, choice 1 would become the best candidate.
We have discussed that the use of EJB is not necessary for this application. Further there is no concurrent use of shared data. Hence Entity beans are definitely not the ideal choice. Choice 2 and 3 are therefore incorrect.
Choice 4 indicates the use of Applets and EJB. Applets are best used when better GUI capability is required. In this example, JSP is a perfectly good solution. In any case, this choice refers to the use of EJB (already discussed as extra baggage for this problem.) Hence choice 4 is incorrect.
230 : 1,4,5 & 8 is correct.
The use of JSP for presentation and Servlets for controllers is consistent with the Model 2 approach. Hence 1 is a right choice.
Choice 2 is the opposite of choice 1 and therefore incorrect.
Choice 3 is incorrect because it is suggesting the use of a Stateless Session bean for the management of the shopping cart. Since stateless beans do not maintain any conversational state, they cannot be used for this purpose.
The use of a stateless session bean for catalog retrieval is consistent with the Model 2 architecture and a recommended best practice. Choice 4 is therefore correct.
Stateful Session Beans hold conversational state. Hence the management of a shopping cart is a good example of their use. 5 is therefore correct.
Stateful Session beans are not very useful for updating order information. 6 is therefore incorrect.
Entity beans for catalog retrieval are overkill because Entity beans are best used when shared data is being concurrently accessed or heavy transactional DML statements are required. 7 is therefore incorrect.
Entity beans represent the enterprise data of a system and perform specialized DML operations like inserts, deletes and updates. They would be perfect for updating order information. 8 is therefore a correct choice.
231 : 4 is correct.
While Entity beans model business concepts, usually persisted as records in some kind of database, it is not necessary to use Entity beans every time you interact with the database. In fact from a performance point of view, simple selects and retrieval can be just as easily done using Session Beans with Data Access Objects (DAO.) Entity Beans are best used when you are dealing with concurrent access to shared data, where transactions, concurrency and integrity play a vital role. Hence choice 4 is correct.
Choice 1 refers to using existing data and performing some calculation on it. This can be best achieved through a Stateless Session Bean. Hence choice 1 is incorrect.
Choice 2 talks about maintaining conversational state. This is best dome with Stateful Session Beans. Hence choice 2 is incorrect.
Retrieval of product catalogs is a simple query. Again this can be done through Stateless Session Beans and DAO. Hence choice 3 is incorrect.
232 : 1 & 4 is correct.
Server clusters increase availability and redundancy in a system. They also provide fault tolerance. With clusters, requests can be distributed so that multiple servers share the load. Some servers may also offer the sophistication to determine which servers are under utilized so that load can be balanced. Hence choices 1 and 4 are correct.
Location Transparency is achieved through Object Distribution. This is a feature of all distributed systems. Hence choice 2 is incorrect.
Various vendors may offer a variety of tools for better resource management. Caching may be one such capability. It has nothing to do with a multi-server environment though. Hence choice 3 is incorrect.
Two phase commit (2PC) may be a feature offered by many J2EE vendors for addressing distributed transactions. Again this is not a feature of server clustering. Hence choice 5 is incorrect.
233 : 2 is correct.
Choice 2 is correct. HTTPS is a secure and stateful protocol.
Choice 1 is incorrect because HTTP is inherently stateless.
Choice 3 is incorrect because SOAP is an RPC mechanism, not a state management mechanism.
Choice 4 is incorrect because CGI programs are server side processes (comparable to Java Servlets.) They do not manage session state.
234 : 1,2 & 4 is correct.
This question deals with Internationalization. Language for messages, formats (numbers, date and so on), taxes and legal rules are all subject to Internationalization. Hence 1, 2 and 4 are correct.
Choice 3 refers to a security mechanism where a demilitarized zone is created between two firewalls and is irrelevant to I18N. RSA and MD5 are security terminology used with cryptography. Therefore choices 5 and 6 are incorrect.
235 : 2 is correct.
When the getBundle() method is called on ResourceBundle, it checks to see if a class or property file is available for the base parameter’s current locale. If neither is available, it uses the default. In this case Base.Properties will be used. Hence choice 2 is correct.
236 : 4 is correct.
Demilitarized Zone (DMZ) is an area between two firewalls. The outer firewall lets requests to publicly accessible services in. It will reject all other requests. The inner firewall will protect the company’s internal network and prevent requests coming into the DMZ from passing through it. Choice 4 is therefore correct.
Choices 1, 2 and 3 are all incorrect.
237 : 1 is correct.
This question expects you to be familiar with the changes in the Java 2 Security model. In JDK1.2 and higher, all code local and remote can be subjected to a security policy. By default, remote code will be constrained to the old Sandbox model. However if a policy file is created with grant privileges, an applet will be restricted to the grants whether or not it is signed. Hence choice 1 is correct.
238 : 1,4 & 6 is correct.
Entity Beans are subject to activation and Passivation. The container informs the bean that the bean is about to be passivated or activated through the two callback methods – ejbPassivate() and ejbActivate(). EjbStore() is a callback method used during database synchronization. EjbRemove() is called when the client wishes to remove the data the bean represents, from the database. Hence choices 1, 4 and 6 are correct.
EjbSave(), ejbRetrieve() and ejbDestroy() are not valid methods for EJBs. Hence choices 2, 3 and 5 are incorrect.
239 : 3 is correct.
Atomicity (Monson-Haefel 2nd edition 275)”To be atomic, a transaction must execute completely or not at all.” Hence choice 3 is correct.
Choice 1 refers to ‘Consistency.’ Hence it is incorrect.
Choice 2 refers to ‘Isolation.’ Hence it is incorrect.
Choice 4 refers to ‘Durability.’ Hence it is incorrect.
240 : 1 & 3 is correct.
Choice 1 describes how the transactional attributes ‘Not Supported’ and ‘Never’ work. 1 is therefore correct.
2 is the inverse of 1 and therefore incorrect.
3 describes a situation where a method with transactional attribute ‘Not Supported’ or ‘Never’ is called without a transactional scope. In this case they both behave identically. Choice 3 is therefore correct.
Choice 4 indicates that under both circumstances the method will execute identically. This is incorrect because a ‘Never’ method will throw a ‘RemoteException’ if called with a transaction. 4 is therefore incorrect.
241 : 4 is correct.
EJB 1.1 has support for undefined Primary Keys, which means that they can be deferred until deployment time. When undefined Primary Keys are used, the Bean class and its interfaces can refer to the undefined key using java.lang.Object.
Choice 1 gives some incorrect information to throw you off.
Choices 2 and 3 are incorrect because you cannot use java.lang.Enumeration or java.lang.Class for referring to undefined Primary Keys.
242 : 4 is correct.
DNS Round Robin is a method is load distribution by which a set of servers is allowed to process incoming requests in sequence. The first request goes to the first server, the second to the second server and so on. When the end is reached, the next request starts from the first server again. Hence choice 4 is correct.
Note that DNS Round Robin is a good load distribution technique, not a load balancing technique. Since requests get processed sequentially in DNS Round Robin, the current load on a server is not taken into account before a new request is delegated to a server. In load balancing techniques however, the load on individual servers is monitored before additional requests are sent to them. Hence choice 1 is incorrect.
DNS Round Robin allows servers to process requests sequentially, not in a random fashion. Hence choice 2 is incorrect.
With load balancing techniques, a load monitor may check for the current load on a primary server before deciding to delegate subsequent requests to another server. This is not true of DNS Round Robin though. Hence choice 3 is incorrect.
243 : 4 is correct.
One of the key aspects of security is encryption and decryption of data. Data encryption ensures that sensitive data will be protected against eavesdropping and tampering. A concept called ‘cryptography’ is used for accomplishing this. The two popular types of cryptography are ‘Public Key Cryptography’ or ‘Asymmetric Key Cryptography’ and ‘Symmetric Key Cryptography.’ In both forms, a combination of Cryptographic algorithms (ciphers) and hashing algorithms protect the data from intruders. The data is decrypted at the receiver’s end and becomes intelligible again. All this work results in extra overheads. Hence generally increased security results in a lower performance. Choice 4 is therefore correct.
Higher security results in lower performance. Hence choices 1 and 2 are incorrect.
A high performance is not a technical pre-requisite for secure systems although it may be a good idea to increase performance wherever possible to offset the performance loss due to higher security. Hence choice 3 is incorrect.
Many poorly engineered secure systems exhibit poor performance. Hence choice 5 is incorrect.
244 : 5 is correct.
Aggregate relationship in UML is denoted with an open diamond on one side of an association relationship. In the above diagram, class A has an aggregate relationship with Interface C. Generally this means that at runtime, class A will hold a reference to an object that implements Interface C. Hence choice 5 is correct.
The interface C does not have an association, aggregation or composition relationship with class A. Choices 2 and 4 and 6 are therefore incorrect.
If class A had a solid diamond instead of an open diamond, it would have represented a composition. Hence choice 3 is incorrect.
245 : 4 is correct.
The diagram shown above represents a Sequence diagram. A sequence diagram is an interaction diagram that shows the time ordering of events. Choice 4 is therefore correct.
246 : 2 is correct.
CORBA does not provide support for ‘Container Managed Persistence.’ CMP is a concept only supported by the EJB specification. Hence choice 2 is correct.
CORBA has support for Naming, Security, Transactions, Events and Concurrency control. Hence the other choices are incorrect.
247 : 3 is correct.
The key here is that the existing legacy system supports a CORBA interface and no new services are being currently planned. If Java code is primarily going to access CORBA services, the recommended connectivity tool is Java IDL. Java IDL gives Java code CORBA capability. Hence choice 3 is the correct answer.
RMI-JRMP should be used when dealing with distributed applications, all written primarily in Java. Hence choice 1 is incorrect.
The question does not specify anything about the legacy code’s JNI capability. However it specifically mentions about CORBA compatibility. Hence choice 2 is incorrect.
RMI-IIOP is the protocol used with EJB. The legacy system is coded with a CORBA interface and the question mentions that no new coding is anticipated. So EJBs are not a good choice for this problem. Hence choice 4 is incorrect.
When you wish to communicate with a system whose firewall does not permit requests of a certain protocol, the requests are sometimes masqueraded as HTTP requests. This concept is called HTTP tunneling. Hence choice 5 is incorrect.
248 : 5 is correct.
The following is taken from:
“The J2EE Connector architecture provides a Java solution to the problem of connectivity between the many application servers and EISs already in existence. By using the J2EE Connector architecture, EIS vendors no longer need to customize their product for each application server. Application server vendors who conform to the J2EE Connector architecture do not need to add custom code whenever they want to add connectivity to a new EIS.” Hence choice 5 is correct.
J2SE is a platform that provides”the compiler, tools, runtimes and APIs for developing, deploying and running applets and applications in the Java programming language.” Hence choice 1 is incorrect.
The following is taken from:
“Java TM Web Start — a technology for simplifying deployment of Java applications– gives you the power to launch full-featured applications with a single click from your Web browser. You can now download and launch applications, such as a complete spreadsheet program or an Internet chat client, without going through complicated installation procedures.” Hence choice 2 is incorrect.
The following is taken from:
“JDBCTM technology is an API that lets you access virtually any tabular data source from the Java TM programming language. It provides cross-DBMS connectivity to a wide range of SQL databases, and now, with the new JDBC API, it also provides access to other tabular data sources, such as spreadsheets or flat files.
The JDBC API allows developers to take advantage of the Java platform’s “Write Once, Run Anywhere TM” capabilities for industrial strength, cross-platform applications that require access to enterprise data. With a JDBC technology-enabled driver, a developer can easily connect all corporate data even in a heterogeneous environment.” Hence choice 3 is incorrect.
The following is taken from:
“The JMS API improves programmer productivity by defining a common set of messaging concepts and programming strategies that will be supported by all JMS technology-compliant messaging systems.” While you may be able to communicate with EIS systems using JMS (if the EIS supports JMS), it is not a standardized architecture for connecting to heterogeneous EIS applications. Hence choice 4 is incorrect.
249 : 1 is correct.
Sometimes when you do not want the clients of an EJB application to add data to your system, you may choose not to provide a create method in the Home Interface of the Enterprise bean. The create method is therefore optional. Hence choice 1 is correct.
250 : 1,2 & 3 is correct.
The Bean class has implementations for the methods corresponding to the methods in the Home and Remote Interfaces, and the bean’s callback methods. Hence choice 4 is correct.
251 : 3 is correct.
The valid lifecycle states of a Stateful Session Bean are Does Not Exist, Method Ready, Method Ready (in TX) and Passive. The Bean instance leaves the Method Ready state to enter the Passive State (through Passivation) or the Does Not Exist State (through removal). Hence choice 3 is correct.
Method Ready Pool is not a valid state for Stateful Session Beans because the specifications do not mandate the container to maintain a bean pool for Stateful Session Beans. Note that some containers may internally use some kind of pooling mechanism for achieving higher performance. Hence choice 1 is incorrect.
There is no Stateful State in the lifecycle of a Stateful Session Bean. Choice 2 is therefore incorrect.
Stateful Beans leave the Method Ready State to enter Does not Exist or Passive State. Hence choice 4 is incorrect.