Computer Associates Papers: Sample Questions 8 - 9 of 18

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 8

» Scripts- Server Side » JSP

Appeared in Year: 2004

MCQ▾

Question

Which of the following cannot be used as the scope when using a JavaBean with JSP?

Choices

Choice (4) Response

a.

Application

b.

Session

c.

Request

d.

Response

Answer

d.

Explanation

Scope: represents the scope of the bean. It may be page, request, session or application. The default scope is page.

  • Page: specifies that you can use this bean within the JSP page. The default scope is page.

  • Request: specifies that you can use this bean from any JSP page that processes the same request. It has wider scope than page.

  • Session: specifies that you can use this bean from any JSP page in the same session whether processes the same request or not. It has wider scope than request.

  • Application: specifies that you can use this bean from any JSP page in the same application. It has wider scope than session.

So, response cannot be used as the scope when using a JavaBean with JSP.

Question number: 9

» Scripts- Server Side » JSP

Appeared in Year: 2004

MCQ▾

Question

How multiple EJB instances are managed?

Choices

Choice (4) Response

a.

EJB Passivation

b.

Caching of EJB instances

c.

Connection Pooling

d.

All a. , b. and c. are correct

Answer

d.

Explanation

  • Connection Polling:

    • Server maintains a free pool of ready-to-use EJB instances for stateless session beans, message-driven beans and entity beans.

    • The EJB container creates a configurable number of bean instances at startup, so that a new instance does not have to be created for every request.

    • When a client is done with an EJB instance, the container returns it to the pool for reuse

  • Caching of EJB instances:

    • Weblogic Server supports caching for stateful session beans and entity beans.

    • An inactive cached bean instance can be passivated—removed from the cache and written to disk—and restored to memory later as necessary. Passivating bean instances optimizes use of system resources.

    • You can configure the size of the cache, and related behaviors such as rules for removing beans from the cache.

    • Caching is supported for entity EJBs, whether they use container-managed or bean-managed persistence.

  • EJB Passivation

    • Passivation is the process of disassociating a bean instance from its EJB object so that the instance can be reused or evicted to conserve memory.

    • Calling of ejbPassivate () for passivation is a warning to the bean that its held conversational state is about to be swapped out.

    • It is important that the container inform the bean using ejbPassivate () so that the bean can relinquish held resources.