Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ Mock Exam doubt

 
Xenon Parker
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is the question from mock exam from HSFJ book.
Question 63 in the exam.

1. <%@ taglib uri="http://www.mycompany.com/mytags" prefix="mytags" %>
2. <mytags:foo bar="abc" />
3. <mytags:forEach><mytags: DoSomething /></mytags:forEach>
4. <jsp:setProperty name="x" property="a" value="b" />
5. <c: out value="hello">

Assuming this ia a complete JSP,which is true?
(For E and F. ignore the fact that an error in one line might keep a subsequent line from being reached)

A) Only line 2 will definately generate an error
B) Only line 3 will definately generate an error
C) Only line 4 will definately generate an error
D) Only line 5 will definately generate an error
E) Lines 4 and 5 will both definately generate errors
F) Lines 2, 3, 4 and 5 will all definately generate errors
G) The entire JSP could execute withtou generating errors

****************************************************

The answer given is D.

But, wouldnt option E be more preciese?
As on line 4 the setProperty is being used withtou a useBean tag. So the name attribute used in the setProperty tag refers to no one? Like using a variable without declaring it?
[ March 28, 2008: Message edited by: Xenon Parker ]
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could have used the jsp:useBean tag in an another page. So you're not sure that it will definitely generate an error
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic