Oracle 1z0-895 Exam Practice Questions (P. 4)
- Full Access (90 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #16
Given singleton bean FooEJB:

How many distinct FooEJB bean instances will be used to process the code on the lines 101-105?

How many distinct FooEJB bean instances will be used to process the code on the lines 101-105?
- A0
- B1
- C2
Correct Answer:
B
Java has several design patterns Singleton Pattern being the most commonly used. Java Singleton pattern belongs to the family of design patterns, that govern the instantiation process. This design pattern proposes that at any time there can only be one instance of a singleton (object) created by the JVM.
B
Java has several design patterns Singleton Pattern being the most commonly used. Java Singleton pattern belongs to the family of design patterns, that govern the instantiation process. This design pattern proposes that at any time there can only be one instance of a singleton (object) created by the JVM.
send
light_mode
delete
Question #17
A developer writes a Singleton bean that holds state for a single coordinate:

An update thread acquires an EJB reference to CoordinateBean and alternates between invoking SetCoordinate (0, 0) and SetCoordinate (1, 1) in a loop.
At the same time, ten reader threads each acquire an EJB reference to CoordinateBean and invoke getCoordinate () in a loop.
Which represents the set of all possible coordinate values [X, Y] returned to the reader threads?

An update thread acquires an EJB reference to CoordinateBean and alternates between invoking SetCoordinate (0, 0) and SetCoordinate (1, 1) in a loop.
At the same time, ten reader threads each acquire an EJB reference to CoordinateBean and invoke getCoordinate () in a loop.
Which represents the set of all possible coordinate values [X, Y] returned to the reader threads?
send
light_mode
delete
Question #18
Assume a client will be accessing a Singleton bean.
Which client views is a Singleton bean capable of exposing? (Choose two)
Which client views is a Singleton bean capable of exposing? (Choose two)
- AWeb Service
- BMessage listener
- CEJB 2.x Remote Home
- DEJB 3.x local business
- EJava Persistence API entity
Correct Answer:
AD
JSR 318 Enterprise JavaBeans 3.1, Final Release: 4.8.6Operations Allowed in the Methods of a Singleton Session Bean
Invoking the getEJBObject and getEJBHome methods is disallowed since a singleton session bean does not support the EJB 2.x Remote client view.
Invoking the getEJBLocalObject and getEJBLocalHome methods is disallowed since a singleton session bean does not support the EJB 2.x Local client view.
Reference: The Java EE 6 Tutorial, What Is a Session Bean?
Reference: Oracle Containers for J2EE Enterprise JavaBeans Developer's Guide, How do you use an Enterprise Bean in Your Application
AD
JSR 318 Enterprise JavaBeans 3.1, Final Release: 4.8.6Operations Allowed in the Methods of a Singleton Session Bean
Invoking the getEJBObject and getEJBHome methods is disallowed since a singleton session bean does not support the EJB 2.x Remote client view.
Invoking the getEJBLocalObject and getEJBLocalHome methods is disallowed since a singleton session bean does not support the EJB 2.x Local client view.
Reference: The Java EE 6 Tutorial, What Is a Session Bean?
Reference: Oracle Containers for J2EE Enterprise JavaBeans Developer's Guide, How do you use an Enterprise Bean in Your Application
send
light_mode
delete
Question #19
A developer writes a Singleton bean that uses the java Persistence API within a business method:

Two different concurrently executing caller threads acquire an EJB reference to PersonBean and each invoke the getPerson () method one time. How many distinct transaction are used to process the caller invocations?

Two different concurrently executing caller threads acquire an EJB reference to PersonBean and each invoke the getPerson () method one time. How many distinct transaction are used to process the caller invocations?
- A0
- B1
- C2
Correct Answer:
B
Only one transaction is required. LockType READ allows simultaneous access to singleton beans.
Note: READ -
public static final LockType READ
For read-only operations. Allows simultaneous access to methods designated as READ, as long as no WRITE lock is held.
Reference: javax.ejb, Enum LockType
B
Only one transaction is required. LockType READ allows simultaneous access to singleton beans.
Note: READ -
public static final LockType READ
For read-only operations. Allows simultaneous access to methods designated as READ, as long as no WRITE lock is held.
Reference: javax.ejb, Enum LockType
send
light_mode
delete
Question #20
Given the following client-side code that makes use of the session bean Foo:
10. @EJB Foo bean1;
12. @EJB Foo bean2;
// more code here
20. boolean test1 = beanl.equals(bean1);
21. boolean test2 = beanl.equals(bean2) ;
Which three statements are true? (Choose three)
10. @EJB Foo bean1;
12. @EJB Foo bean2;
// more code here
20. boolean test1 = beanl.equals(bean1);
21. boolean test2 = beanl.equals(bean2) ;
Which three statements are true? (Choose three)
- AIf Foo is stateful, test1 is true, and test2 is true.
- BIf Foo is stateful, test1 is true, and test2 is false.
- CIf Foo is stateless, test1 is true, and test2 is true.
- DIf Foo is stateless, test1 is true, and test2 is false.
- EIf Foo is singleton, test1 is true, and test2 is true.
- FIf Foo is singleton, test1 is true, and test2 is false.
Correct Answer:
BCE
BCE
send
light_mode
delete
All Pages