• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

OCPJBCD Mock Exam -1

February 6, 2014 //  by Krishna Srinivasan//  Leave a Comment

1 . Application Exception myException can automatically mark transaction for roll back?

  1. ApplicationException is applied to the myException class
  2. <exception-class>myException</exception-class> is used inside <application-exception> element in deployment descriptor
  3. Constructor of myException class calls EJBContext.setRollbackOnly()
  4. ApplicationException is applied to myException class, and rollback subelement of application-exception is specified as true

2 . If message driven bean allocate resources in PostConstruct lifecycle callback, and releases these resources in PostDestroy, these resources will always be automatically release by container when instance is discarded?

3 . Choose the correct statements of the below?

  1. Methods of business interface may throw java.rmi.RemoteException
  2. Methods of local and local home interface may throw java.rmi.RemoteException
  3. Methods of web service end points interface may throw java.rmi.RemoteException
  4. Methods of remote and remote home interface must not throw application exception

4 . If client receives application exception?

  1. Instance is discarded, so client should repeat all operations again
  2. Client can continue calling the enterprise bean and recover

5 . Local and Remote clients that are enterprise beans, and use BMT can use EJBContext.getRollbackOnly to test whether the transaction has been marked for transaction or not?

6 . if client receives javax.ejb.EJBException then?

  1. The client knows for sure that the EJB method it invoked has not been completed
  2. The client does not know if the EJB method it invoked has completed or not
  3. If the client executes in context of transaction,the transaction is marked for roll back
  4. If client executes in context of transaction,the client’s transaction,may or may not have been marked for roll back

7 . A method of business interface of CMT bean throws non-application exception, then the client will receive?

  1. Javax.ejb.EJBTransactionRolledbackexception if bean executes within caller’s transaction and with required transaction attribute
  2. Javax.ejb.EJBException if bean executes within transaction started by container, and with requiresNew transaction attribute
  3. Java.rmi.RemoteException if bean executes within caller’s transaction and with required transaction attribute
  4. Javax.ejb.EJBException if bean executes within caller’s transaction and with Mandatory transaction attribute

8 . Methods that are not assigned to any security role,not annotated with DenyAll, and not included in the exclude-list, are treated by container as —-?

9 . Security roles declared by bean provider\assembler using security-role-ref correspond to users, groups or principals in the operational environment?

10 . Suppose principals of operational environment are mapped to security-role payroll-department, then what element should be used to implicitly map these principals to the logical role payroll?

Choose the one below:

  1. <security-role>payroll-department</security-role>
  2. <security-role>payroll</security-role>
  3. <security-role-ref><role-name>payroll</role-name><role-link>payroll-department</role-link></security-role-ref>
  4. <security-role-ref name=”payroll-department”><security-role>payroll</security-role></security-role-ref>

Answers

1 : 4 is correct.
ApplicationException is applied to myException class, and rollback subelement of application-exception is specified as true

2 : false.

3 : 3 is correct.
Methods of web service end points interface may throw java.rmi.RemoteException

4 : 2 is correct.
Client can continue calling the enterprise bean and recover

5 : false.

6 : 2 & 4 is correct.
2 . The client does not know if the EJB method it invoked has completed or not
4 . If client executes in context of transaction, the client’s transaction, may or may not have been marked for roll back

7 : 1 & 2 is correct.
1 . Javax.ejb.EJBTransactionRolledbackexception if bean executes within caller’s transaction and with required transaction attribute
2 . Javax.ejb.EJBException if bean executes within transaction started by container,and with requiresNew transaction attribute

8 : unchecked.

9 : false.
They represent logical security view

10 : 3 is correct.
<security-role-ref><role-name>payroll</role-name><role-link>payroll-department</role-link></security-role-ref>

Category: CertificationsTag: OCPJBCD

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.

Previous Post: « OCMJEA Mock Exam – 11
Next Post: OCPJBCD Mock Exam – 2 »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

New Features in Spring Boot 1.4

Difference Between @RequestParam and @PathVariable in Spring MVC

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact