OCMJEA Mock Exam -1

1 . Which of the following are true about Active Replication?

  1. It is a fault-tolerance mechanism
  2. It is achieved by taking cold back ups
  3. Each replica attempts to process each request but extra calls may be intercepted via an interceptor
  4. State changes are logged and periodically flushed to the replicas
  5. State is synchronized only when the primary service fails
  6. Each replica is identical to the main service

2 . Which of the following are benefits of Server Clustering?

  1. Replication
  2. High Security
  3. Easy Manageability
  4. Load Balancing
  5. Fault Tolerance

3 . Refer to the following diagram?

Choose the one below:

  1. Class D implements Class C
  2. Class C implements Class D
  3. Interface C implements Class D
  4. Interface D implements Class C
  5. Class D implements interface C

4 . Which of the following are true about Passive Replication?

  1. Primary Service and all replicas respond to all requests
  2. Primary Service randomly delegates requests to one of the secondary replicas
  3. Primary service handles all requests
  4. State is periodically synchronized between the Primary service and all replicas
  5. It is similar to hot backup
  6. It is similar to Warm Backup

5 . CORBA is a standard for?

  1. Messaging using virtual channels called Queues
  2. Standardized development practices
  3. Messaging using virtual channels called topics
  4. Accessing distributed object systems in many platforms and languages
  5. Accessing Distributed object systems based only on Java Technologies

6 . RMI-IIOP does not provide which of the following capabilities?

  1. Remote Method Invocation
  2. Stub Downloads
  3. Objects pass by value (state only)
  4. Distributed Garbage Collection

7 . Which of the following are not true about Screen Scrapers?

  1. Screen scrapers function as Terminal Emulators on one end and as Object Interfaces on the other
  2. Screen Scraping may be a useful tool when used in conjunction with the off-board servers
  3. Changes to legacy UI has little or no impact on the new GUI
  4. Screen Scraping is best used when the legacy clients have loose coupling with other tiers

8 . Which of the following methods may be present in the Home Interface of an Entity Bean?

  1. create()
  2. findByPrimaryKey()
  3. remove()
  4. locateByPrimaryKey()
  5. retrieveBean()

9 . Undefined Primary Keys refers to?

  1. Refers to Entity Beans that do not use Primary Keys
  2. Primary Keys that are defined during development
  3. Primary Keys that remain undefined until the bean is deployed
  4. Entity Beans cannot have undefined Primary Keys

10 . Which of the following are valid life cycle states for a Stateless Session Bean?

  1. Does not Exist
  2. Pooled State
  3. Method Ready Pool
  4. Passive

11 . Both CMT and BMT may be used with Entity and Session Beans? True or False?

Choose the one below:

  1. True
  2. False

12 . A session bean called SomeBean has a method called someMethod(), which calls someOtherMethod (same bean) followed by someOtherBeanMethod() of SomeOtherBean. SomeOtherBean is an Entity Bean with CMT?
Which of the following is true?

Choose the one below:

  1. SomeOtherBean has no control on the transaction since it is a CMT bean
  2. SomeOtherBean has full access to the UserTransaction object through which it can control the transaction
  3. SomeOtherBean has access only to the transaction methods in EJBContext, which gives it the power to veto transactions
  4. SomeOtherBean has access on the transaction only if the method had RequiresNew set as its transaction attribute

13 . Which of the following is not a resource management technique?

  1. Maintaining a smaller pool of Stateless Beans to serve a large number of clients
  2. Providing Database Connection Pooling
  3. Persistence of Entity Beans
  4. Passivation of Stateful Beans

14 . Which of the following are invalid states in the life of a Stateful Session Bean?

  1. Does Not Exist
  2. Method Ready Pool
  3. Method Ready in Transaction
  4. Method Ready
  5. Ready
  6. Pooled
  7. Passive

15 . What is the sequence of steps in the life cycle of a Stateless Session Bean?

  1. class.newInstance(), setSessionContext (ctx), ejbCreate()
  2. ejbCreate(), setSessionContext (ctx), class.newInstance()
  3. class.newInstance(), ejbCreate(), setSessionContext (ctx)
  4. setSessionContext (ctx), ejbCreate(), class.newInstance()

16 . HTTPS is defined as?

  1. HTTP with Security
  2. HTTP on secure line
  3. HTTP over SSL
  4. HTTP with SSL

17 . HTTP is?

  1. Connection Less
  2. Connection Base
  3. Stateful
  4. Stateless
  5. Secure

18 . Asynchronous communication is achieved by using?

  1. Remote Procedure Calls
  2. RMI/IIOP
  3. Message Oriented Middleware
  4. CORBA

19 . Which of the following is not part of the Messaging architecture?

  1. Decentralized messaging using IP Multicasting
  2. Decentralized messaging using Secure Sockets Layer (SSL)
  3. Use of virtual channels called Queues
  4. Use of virtual channels called Topics

20 . In P2P, clients send messages to?

  1. A designated queue
  2. Multiple Queues
  3. A specific node for redistribution to subscribers
  4. CORBA compliant ORB

21 . Happy Joe Banking Corporation is building a Banking application to provide online access to their account holders. They have chosen 2 SUN 450s for their web server cluster and 1 SUN E10000 for their application server. The business requirements indicate that to become a customer, a person must have at least a primary checking account with the bank. Further since the customer will be using the Internet to view confidential information, security is considered paramount?

What do you understand about the requirements of the system?

Choose the one below:

  1. The need for Security is a classic example of a functional service level requirement and the checking account rule, an example of non-functional QoS requirement
  2. The discussion about Security and the mandatory checking account both illustrate functional service level requirements
  3. Neither Security nor the mandatory Checking Account is an example of any kind of requirements, theoretically speaking
  4. Security is an Architectural non-functional requirement and the Mandatory Checking Account a functional design requirement
  5. They are both examples of Business Use Cases

22 . In an interview between the senior management of Happy Joe Banking Corporation and the J2EE application architect Scott Khosla?

The following points were discussed:

  1. The system needed to respond within 5 seconds
  2. The system is needed to have a 99.9% uptime
  3. HJBC was in the process of acquiring another bank which would add two hundred thousand customers to their already existing half million
  4. Each phase of the SDLC was to have a clear sign off process
  5. The development team was expected to provide a detailed unit test plan and user documentation
  6. In order to ensure privacy, HTTPS was to be used

23 . What non-functional requirements were discussed?

  1. Scalability, Availability, Extensibility, Manageability and Security
  2. Performance, Reliability, Elaboration, Transition, Documentation and Security
  3. Specification, Elaboration, Construction, Transition, Use Cases and Security
  4. Performance, Availability, Scalability and Security
  5. Reliability, Availability, Scalability, Manageability and Security

24 . N-tier applications show better performance than 2-tier applications because they are modular in nature, which means that they can be scaled easily, by tuning components and containers individually?

True/False ?

Choose the one below:

  1. True
  2. False

25 . Moon Microsystems has a web-based solution that was originally built using Servlets. However, in recent months, the IS manager has asked developers to use JSP technology with Java Scriptlets embedded in HTML code. Scott Khosla, the architect, however is insisting that the code be modularized and that EJBs be used instead of Servlets and JSP for business logic processing. In asking developers to modularize existing code?
what software development technique is Scott asking the developers to follow?

Choose the one below:

  1. Code Break up
  2. Code engineering
  3. Code Tiering
  4. Code Factoring

26 . Refer to the following exhibit?

In UML,

Choose the one below:

  1. (i) represents an object and (ii) a class
  2. (ii) represents a package and (i) a class
  3. (i) represents a class and (ii) an object
  4. (i) and (ii) both represent components

Answers

1 : 1,3 & 6 is correct. 
Explanation:
Active Replication is a fault tolerance mechanism where each replica is identical to the main service and attempts to service each request. An interceptor is used to block extra responses. Active replication is similar in concept to Hot Backups. Hence choices 1, 3 and 6 are correct.

Active Replication is not achieved through cold backups. In cold backups, the replicas are not constantly updated. Their state is synchronized with the primary service in regular intervals. In the event that the primary service fails, one of the replicas has to be synchronized (perhaps with data from a storage device) before it can service requests. Hence choice 2 is incorrect.

