Hi Shashi,
Go to
www.javarabbit.com Here are few questions i've noted down in a
word doc.
I'm pasting them in this mail. Hope noby curses me for such a big mail.
What are the benefits of server clustering?
When a stateful session bean is passivated, what are the actions a developer shd perform in ejbpassivate method?
During passivation, it is the developers responsibility to ensure that all open resources are closed and all non-transient non serializable fields are set to NULL. There is no need to set transient fieldsto null. They will not be serialized anyway.
When should you use CMP?
When performance is not essential and you are storing standard data types
When should you use BMP?
When performance is essential and you are storing standard data types.
When performance is essential and you are storing complex data types
When performance is not essential and you are storing complex data types.
To create an Enterprise JavaBean you need the following components:
A Home interface, A Remote Interface and a class that implements either the SessionBean or EntityBean interfaces
What is the difference between composite aggregation and normal aggregation?
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 realtionship with the body of the plane.
What are the benefits of asynchronous messaging?
Less coupling between the sender and receiver.
Network doesn't have to be available.
Does not block the sender.
ejbPassivate() is called prior to passivation.
ejbActivate() is called immediately after activation.
What does a black diamond mean in UML?
Composite Aggregation / Composition
You need to convert 8bit text to Unicode. To do this you use:
InputStreamReader
You need to convert Unicode to a O/S that requires 8bit text. To do this you use:
OutputStreamWriter
JMS provides a full implementation of classes for Messaging.
FALSE
You need to pass messages from one object to another but you need to filter out some of the messages. What pattern could you use?
Proxy
You need to replace ASP scripts. What J2EE technology do you use?
JSP/Servlets
You need to connect to a database what technology should you use?
JDBC What port number does HTTP run on?
80
What port number does JRMP run on?
1099
In a Java implementation Product object has reference to Part object.
Parts are unique to the product.
What is the relationship between Product object and Parts object?
Product object has a composition relationship with Part object
Public Customer SEcustomer extends EntityBean(){}
In the above definition, Scustomer is a/an
Remote Interface
An UML diagram has a rectangle representing class A is connected by a solid line and a solid (dark) diamond near class A from class B.
In Java implementation
Class A will have a reference to Class B
The exhibit is a representation of a/an class diagram
n a web site the page content are to be dynamically generated based on the login.
Which technology may be suitable ?
Servlets &
JSP are used to provide dynamic page content
An UML diagram has a rectangle representing class A is connected by a solid line and a open diamond near class A from class B.
In Java implementation
Class A will have a reference to Class B
Singleton pattern is categorized as
Creational pattern
In a UML diagram a rectangle representing class A is connected by a solid line and a solid (dark) diamond near class A from class B.
What does it represent?
Class A has an composition relationship with Class B
In a Java implementation Bank voucher object and Payment object validates date with a date object.
What is the relationship between voucher object and date object?
Voucher object has an aggregation relationship with date object
In a UML diagram a rectangle representing class A is connected by a solid line and a open diamond near class A from class B.
What does it represent?
Class A has an aggregation relationship with Class B
The exhibit represents a employee class, the attributes of the class are ?
In UML, the class notation has 3 compartments
The top represents the class name
The middle compartment represents the attributes
The bottom compartment represents the methods
The bottom 2 compartments are optional.
An UML diagram has a rectangle representing class A is connected by a solid line and a open diamond near class A from class B.
In Java implementation
When object A is deleted, object B is not deleted.
An UML diagram has a rectangle representing class A is connected by a solid line and a solid (dark) diamond near class A from class B.
In Java implementation
When object A is deleted, object B is deleted
1. What type of firewall will you use to the validate the application protocol of a network communication?
� a. SSL
� b. Packet Filters
� c. Stateful packet Filters
� d. Proxy
2. Which of the following is not an optional step in establishing an SSL handshake?
� a. Server side certificate validation by the client
� b. client side certificate validation by the server
� c. Generation of session keys for encryption and decryption
� d. Selection of a suitable Cipher suite for encryption by the server and the client
3. Which of the following is true about SSL
� a. SSL can be configured only on port 80
� b. SSL can be configured only on port 443
� c. SSL can be configured to work on any port above 1024
� d. None of the above
4. Which of the following are true about load balancing methods?
� a. DNS round robin method maps multiple IPs to a single host name
� b. Hardware load balancing maps multiple IPs to a single host name
� c. Hardware load balancing can potentially involve a single point of failure
� d. DNS round robin is easy to setup than hardware load balancing.
� e. DNS load balancing supports server affinity
� f. Hardware load balancing supports server affinity
5. Which of the following are true about SSL?
� a. SSL facilitates secure communication
� b. SSL is a high level protocol and sits on top of HTTP
� c. SSL is a low level protocol and sits below HTTP
� d. SSL works only with HTTP
6. Which of the following is true about aggregation and composition?
� a. Aggregation is a special type of composition
� b. Composition is a special type of aggregation
� c. Aggregation is represented in UML as a solid diamond
� d. Composition is represented in UML as a solid diamond
7. Which of the following is true about HTTP?
� a. HTTP is stateless
� b. HTTP maintains state information between requests
� c. HTTP is connectionless
� d. HTTP is connection oriented
8. In Java,
String pool is an example of which OO design pattern
� a. Abstract Factory
� b. Builder
� c. Facade
� d. Flyweight
9. Select the correct sentences from below
� a. In the mediator pattern the individual Objects participating in the collaboration maintain direct references to each other
� b. Facade pattern is used to provide a simple interface to a subsystem comprising of a large number of objects.
� c. Memento pattern preserves Encapsulation boundaries whil exposing an object's internal state
� d. State pattern is used for operations that have large number of conditional statements based on the Object's state
10. Windoze Inc has the following application scenario. There is a CORBA based Enterprise Information System that generates XML based reports from the data in the backend Database storage. The application middle tier comprises of CGI and Perl scripts that are responsible for transforming the XML based report into a user-readable HTML format. The requests for the web pages come from outside users over the internet. Which of the following J2EE technology will be most suited for designing the application middleware?
� a. Use EJB and servlets/JSP
� b. Use JDBC and Servlets/JSP
� c. Use Servlets/JSP
� d. All of the above
11. Which of the following are true about UML modeling?
� a. UML permits representation of only ternary relationships between classes
� b. UML permits representation of n-ary relationships between classes and 'n' can be any arbirary number
� c. UML is a proprietary standard
12. Which of the following are true about encryption techniques?
� a. Most commercial security products use the Prime Number Factorization techniques for generating the public and private key pairs
� b. Public key cryptography is a more process intensive operation than symmetric key cryptography
� c. Elliptic curve cryptography techniques require smaller encryption keys than that required for prime factorization, to provide an equivalent degree of Encryption strength
� d. Elliptic key cryptography technique is a time tested method of encryption.
13. Which of the following are true about the Observer pattern ...
� a. The subject is the publisher of the message and the Observer is the subscriber of the message notification
� b. Observers can be dynamically added.
� c. The Observer pattern supports broadcast communications
� d. It promotes loose coupling between senders of messages and receivers of messages during communication
� e. None of the above
14. An Iterator pattern provides which of the following features.
� a. Access to an Aggregate object's contents
� b. Multiple traversals of aggregate objects
� c. an uniform interface for traversing different aggregate structures through
polymorphism � d. all of the above
� e. none of the above
15. Which of the following is used for deferring creation of expensive objects?
� a. Proxy
� b. Abstract Factory
� c. Abstract method
� d. Builder
16. Which of the following are true about the Primary Key class in Entity EJB?
� a. It is used for identifying an Entity BEan according to the Bean type, remote interface and Container Context
� b. It is used for identifying an Entity BEan according to the Bean type, home interface and Container Context
� c. The definition of the Primary Key can be deferred until deployment
� d. The primary key should override the equals() and hashCode() methods of the Object class
� e. The primary key class cannot define constructors
17. In CMP Entity Beans, which of the following statements is true?
� a. The Entity Bean Class should not define any constructors
� b. The Entity Bean class must define a no-argument constructor
18. The home interface associated with an Entity Bean
� a. must declare at least one create() method
� b. May not declare any create() methods
� c. must declare the findByPrimaryKey() method
� d. May not declare any finder methods
19. When is ejbStore() invoked?
� a. Immediately before the container reads the Bean's state information.
� b. Immediately after the containter reads the BEan's state information
20. When is ejbLoad() invoked?
� a. Immediately before setting the Bean's state information.
� b. Immediately after setting the Bean's state information
21. A CMP bean ...
� a. must provide only an empty implementation of ejbStore() and ejbLoad() methods
� b. May provide a concrete implementation of the ejbStore() and ejbLoad() methods
22. In EJB, What type of exception is thrown when a system error occurs ?
� a. EJBException
� b. RemoteException
� c. Exception
� d. BeanException
23. In EJBs, Which of the following are application exceptions?
� a. NullPointerException
� b. ObjectNotFoundException
� c. CreateException
� d. IndexOutOfBoundsException
� e. None of the above
� f. All of the above
24. Is ejbPassivate() invoked by the container when ejbRemove() is invoked?
� a. true
� b. false
25. Windoze Inc, is planning to implement an Enterprise wide integration of all their applications. They have chosen to apply the Hub-and-Spoke model of Enterprise Integration, where a central hub will facilitate all information sharing between applications, in the form of documents. Applications can post and receive documents to this central hub. Each application will register themselves with this central hub through an administrative interface. The Central hub sends notifications to the registered applications when a specific document of interest, arrives at the hub. The application upon receiving the notification may choose to download the documents. What is the most appropriate J2EE technology that can be used to implement this Enterprise Integration.
� a. Model the central hub as a mail server and the individual applications as JavaMail clients.
� b. Model the central hub as a JMS provider and individual applications as JMS clients. Use a publish-subscribe messaging domain.
� c. Model the central hub as a JMS provider and individual applications as JMS clients. Use a point-point messaging domain.
� d. Model the central hub as a Session Bean and individual applications as EJB clients.
26. MicroSucks Corp is planning to implement web based data entry application to collect information from business partners. The data received is to be transformed to a pre-defined format and dispatched from the web tier to a protected backend mail service (behind the firewall) over SMTP How will you design the web tier for this application using J2EE technology?
� a. Use Servlets/JSP to provide the user interfaces and accept data from the user over HTTP. Use Java classes to transform the data received from the user. Use JavaMail clients to dispatch the transformed data to the backend mail server.
� b. Use Session Beans to transform the incoming data. Use
applets to communicate with the EJB tier over RMI-IIOP, at the client tier. Use JavaMail clients to dispatch the transformed data to the backend mail server.
� c. Use applets to perform the data transformation and generate a flat file at the client, after accepting data input from the user. The user can directly email this flat file to the backend mail server through a third-party email client
27. In EJBs, Which two callback methods can be used for synchronizing the bean's state with the database
� a. ejbStore() and ejbLoad()
� b. ejbActivate() and ejbPassivate()
� c. ejbStore() and ejbPasivate()
� d. ejbLoad() and ejbActivate()
28.Which type of EJBs are ideal to model multiple rows of read-only data?
� a. Entity Beans
� b. Session Beans
29. When does an Entity Bean transition from Pooled State to Ready state
� a. when create() is invoked on EJBHome
� b. when a find method is invoked on EJBHome
� c. when a BEan is activated by the container
� d. when a BEan is passivated by the container
30. When is unsetEntityContext() invoked on an Entity bean?
� a. When the entity bean is to be garbage collected
� b. After an entity bean is garbage collected
� c. after the finalize() method has been invoked on the EntityBean
� d. None of the above
31. In EJB the timeout property is defined in the deployment descriptor.
� a. True
� b. False
32. Which of the following events happen after a stateless session bean times out or when a remove() operation is invoked?
� a. the remote reference held by the client is invalidated
� b. the bean instance is destroyed
� c. None of the above
� d. All of the above
33. The create() method in the Home Interface of a Stateless Session Bean may contain arguments?
� a.true
� b.false
34. Which of the following is true about the remove(Object primaryKey) method of the EJBHome interface with respect to a stateless session bean?
� a. If the remove(Object primaryKey) is invoked on a stateless session bean the container ignores the method call.
� b. If the remove(Object primaryKey) is invoked on a stateless session bean the container throws a remote exception
� c. remove(Object primaryKey) is a perfectly valid operation for a stateless session bean
� d. The EJBHome of a stateless session bean does not have a remove(Object primaryKey) method definition
35. When does the ejbPassivate() method get invoked on a stateless bean
� a. Immediately after servicing a client request
� b. When the bean instance is transitioned from Method ready state to does not exist state
� c. ejbPassivate() is never invoked on a stateless session bean
� d. None of the above
36. Is the SessionContedt and JNDI ENC available to the bean instance during ejbREmove() operation?
� a. true
� b. false
37. Stateless Session beans are lightweight objects and offer good performance in comparison with Stateful session beans.
� a. True.
� b. False
� c. Depends on the implementation of the EJB container
� d. Depends on the implementation of the EJB server
38. Which type of EJB is ideal for application such as report generation and batch processing?
� a. entity beans
� b. Stateless session beans
� c. stateful session beans.
� d. all of the above
� e. none of the above
39. In Stateless session beans, the clean up code for resources such as connections,etc should be coded in which of the following methods?
� a. ejbRemove()
� b. ejbPassivate()
� c. ejbRemove() and ejbPassivate()
� d. ejbDestroy()
40. Blue Screen of Death Inc has an old order entry system that is part an integrated suite of ERP modules. In this system the business logic surrounding the Order Entry Process is encapsulated as database Stored Procedures. The company wants to web enable this Order Entry System so that their customers can search through the products catalog and place orders over the internet. Assuming that the ERP's RDBMS supports JDBC compliant drivers, how will you propose to implement a solution for this initiative using J2EE technology?
� a. Use Servlet and JSP for generating the web interfaces. Use Entity Beans to represent the business entities. Rewrite the business logic of the backend database stored procedures as Session Beans.
� b. Use Servlet and JSP for generating the web interfaces. Use Session Beans to represent the business entities. Encapsulate the business logic using Entity beans but reuse the Backend stored procedures through JDBC.
� c. Use Servlet and JSP for generating the web interfaces. Use Entity Beans to represent the business entities. Encapsulate the business logic using SEssion beans but reuse the Backend stored procedures through JDBC.
� d. Use Servlet and JSP for generating the web interfaces. Use Entity Beans to represent the business entities. Invoke JDBC calls directly from the servlet to communicate with the ERP's database
Which of the following patterns promotes loose coupling by keeping objects from referring to each other explicitly, & it lets u vary their interaction immediately.
Mediator
A computer assembler assembles computer with the combination of 1 CPU, one memory size, one hard disk. available types of cpu's are 1GHz,2GHz,3GHz.
available hard disks are 40GB,80GB,100GB. available memory sizes are 1GB,2GB,3GB.
customer has to choose one cpu,memory & hard disk etc.
what pattern is suitable for this?
answer is builder pattern.
1. Which of the following is true about the requirements of a banking system?
A. The need for security is a classic example of a functional service level requirement, and a
checking account rule is an example of non-functional requirement.
B. Security and the mandatory checking account both illustrate functional service level
requirements.
C. Neither security nor the mandatory checking account is an example of any kind of
requirement, theoretically speaking.
D. Security is an architectural non-functional requirement and the mandatory checking
account a functional design requirement.
E. They are both examples of business use cases.
2. Which of the following are non-functional requirements?
A. Scalability, availability, extensibility, manageability, and security
B. Performance, reliability, elaboration, transition, documentation, and security
C. Specification, elaboration, construction, transition, use cases, and security
D. Performance, availability, scalability, and security
E. Reliability, availability, scalability, manageability, and security
3. Which of the following is the most important item that should be considered when designing
an application?
A. Scalability
B. Maintainability
C. Reliability
D. Meeting the needs of the customer
E. Performance
F. Ensuring the application is produced on time and within budget
4. Your have been contracted by a company to help them improve the performance of their
e-commerce application. You have suggested that the hardware on which the application is
currently deployed (two web servers and a database server) be migrated to three web servers, an
application server, and a database server (all on different machines.) You assure them that all
the required software rewrites will be worth it in the long run. What are the characteristics of
your suggested architecture?
A. Fat clients
B. Thin clients
C. Good separation of business logic
D. Good scalability
E. Poor separation of business logic
F. Poor scalability
G. There is no difference in the separation of business logic.
Chapter 2: Common Architectures and Protocols 57
58 Sun Certified Enterprise Architect for J2EE Study Guide
SELF TEST ANSWERS
Given an Architecture Described in Terms of Network Layout, List Benefits
and Potential Weaknesses Associated with It
1. D is correct. Successful software architecture deals with addressing the non-functional
service level requirements of a system. The design process takes all functional business
requirements into account. Security is considered a non-functional requirement and specific
business rules, such as the one described for the checking account, are considered functional
requirements. Choice D is the only choice that accurately describes this.
A, B, and D are not true. Choice A is incorrect because the functional and non-functional
requirements are switched. Choice B is incorrect because only one of them is a functional
requirement. Choice C is incorrect because, as described above, one of them is a functional
requirement and the other, a non-functional requirement. Finally, Choice E is incorrect
because business analysis may start with use cases.
2. D is correct. The non-functional service level requirements discussed are performance
(I: The system needs to respond within five seconds); availability (II: The system needs to have a
99.9 percent uptime); scalability (III: An additional two hundred thousand subscribers will be
added.); and security (VI: HTTPS is to be used.) Hence, choice D is correct
A, B, and C are incorrect. There is no mention of extensibility (ability to easily add or extend
functionality) and manageability (ability to monitor the health of the system.) Hence, choice A is
incorrect. Specification, elaboration, construction, transition, documentation, and use cases are
not non-functional service level requirements. Hence, choices B and C are incorrect. While
scalability and reliability may be related (Will the system perform as reliably when more users
operate on it?), there is no mention of reliability in the question. Hence, choice E is incorrect.
3. Dare correct. The most important consideration when designing an application is that it meets the
needs of the customer.
A, B, and C are incorrect. Ensuring the application is produced on time and within budget is
something that should be done but it is not the number one concern. The application does not have
to be the best possible solution under the circumstances. As long as it meets the customer�s needs, it is
considered adequate. All of the other considerations are secondary to meeting the customer�s needs.
4. B, C, and D are correct. The system you have suggested they migrate to is a three-tier
system. The characteristics of a three-tier system are thin clients, good separation of business
logic and good scalability. This is due to the fact that each tier is separate from the other (for
example, it would be possible to change the data store without affecting the business logic).
A, D and E are incorrect. Choice A is incorrect; the suggested system has thin clients, the
business logic residing on the application server, in the middle tier. Because there is a good
separation of business logic, choices E and G are incorrect. Choice F is incorrect as the
three-tier nature of the system makes it very scalable.
ArchitectureProsCons
One tierSimpleVery high performanceSelf-containedNo networking -- can't access remote servicesPotential for spaghetti code
Two tiersClean, modular designLess network trafficSecure algorithmsCan separate UI from business logicMust design/implement protocolMust design/implement reliable data storage
Three tiersCan separate UI, logic, and storageReliable, replicable dataConcurrent data access via transactionsEfficient data accessNeed to buy database productNeed to hire DBANeed to learn new language (SQL)Object-relational mapping is difficult
N tiersSupport multiple applications more easilyCommon protocol/APIQuite inefficientMust learn API (CORBA, RMI, etc.)Expensive productsMore complex; thus, more potential for bugsHarder to balance loads
Active Replication : each replica is identical to the main service and attempts to service each request.
An interceptor is used to block extra responses. [ Hot Backups]
Passive Replication : the primary service handles all requests. The state of the replicas is periodically synchronized.
In the event that the primary service fails, one of the replicas takes over after its state is
synchronized [Warm Backups].
The above 2 are fault tolerance techniques.
Use of VO's are ok for both beans but use of DAO's are better suited for BMP beans.
Reverse proxy load balancing is A technique used to target certain requests to certain backend servers, e.g. All Servlet requests from one server. All static HTML from another.
Reverse proxy load balancing is generally used when you have servers with different amounts of CPUs and Memory. You might use powerful servers for SSL sessions and others tohandle static html.
Because person assembles whole from parts - that's what builder for.
Abstract factory is about creating families of related products. It could fit here if, for example, statement had mentioned accessory compatibility issues.
Object mapping as in Object Relational Maping means that list of Business Entities (in Raw term its DB table)are mapped to the Business Objects (again its java class).
Reasons for doing that could be automatic persitance. but in context of Legacy systems, it means a technique by which the wrappers are build around legacy code to provide object interface which can be used by connecting clients....its better than Screen Scraper but needs access to Source code.
One of the tools for example Hibernate does this useing set of .xmls where one maps which java file and what table. (attributes-fields ..etc)
Isomorphic means that one can be used to transform into another. So Interaction Diag's are Isomorphic.
I don't think that you have to go at this level of details.There're many clustering strategies for scalability and availability:
Clustered pairs
Two-node clusters
Ring
Scalable (N-to-N)
N+1 (Star)
Usually, you select your clustering strategy after load tests. This strategy depends also of your architecture(local vs distributed) and your hardware. (one or more servers).
For a local architecture and one server,one scenario may be: 3 J2EE server instances at 60% max capacity (weighted load balancing strategy), each running in its server domain, le first and the second for scalability, the third (active or in stand by) for availability (star strategy)