SCBCD 5 Free Mock Exam

Question 1 of 22 [EJB 3.0 Overview]
You are assigned to develop EJB 3.0 components for your Online Exam Software product. One of your colleague more interested to use third party dll for sending emails and he need to access this dll in EJB component.
Which of the folllowing statements are true about EJB 3.0 prgramming restrictions?
Choice 1An enterprise bean must NOT attempt to load a native library.
Choice 2An enterprise bean must NOT declare static fields as final.
Choice 3An enterprise bean must NOT attempt to create a new security manager.
Choice 4 An enterprise bean must NOT propagate a RuntimeException to the container.
Choice 5An enterprise bean must NOT attempt to obtain a javax.naming.lnitialContext.
Question 2 of 22 [EJB 3.0 Overview]
Which of the statements are true about EJB 3.0 containers?
Choice 1Remote argument passing semantics conform to Java RMI-IIOP.
Choice 2Remote argument passing semantics conform to Java TCP/IP.
Choice 3All of the above
Question 3 of 22 [EJB 3.0 Overview]
You want to develop a large scale enterprise application that requires web service connectivity to 3 different applications. Your architect decided to use EJB 3.0-complaint application server. Which of the following statements are TRUE about EJB tier?
Choice 1EJB 3.0-compliant components are guaranteed to work within any Java EE 5 application server.
Choice 2Bean Providers are NOT required to write code for transaction demarcation.
Choice 3Both vertical and horizontal clustering is guaranteed to be supported by the EJB 3.0 container.
Choice 4Only vertical clustering is guaranteed to be supported by the EJB 3.0 container.
Choice 5Only horizontal clustering is guaranteed to be supported by the EJB 3.0 container.
Question 4 of 22 [EJB 3.0 Overview]
EJB 3.0 containers must provide a specific subset of which two APIs?
Choice 1Servlet APIs
Choice 2JavaMail APIs
Choice 3JAX-WS APIs
Choice 4Java Swing APIs
Choice 5Java AWT APIs
Choice 6CLDC API
Question 5 of 22 [General EJB 3.0 Enterprise Bean Knowledge]
You need to develop a scheduler thread for EPractize Labs license server to process license request. Your architect wants to use EJB 3.0 Timer service to achieve this requirement.
Which statement is true about the Timer service in an EJB 3.0 stateless session bean?
Choice 1The timeout callback method contains the business logic that handles the timeout event.
Choice 2The timeout callback method must throw RemoteException.
Choice 3The timeout callback method must throw application exceptions to report business logic failures.
Question 6 of 22 [EJB 3.0 Session Bean Component Contract & Lifecycle]
Which is the valid use of the javax.ejb Init annotation?
Choice 1to annotate a method in a stateful session bean class
Choice 2to specify the correspondence of a method on a stateful session bean with a create method of the adapter home interfaces
Choice 3to annotate a bean class inside the ejb-jar archive to act as a bootstrap EJB which is loaded into the container before any other EJBs
Choice 4All of the above
Question 7 of 22 [EJB 3.0 Session Bean Component Contract & Lifecycle]
A developer working in EPractize Labs Software writes a stateless session bean to handle online test management, TestManagerBean and uses its deployment descriptor to declare a local ejb dependency on a stateful session bean in the same ejb-jar.

<ejb-local-ref>
<ejb-ref-name>userRef</ejb-ref-name>
<local>com.epractizelabs.skillevaluationlab.user.UserManager</local>
<ejb-link>UserManagerBean</ejb-blink>
<injection-target>
<injection-target-class>com.epractizelabs.skillevaluationlab.test.TestManagerBean</injection-target-class>
<injection-target-name>user</injection-target-name>
</injection-target>
</ejb-local-ref>
Which environment annotation? When declared within the TestManagerBean bean class, is equivalent to the ejb-local-ref shown above?
Choice 1 @EJB(bean ="UserManagerBean")
private userManager UserManager.userManagerRef;
Choice 2 @EJB(name="userManager", beanName="UserManagerBean")
private com.epractizelabs.skillevaluationlab.user.UserManage userManager;
Choice 3 @EJB(name="userManagerRef", beanName="UserManagerBean")
private com.epractizelabs.skillevaluation.user.UserManager userManagerRef;
Choice 4 @EJB(name="ejb/userManagerRef", beanName="UserManagerBean")
private com.epractizelabs.skillevaluationlab.UserManager userManager;
Question 8 of 22 [EJB 3.0 Session Bean Component Contract & Lifecycle]
Which of the following statements are TRUE about EJB 3.0 session beans client access?
Choice 1A remote client accesses a session bean through the bean's remote business interface.
Choice 2A remote client accesses a session bean through the bean's home interface.
Choice 3A remote client accesses a session bean directly through the bean class.
Question 9 of 22 [EJB 3.0 Session Bean Component Contract & Lifecycle]
You are assigned to develop EJB 3.0 stateful session bean. When you look at the design document you noticed that transferFund() method must be declared as Required transaction attribute.
Which of the following statements would hold true when a non-transactional remote client invokes transferFund?
Choice 1Container starts a new transaction and invokes the bean method with it.
Choice 2The method throws TransactionRequiredException to the client.
Choice 3The method throws RemoteException to the client.
Choice 4The bean method executes without any error.
Question 10 of 22 [EJB 3.0 Message-Driven Bean Component Contract]
Which of the following statements are correct?
Choice 1An EJB 3.0 message-driven bean can itself be the client of another message-driven bean.
Choice 2The client of an EJB 3.0 message-driven bean can use the bean's remote business interface to communicate with the bean.
Choice 3Messages sent to JMS topics are intended for only one receiver whereas messages sent to JMS queues are intended for multiple receivers.
Choice 4All of the above.
Question 11 of 22 [EJB 3.0 Message-Driven Bean Component Contract]
One of your Java EE application need to process large volumes of asynchronous messages and guarantee delivery.
Which Java EE technologies is correct for this architecture?
Choice 1Stateless session bean and JAX-WS
Choice 2JMS topic and MDB
Choice 3JMS topic and Stateless session bean
Choice 4Servlet and JAX-WS
Question 12 of 22 [Java Persistence API Entities]
You are assigned to complete User Composite Entity model for EPractize Labs Skill Evaluation Lab. UserRole entity requires composite primary key ( userId and userRoleId).
Select valid JPA entity for defining UserRole entity with composite primary key.
Choice 1@IDClass(com.epractizelabs.exam.UserRolePK.class)
@Entity
public class UserRole {
@PK int userId;
@PK int userRoleId;
// more code here
}
Choice 2@IdClass(com.epractizelabs.exam.UserRolePK.class)
@Entity
public class UserRole {
@Id int userId;
@Id int userRoleId;
// more code here
}
Choice 3 @PKClass(com.epractizelabs.exam.UserRolePK.class)
@Entity
public class UserRole {
@Id int userId;
@Id int userRoleId;
// more code here
}
Question 13 of 22 [Java Persistence Entity Operations]
Which statement is correct about JPA ?
Choice 1Entities must be used within EJB 2.x BMP enity beans.
Choice 2Entities must be used within EJB 2.x CMP enity beans.
Choice 3Entities must be used within EJB 2.x CMP local enity beans.
Choice 4A non persistent field must be annotated as @Transient.
Question 14 of 22 [Java Persistence Entity Operations]
Which of the following statements are TRUE about EntityManager.flush method?
Choice 1The flush method might cause the persist operation to be cascaded to related entities.
Choice 2Extensive use of the flush method decreases the performance of a Java Persistence application.
Choice 3Flush method synchronize the current persistence context with the database.
Choice 4The flush method should be used within stateful session beans only.
Question 15 of 22 [Java Persistence Entity Operations]
An application wants to utilize side-effects of cascading entity-manager operations to related entities.
Which statement is correct?
Choice 1The persist operation is always cascaded to related entities for unidirectional relationships
Choice 2The persist operation is always cascaded to related entities for bidirectional relationships
Choice 3The persist operation applied to a new entity Entity is cascaded to entities referenced by Entity if the relationship from Entity to these other entities is annotated with the cascade=PERSIST or cascade= ALL annotation element value
Choice 4The persist operation is always cascaded to related entities for both unidirectional and bidirectional relationships
Question 16 of 22 [Persistence Units and Persistence Contexts]
You are developing a Java EE application to maintain EPractize Labs customer details. One customer can have one or more products.
Select the valid code to update product details of a customer.
Choice 1@PersistenceContext
EntityManager em;
public void saveProduct(int custID, Product product) {
Customer cust = em.find("Select Customer where custID = :custID");
cust.getProducts().add(product);
product.setCustomer(cust);
}
Choice 2 @PersistenceContext
EntityManager em;
public void saveProduct(int custID, Product product) {
Customer cust = em.find("custID");
cust.getProducts().add(product);
product.setCustomer(cust);
}
Choice 3 @PersistenceContext
EntityManager em;
public void saveProduct(int custID, Product product) {
Customer cust = em.find(Customer.class, custID);
cust.getProducts().add(product);
product.setCustomer(cust);
}
Choice 4 @PersistenceContext
EntityManager em;
public void saveProduct(int custID, Product product) {
Customer cust = em.find(Customer.class, "custID");
cust.getProducts().add(product);
product.setCustomer(cust);
}
Question 17 of 22 [Java Persistence Query Language]
Which of the following methods a named query can be defined?
Choice 1By @NamedQuery annotation
Choice 2By @NamedNativeQuery annotation
Choice 3using the named-query element in the XML descriptor
Choice 4 using the named-native-query element in the XML descriptor
Question 18 of 22 [Java Persistence Query Language]
EPractize Labs Online Skill Evaluation Lab is developed by Java EE architecture and uses JPA for handling data model. A Test entity has a one-to-many, bidirectional relationship with a Question entity. Two Test entities are persisted, each having two Question entities associated with them. For example, Test A has Question 1 and Question 2, while Test B has Question 3 and Question 4.
Which query returns a Collection of fewer than four elements?
Choice 1SELECT q.test FROM Question q
Choice 2SELECT t FROM Question q INNER JOIN q.test t
Choice 3SELECT t FROM Test t INNER JOIN t.questions q
Choice 4SELECT t from Question q LEFT JOIN q.test t LEFT JOIN FETCH t.questions
Question 19 of 22 [Transactions]
A developer wants to achieve the following two behaviors:

  1. If a client calls a business method without a transaction context, the container will invoke the bean in an unspecified transaction context.
  2. If a client calls a business method with a transaction context, the container will suspend the association of the transaction context with the current thread before invoking the enterprise bean's business method.
