Which three EL expressions, inserted at line 15, are valid and evaluate to “3”?

Given:
11. <%
12. request.setAttribute (“vals”, new String[] {“1”, “2”, “3”, “4”});
13. request.setAttribute (“index”, “2”);
14. %>
15. <% – – insert code here – – %>
Which three EL expressions, inserted at line 15, are valid and evaluate to “3”? (Choose three)

Given:
11. <%
12. request.setAttribute (“vals”, new String[] {“1”, “2”, “3”, “4”});
13. request.setAttribute (“index”, “2”);
14. %>
15. <% – – insert code here – – %>
Which three EL expressions, inserted at line 15, are valid and evaluate to “3”? (Choose three)

A.
${vals.2}

B.
${vals [“2”] }

C.
${vals.index}

D.
${vals[index] }

E.
${vals} [index]

F.
${vals. (vals.index) }

G.
${vals [vals[index-1]] }



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Neo

Neo

B is correct because a string index is coerced to an int for arrays and lists.