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