Choice 4 refers to the concept of Warm Backus. In warm backups, only the primary service responds to requests. However all activity is constantly logged. Periodically these logs may also get flushed to the replicas. When the primary service fails, a replica takes over after its state is synchronized with the logs. Hence choice 4 is incorrect.

With active replication, as mentioned before, the state of all replicas is constantly synchronized. Hence choice 5 is incorrect.

2 : 1,4 & 5 is correct. 
Explanation:
Through the use of replicas, server clusters increase the reliability and availability of a system. They provide a fault tolerance mechanism with load distribution and load balancing capabilities. Hence choices 1, 4 and 5 are correct.

J2EE applications offer security features through Identification, Authentication and Authorization mechanisms. In addition they also provide APIs that allow secure communication, encryption of messages and so on. This is not a feature of server clusters though. Hence choice 2 is incorrect.

Managing multiple servers is always a harder than managing just one server. Hence easy manageability may not always be true with distributed platforms. With J2EE, due to clear roles and responsibilities of tiers and layers, applications may be relatively easier to manage than other distributed systems. However manageability is not the best asset of distributed systems. Hence choice 3 is incorrect.

3 : 5 is correct. 
Explanation:
In the diagram, A and B are classes, C is an interface and D is a class that implements C. Hence Choice 5 is correct.

Choice 1 is incorrect because <<Interface>> C is not a class and you can only extend classes, not implement them. Choice 2 is the reverse of choice A but again incorrect because C is an interface, not a class.

Choice 3 is incorrect because it claims that the interface C implements class D, whereas in reality class D implements interface C.

Choice 4 is incorrect because it claims that D is an interface. And C is a class, while it is the other way round.

4 : 3,4 & 6 is correct. 
Explanation:
In 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 (with log files, for example.) In concept, passive replication is similar to that of Warm Backups. Hence choices 3, 4 and 6 are correct.

Only in Active Replication, the primary service and all replicas respond to all requests. Hence choice 1 is incorrect.

Choice 2 seems to indicate that Passive replication uses some kind of load distribution mechanism. Hence choice 2 is incorrect.

Passive replication is similar to warm backups as opposed to active replication, which is similar to hot backups. Hence choice 5 is incorrect.

5 : 4 is correct. 
Explanation:
Common Object Request Broker Architecture (CORBA) is a standard for distributed communication involving applications written using different languages. Hence choice 4 is accurate.

Queues are the mechanism by which two parties communicate in a Point-to-Point asynchronous messaging paradigm. Hence choice 1 is incorrect.

Choice 2 indicates that CORBA is a methodology, as opposed to a standard and is incorrect.

Topics are the mechanism through with Publish Subscribe messaging is accomplished. Choice 3 is incorrect.

Although choice 5 talks about distributed object systems, it is referring to pure Java objects. CORBA is used object distribution involving different languages. Hence choice 5 is incorrect.

6 : 2 & 4 is correct. 
Explanation:
RMI-IIOP does not support Stub downloads and distributed garbage collection. Hence choices 2 and 4 are correct.

Both Remote Method Invocation and Objects pass by value are supported by RMI-IIOP. Hence choices 1 and 3 are incorrect.

7 : 3 & 4 is correct. 
Explanation:
When using screen scrapers, any changes to the legacy user interface will also affect the new GUI. Also screen scraping is the best alternative only if the existing UI is very tightly coupled with the business tier of the legacy application. Hence choices 3 and 4 are false and therefore the correct choices.

Choices 1 and 2 are true about screen scrapers and hence incorrect.

8 : 1,2 & 3 is correct. 
Explanation:
The Home Interface provides methods for creation, location and removal of beans. Hence you could find create(), findByPrimaryKey() and remove() methods in the bean’s Home Interface. Choices 1, 2 and 3 are therefore correct.

There are no methods like locateByPrimaryKey() and retrieveBean() in the Home Interface. Hence choices 4 and 5 are incorrect.

9 : 3 is correct. 
Explanation:
One problem with container-managed persistence in EJB 1.0 was that the bean developer had to define the primary key during development. This forced the developer to make assumptions thus limiting the bean’s portability across databases. EJB 1.1 allows the primary key to remain undefined until deployment. Hence choice 3 is correct.

Choice 1 is incorrect because all entity beans must have a serializable primary key that can be used to uniquely identify an entity bean in the database.

Undefined Primary Keys are not defined during development. Hence choice 2 is incorrect.

Choice 4 is incorrect because it indicates that Entity Beans are not allowed to have undefined Primary Keys. This was true in EJB1.0 but not in EJB1.1.

10 : 1 & 3 is correct. 
Explanation:
The two valid states in a Stateless Session Bean’s life cycle are ‘Does Not Exist’ and ‘Method Ready Pool.’ When Beans are not instantiated they are said to be in the ‘Does Not Exist’ state. Beans transition from ‘Does Not Exist’ to ‘Method Ready Pool’ when instantiated. The container does this automatically, as needed. Hence choices 1 and 3 are correct.

Pooled and Passive are not valid states in the lifecycle of a Stateless Session Bean. Hence choices 2 and 4 are incorrect.

11 : 2 is correct. 
Explanation:
With EJB1.1 only Session Beans with <transaction-type> equal to ‘Bean’ can have bean-managed transactions. Entity Beans are not allowed to be BMT beans. Hence choice 2 is correct.

12 : 3 is correct. 
Explanation:
Only BMT beans have access to the User-Transaction from the EJBContext. The EJBContext provides the methods setRollbackOnly() and getRollbackOnly(), to provide CMT beans access to the transaction. The setRollbackOnly() method gives a bean the power to veto a transaction. Hence choice 3 is correct.

Choice 1 is incorrect because the entity bean has the capability to veto the transaction.

Choice 2 is incorrect because CMT beans only have the power to veto user transactions.

Choice 4 makes an incorrect argument and is thus wrong.

13 : 3 is correct. 
Explanation:
Persistence of Entity beans is the ability to save data represented by the bean into a database. It is not a resource management technique. Choice 3 is false and therefore correct.

Maintaining a smaller number of beans to serve a larger number of clients is a very clever resource management technique. It is also an example of the Flyweight Design Pattern. Choice 1 is thus a resource management technique and therefore incorrect.

Database connection pooling, a similar concept as bean pools, is also a good resource management technique. Choice 2 is therefore incorrect.

With Stateful Session Beans, the container uses passivation to manage memory. In passivation the state of the bean is serialized and its memory freed up for reuse by other services. Hence bean passivation is a memory management technique making choice 4 incorrect.

14 : 2,5 & 6 is correct. 
Explanation:
The valid life cycle states of a Stateful Session Bean are ‘Does Not Exist’, ‘Method Ready’, ‘Method Ready in Transaction’ and ‘Passive’. ‘Method Ready Pool’ is a life cycle state of Stateless Session Beans. ‘Pooled’ and ‘Ready’ are life cycle states of Entity Beans. Hence choices 2, 5 and 6 are correct.

15 : 1 is correct. 
Explanation:
When Stateless Session Beans transition from ‘Does Not Exist’ to ‘Method Ready Pool’, the container invokes newInstance(), setSessionContext() and ejbCreate() methods. Hence choice 1 is correct.

Although choices 2, 3 and 4 have the same methods, the order in which they appear to be called is wrong. Therefore choices 2, 3 and 4 are incorrect.

16 : 3 is correct. 
Explanation:
HTTPS stands for HTTP over SSL. With HTTPS, SSL sits above the TCP-IP layer and below the application protocol layer. Hence choice 3 is correct.

17 : 2 & 4 is correct. 
Explanation:
HTTP (HyperText Transfer Protocol) is a transport mechanism for MIME (Multipurpose Internet Mail Extensions) documents. MIME documents often contain HTML (HyperText Markup Language) code for display in browser windows. HTTP consists of a request sent by the client to the server, followed by a response sent from the server back to the client. HTTP uses TCP/IP as the underlying transport and network protocols.

The following is taken from:

http://www.w3.org/Protocols/Activity.html

“Whenever a client accesses a document, an image, a sound bite etc. HTTP/1.0 creates a new TCP connection and as soon as it is done, it is immediately dismissed and never reused.”

“HTTP/1.1 fixes this in two ways. First, it allows the client to reuse the same TCP connection (persistent connections) again and again when talking to the same server. Second, it makes sure that the courier carries as much information as possible (pipelining) so that it doesn’t have to run back and forth as much. That is, not only does HTTP/1.1 use less TCP connections, it also makes sure that they are better used. The result is less traffic jam and faster delivery.”

The following is taken from:

http://www.w3.org/Protocols/HTTP/HTTP2.html

“HTTP is a protocol with the lightness and speed necessary for a distributed collaborative hypermedia information system. It is a generic stateless object-oriented protocol, which may be used for many similar tasks such as name servers, and distributed object-oriented systems, by extending the commands, or ‘methods’, used.”

Hence choices 2 and 4 are correct. Since choices 1 and 3 are the opposite, they are incorrect.

HTTP can be made secure by using ‘HTTP over SSL’ or HTTPS. But by itself, HTTP is not secure. Hence choice 5 is incorrect.

18 : 3 is correct. 
Explanation:
Message Oriented Middleware or MOM is used for asynchronous messaging between applications. Most popular implementations support Point to Point (one to one) and Publish Subscribe (one to many) messaging. Hence choice 3 is correct.

Remote Procedure Calls are used for synchronous communication between applications. CORBA and RMI/IIOP are two protocols that support RPC based communication. Hence choices 1, 2 and 4 are incorrect.

19 : 2 is correct. 
Explanation:
Only choice 2 is not a standard paradigm in messaging architecture. Hence choice 2 is correct.

IP Multicasting can be used as a technique for decentralized messaging. Queues and Topics are used with Point to Point and Publish Subscribe messaging. Hence choices 1, 3 and 4 are incorrect.

20 : 1 is correct. 
Explanation:
P2P or Point to Point messaging is used for one to one communication between two components or applications. In the P2P model, message producers send messages to a designated queue. Hence choice 1 is correct.

Although it is possible to mimic Publish Subscribe architecture by sending P2P messages to multiple queues, it is not a standard practice. Hence choice 2 is incorrect.

In Publish Subscribe architecture, messages are sent to a specific node for redistribution to subscribers. Hence choice 3 is incorrect.

CORBA is an RPC protocol and is not used for asynchronous messaging. Hence choice 4 is incorrect.

21 : 4 is correct. 
Explanation:
Successful software architecture deals with addressing the non-functional service level requirements of a system. The Design process takes all the functional business requirements into account. Security is considered a non-functional requirement and specific business rules, such as the one described with the checking account are considered functional requirements. 4 is the only choice that accurately describes this.

1 is incorrect because the functional and non-functional requirements are flipped over.

2 is incorrect because only one of them is a functional requirement.

3 is incorrect because as described above, one of them is a functional requirement and the other, a non-functional requirement.

Finally 4 is incorrect because business analysis may start with use cases (where the checking account rules may be captured), but this discussion is specifically questioning functional vs. non-functional requirements.

22 :

23 : 4 is correct. 
Explanation:
The non-functional service level requirements discussed are Performance (system needs to respond within 5 seconds), Availability (system is needed to have a 99.9% uptime), Scalability (additional two hundred thousand subscribers), and Security (HTTPS is to be used.) Hence choice 4 is correct.

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 1 is incorrect.

Specification, Elaboration, Construction, Transition, Documentation and use cases are not non-functional service level requirements. Hence choices 2 and 3 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 5 is incorrect.

24 : 1 is correct. 
Explanation:
N-Tier applications (especially those based on J2EE) are designed to be very modular in nature. The tiers and layers separate roles and responsibilities of each component and container. Hence components and containers can be individually targeted and scaled as needed. This results in better performance. Hence choice 1 is correct.

25 : 4 is correct. 
Explanation:
Software applications have a tendency to grow in complexity over time. When that happens, they become difficult to extend, maintain and modify. They also become hard to understand.

Code factoring is a modularization technique that deals with the separation of responsibilities in code. Factored code has loose coupling and minimal dependencies, making components and code more reusable. Hence choice 4 is correct.

There are no concepts like code break up, code engineering or code tiering. Hence choices 1, 2 and 3 are incorrect.

26 : 3 is correct. 
Explanation:
In the above diagram Aclass represents a class and: Aclass represents an object. Hence choice 3 is correct.

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*