Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java | Answer them all 15. Given a JSP page with the line: ${101 % 10} What will

ID: 3718092 • Letter: J

Question

Java | Answer them all

15. Given a JSP page with the line:

${101 % 10}

What will be displayed?

(a)1

(b)10

(c)1001

(d)101 % 10

(E){101 % 10}

16. If in a JSP there are the following two lines,

<c:set var="color" value="&lt;i&gt;red&lt;/i&gt;" />

<c:set var="newcolor"><c:out value="${color}" /></c:set>

when you display the EL expression${newcolor}, what will you see?

(a)red

(b)red

(c)<i>red</i>

(d)&lt;i&gt;red&lt;/i&gt;

17. Assume that the named variable mylist is a List<String>object, and it contains

at least 5 elements. Which of the following expressions sometimes valid and some-

times invalid?

(a)${mylist[3]}

(b)${mylist["4"]}

(c)${mylist["idx" + 2]}

(d)${mylist[idx + 2]}

18. Which of the following ways can be used to separate the nullvalue and the empty string?

(a)using the length function in the JSTLs function package

(b)using the empty operator, like${empty somevar}, to check

(c)comparing the value to null, like ${somevar == null}

19. Which statements about the.(dot) and[]EL operators are true? (Choose all that apply.)

(a)${foo.bar} is equivalent to ${foo["bar"]}

(b)${foo["5"]} is valid syntax if foo is a Map

(c)${header.User-Agent} is equivalent to ${header[User-Agent]}

(d)${header.User-Agent} is equivalent to ${header["User-Agent"]}

(e)${foo[5]} is valid syntax if foo is a List or an array

20. Which of the following pair of expressions are always equivalent? (Assume that allthe leading named variables are valid objects that are notnull.)

(a)${mybean.myval} and ${mybean[myval]}

(b)${myobj["4"]} and ${myobj[4]}

(c)${header.User-Agent} and ${header[User-Agent]}

(d)${mydata.myname} and ${mydata["myname"]}

Explanation / Answer

Answer:------------

15. a) 1

16. (b) red

17.  (c)${mylist["idx" + 2]}

18. (c)comparing the value to null, like ${somevar == null}

19.

(a)${foo.bar} is equivalent to ${foo["bar"]}

(b)${foo["5"]} is valid syntax if foo is a Map

(e)${foo[5]} is valid syntax if foo is a List or an array

20.  (d)${mydata.myname} and ${mydata["myname"]}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote