• 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)

OCEJWCD 6 Mock Exam – 3

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

1 . Regarding the processing of a BodyTag handler,in which of the following cases a BodyContent object will be “pushed” into the pageContext?

  1. If the doStartTag() returns EVAL_BODY_INCLUDE
  2. If the doStartTag() returns EVAL_BODY_BUFFERED
  3. If the doStartTag() returns SKIP_BODY
  4. If the doStartTag() DOES NOT return SKIP_BODY
  5. A BodyContent object it is always created and pushed no matter what doStartTag() returns

2 . Which of the following apply to Transfer Object design pattern?

  1. It increases complexity by increasing the number of remote interfaces
  2. It increases network performance by introducing one coarse grained remote call for multiple finer grained network calls
  3. It reduces network traffic by introducing one coarse grained remote call for multiple finer grained network calls
  4. It increase server throughput by utilizing the CPU better
  5. It increases design overhead due to versioning issues

3 . Which of the following deployment descriptor snippets would you use to declare the use of a tag library?

1. <tag-lib>

   <uri>http://abc.net/ourlib.tld</uri>

   <location>/WEB-INF/ourlib.tld</location>

   </tag-lib>

2. <taglib>

   <uri>http://abc.net/ourlib.tld</uri>

   <location>/WEB-INF/ourlib.tld</location>

   </taglib>

3. <taglib>

   <taglib-uri>http://abc.net/ourlib.tld</taglib-uri>

   <taglib-location>/WEB-INF/ourlib.tld</taglib-location>

   </taglib>

4. <taglib>

   <tagliburi>http://abc.net/ourlib.tld</uri>

   <tagliblocation>/WEB-INF/ourlib.tld</location>

   </taglib>

5. <taglibmap>

   <uri>http://abc.net/ourlib.tld</uri>

   <location>/WEB-INF/ourlib.tld</location>

   </taglibmap>

Choose the one below:

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

4 . Which of the following design patterns is used to separate the task of writing the GUI screens and business logic?

  1. View Logic
  2. Front Controller
  3. Model View Controller
  4. Business View
  5. Business Delegate

5 . For this jsp code to compile and run which of the given options should be true?

 <jsp:useBean class="com.bookstore.Book" type="java.lang.Object" id="book" />

Choose the one below:

  1. This statement is wrong as type attribute is invalid
  2. Book must have a public no args constructor
  3. Book must have a public constructor but there is no requirement on arguments
  4. Book must have a public getInstance() method
  5. This statement will always throw an exception at runtime no matter what you do to Book class

6 . Your servlet may throw IOException while processing a request.You want to define an error page in your deployment descriptor so that whenever IOException is thrown,this page is serviced to the browser?
Which of the following XML fragments correctly specify the mapping?

1. <error-page>

   <exception>java.io.IOException</exception>

   <location>/html/Test.html</location>

   </error-page>

2. <error-page>

   <exception-class>java.io.IOException</exception-class>

   <location>/html/Test.html</location>

   </error-page>

3. <error-page>

   <exception-type>java.io.IOException</exception-type>

   <page-location>/html/Test.html</page-location>

   </error-page>

4. <error-page>

   <exception-type>java.io.IOException</exception-type>

   <location>/Enthuse/html/Test.html</location>

   </error-page>

5. <exception>

   <exception-type>java.io.IOException</exception-type>

   <location>/Enthuse/html/Test.html</location>

   </exception>

Choose the one below:

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

7 . Select the tag that comes directly under the tag of a web.xml and that is used to specify a class whose object will be sent notifications when changes occur to the SevletContext?

  1. servlet-context-listener
  2. listener
  3. context-listener-class
  4. listener-class
  5. context-listener

8 . Consider the following JSP code (See exhibit)?
What will it print for the very first request to this page as well as the web application that contains this page?

<html><body>

<%

    Integer count = (Integer) request.getSession(false).getAttribute("count");

    if(count != null )

    {

        out.println(count);

    }

    else request.getSession(false).setAttribute("count", new Integer(1));

%>

Hello!

</body></html>

Choose the one below:

  1. It will print Hello!
  2. It will print Hello and will set the count attribute in the session
  3. It will throw a NullPointerException at request time
  4. It will not compile

9. The following line of code exists in the doGet method of Servlet:

String sid = request.getParameter("jsessionid");

Which of the options will retrieve the HttpSession associated with the request?
(Assume that the session has already been created.)

Choose the one below:

  1. HttpSession session = request.getSession();
  2. HttpSession session = HttpSession.getSession(sid);
  3. HttpSession session = request.getSession(sid);
  4. HttpSession session = request.getSession(true);
  5. HttpSession session = request.getSession(false);

Answers

1 : 3 is correct.

2 : 2 & 3 is correct.

3 : 3 is correct.

4 : 2 is correct.

5 : 2 is correct.

6 : 4 is correct.

7 : 2 is correct.

8 : 2 is correct.

9 : 1,4 & 5 is correct.

Category: CertificationsTag: OCEJWCD, OCEJWCD 6

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: « OCEJWCD 6 Mock Exam – 2
Next Post: OCEJWCD 6 Mock Exam – 4 »

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