Evaluating java expression


Question: A JSP expression can contain any Java expression that evaluates to a:

a) String object
b) Java object
c) Primitive type
d) Primitive type or Java object

Question: Which of the following JSP expressions is valid?

a) <%= request.getParameter("occupation"); %>
b) <%= request.getParameter("occupation") %>
c) <%= String occupation = request.getParameter("occupation"); %>
d) <%= String occupation = request.getParameter("occupation") %>
e) None of the above

Question: The following code:
<%String[] mailTypes = request.getParameterValues("mail");%>

a) Returns the name of all request parameters from the mail.jsp page.
b) Returns the first value of the mail parameter or null if none exist.
c) Returns all values of the mail parameter or null if none exist.
d) Returns the values of all request parameters from the mail.jsp page are invalid.

Question: To use your own Java class in a JSP, you can import the class with a:

a) JSP scriptlet
b) JSP expression
c) JSP directive
d) JSP declaration

Question: Which of the following is a valid JSP comment?

a) // comment
b)
c) <%-- comment --%>
d)

Question: In the code that follows, the numOfErrors variable
<%! int numOfErrors = 1; %>

a) Is initialized each time the page is requested.
b) Is an instance variable that is not thread-safe.
c) Is ignored by the JSP engine.
d) Is invalid JSP code.

Question: When a JSP is requested for the first time, the JSP engine does all but one of the following. Which one is it?

a) Generates a servlet for the JSP.
b) Generates the HTML code for the JSP.
c) Creates one instance of the servlet class.
d) Creates one thread

Question: When a JSP is requested for the second time, the JSP engine:

a) Creates a thread that has its own copy of the instance variables.
b) Creates a thread that has its own copy of the local variables.
c) Creates an instance of the JSP that has its own copy of the instance variables.
d) Creates an instance of the JSP that has its own copy of the local variables.

Question: A scriptlet contains one or __________ statements.

a) HTML
b) Java
c) XML
d) Web server

Solution Preview :

Prepared by a verified Expert
PHP Web Programming: Evaluating java expression
Reference No:- TGS0177

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)