aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Dought  for EL in one mock exam its urgent 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 "Dought  for EL in one mock exam its urgent" Watch "Dought  for EL in one mock exam its urgent" New topic
Author

Dought for EL in one mock exam its urgent

Praveena Chordia
Ranch Hand

Joined: Jun 08, 2007
Posts: 33
In mock exam there is following two question and answer which is given for these questions is contradictory .Please help me out for thia
1 Given the folowing code within a JSP page


<%
String [] noises = {"moo"};
request.setAttribute("noises",noises);
%>Which of the following will output the word
moo
in the page?


Choose at least one answer. A. ${requestScope.noises}
B. ${request.noises[0]}
C. ${request[noises["0"]]}
D. ${requestScope.noises['0']}
E. ${noises[0]}


Its answer is D,E

2nd question is


Given a JSP page that contains the following code?

<% java.util.ArrayList al = new java.util.ArrayList(); al.add("red"); request.setAttribute("al",al); java.util.HashMap hm = new java.util.HashMap(); hm.put("zero","red"); %>Which of the following will output the string
red

Choose at least one answer. A. ${al[0]}
B. ${al['0']}
C. ${hm["zero"]}
D. ${hm.zero}


anwer for this A and B in mock exam
explanation is "hm is not an attribute "
According to first answer it should be A,B,C,D
sudhakar karnati
Ranch Hand

Joined: May 03, 2007
Posts: 93
For the first question answers are corect(D&E)..and for the second question also answers are correct because hashMap hm is created but it is not bound to the request scope..so answers A & B are correct..

i think you should not mention urgent when you make posts according to Javaranch policy..

Thanks & Regards,
Sudhakar Karnati
Praveena Chordia
Ranch Hand

Joined: Jun 08, 2007
Posts: 33
thanks
Kram Nart
Ranch Hand

Joined: Jun 05, 2006
Posts: 32
For the first question, 'request' does NOT exist in the EL space. Therefore, ruling those out.

For the second question, 'hw' is a hashmap variable declared in a scriptlet. EL does NOT see those at all. Therefore, ruling those out.

Hope that helps.


SCJP 5 <br /> SCWCD 5 <br /> SCBCD <br />
Figuring out what's next...
Vilas Lawande
Ranch Hand

Joined: Nov 07, 2006
Posts: 127
This means that "requestScope" is default implicit object in EL ?
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 171
there is nothing called default implicit object in EL


Ravi Kumar
SCWCD 5 - 89%, SCJP 1.4 - 90%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dought for EL in one mock exam its urgent