aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFJS (V2) Final Mock Question 26 is wrong? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFJS (V2) Final Mock Question 26 is wrong? " Watch "HFJS (V2) Final Mock Question 26 is wrong? " New topic
Author

HFJS (V2) Final Mock Question 26 is wrong?

Kay Li
Greenhorn

Joined: May 11, 2009
Posts: 14

Given:
01. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
02.
03. <%
04. java.util.List books = new java.util.ArrayList();
05. // add line here
06. request.setAttribute("myFavoriteBooks", books);
07. %>
08.
09. <c:choose>
10. <c:when test="${not empty myFavoriteBooks}">
11. My favorite books are:
12. <c:forEach var="book" items="${myFavoriteBooks}">
13. <br/> * ${book}
14. </c:forEach>
15. </c:when>
16. <ctherwise>
17. I have not selected any favorite books.
18. </ctherwise>
19. </c:choose>
Which of the following lines of code, if inserted independently at Line 5, will cause the text within the ctherwise tag to display? (Choose all that apply)

A. books.add("");
B. books.add(null);
C. books.clear();
D. books.add("Head First");
E. books = null;

Book's answer: BD

I think that List books as newly created is empty list, so it will cause the text within the ctherwise tag to display!

Or just CE

Thanks
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Kay. I tested this. What you said is correct. Options C,E are correct.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFJS (V2) Final Mock Question 26 is wrong?