This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in a mock exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in a mock exam question" Watch "Doubt in a mock exam question" New topic

Doubt in a mock exam question

Rancy Chadha
Ranch Hand

Joined: Jul 12, 2006
Posts: 135
Hi All,
I have a doubt regarding a question from '' mock exam. This is the 29th question, it goes like this:

Which statements are correct regarding the following jsp lines that use a tag library?
<%! Vectot vector =new java.util.Vector();%>
<% vector.addElement(�one�); vector.addElement(�two�); %>
<prefix:suffix attr='vector' />

1) A vector can't be assigned to a tag handler attribute
2) The program will compile and assign the vector's content to the attribute attr.
3) The program will assign the content of vector if assigment is: attr='<%= vector %>'

The answer of this quesion is option 3.
My doubt is, Why is option 2 not correct. Why doesnt the code work with variable vector assigned to the attribute.
Please clear my doubt.

Thanks,<br />-Rancy
arun shanmugam kumar

Joined: Apr 02, 2005
Posts: 25
The option says the value of vector variable will be assigned to attr but thats false.
According to the code attr will have the value 'vector' and not the contents of vector reference variable.
Thats why option 2 is wrong.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10033

By the way what it means to say <prefix:suffix attr='vector' />??

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
I agree. Here's the link:
subject: Doubt in a mock exam question
It's not a secret anymore!