Which transaction attribute should be used?
Choice 1NEVER
Choice 2REQUIRED
Choice 3SUPPORTS
Choice 4NOT_SUPPORTED
Question 20 of 22 [Exceptions]
You are assigned to develop EJB 3.0 stateful session bean. When you look at the design document you noticed that transferFund() method transaction must be immediately rolled back by the container in case the business method is aborted with a runtime exception.
Which option you can use?
Choice 1CMT with REQUIRED transaction attribute.
Choice 2Use CMT with NOT_SUPPORTED transaction attribute.
Choice 3Use Container-Managed Transactions with transaction attribute NEVER.
Question 21 of 22 [Exceptions]
An application exception class must not extend which of the following?
Choice 1java.lang.RuntimeException
Choice 2java.rmi.RemoteException
Choice 3All of the above
Question 22 of 22 [Security Management]
Code :
Given the following method permissions.

<method-permission>
<unchecked/>
<method>
<ejb-name>TestManager</ejb-name>
<method-name>*</method-name>
</method>
</method-permission> <method-permission>
<role-name>admin</role-name>
<method>
<ejb-name>TestManager</ejb-name>
<method-name>getTests</method-name>
</method>
</method-permission>
Which of the following statements are true?
Choice 1The first method permission element is invalid.
Choice 2Only a client using manager role can access the getTests() method.
Choice 3Any client using any role can access the getTests() method.
Choice 4Only a client who has no security identity can access the getTests() method.