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

Please help. Only have about an hour. Questions are in bold and multiple choice

ID: 3693944 • Letter: P

Question

Please help. Only have about an hour. Questions are in bold and multiple choice answers are followed. Thank you in advance. Help very much needed.

Question 14 pts

After you code the request-side processing statements for a filter class, you pass

Flag this Question

Question 24 pts

You can use a filter to do all but one of the following. Which one is it?

Flag this Question

Question 34 pts

An HTTP response consists of the following

Flag this Question

Question 44 pts

Which, if any, of the following statements is equivalent to this code:
String type = request.getHeader("Content-Type");

Flag this Question

Question 54 pts

What does the following code display in a JSP?
<%@ page import="java.util.*" %>
<%
Enumeration headerNames = request.getHeaderNames();
String name = (String) headerNames.nextElement();
String value = request.getHeader(name);
%>
<tr>
    <td align="right"><%= name %></td>
    <td><%= value %></td>
</tr>

Flag this Question

Question 64 pts

In Tomcat, a security constraint is coded in

Flag this Question

Question 74 pts

When an application uses form-based authentication,

Flag this Question

Question 84 pts

Before a server uses SSL to transmit data to a client, it

Flag this Question

Question 94 pts

Which protocol is used to send a message from one mail server to another?

Flag this Question

Question 104 pts

Which of the following can not be stored in the mail session object?

Flag this Question

Question 114 pts

To execute the Delete statement that follows, which statement would you use?
String query = "DELETE FROM Invoices " +
               "WHERE InvoiceTotal = 0 ";
Statement statement = connection.createStatement();

Flag this Question

Question 124 pts

If ps is a PreparedStatement object and product is a Product object, then the following statement
ps.setDouble(3, product.getPrice());

Flag this Question

Question 134 pts

The result set retrieved by the following SELECT statement contains records that have
SELECT Balance, Num
FROM Accounts
WHERE Balance < 0

Flag this Question

Question 144 pts

Which of the following is not a way to insert data into a table?

Flag this Question

Question 154 pts

Before you code a custom tag, you use a taglib directive to specify

Flag this Question

Question 164 pts

To reiterate the body of a tag,

Flag this Question

Question 174 pts

Which of the following is the correct EL code for getting the value of a cookie named userPreference?

Flag this Question

Question 184 pts

The paramValues implicit object lets you use EL

Flag this Question

Question 194 pts

You can include a double quote mark within the value of an attribute by

Flag this Question

Question 204 pts

If this is the useBean tag for a JavaBean
<jsp:useBean id="clock" class="business.Clock" scope="application" />
what is the correct code for setting the attribute for this JavaBean in a servlet before it is passed to a JSP.

Flag this Question

Question 214 pts

A session object is created

Flag this Question

Question 224 pts

Persistent cookies

Flag this Question

Question 234 pts

In the code that follows, the servlet is mapped to
<servlet-mapping>
    <servlet-name>DiagnoseTrouble</servlet-name>
    <url-pattern>/diagnostics/diagnoseTrouble</url-pattern>
</servlet-mapping>

Flag this Question

Question 244 pts

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

Flag this Question

Question 254 pts

What happens when the button in the following form is clicked?
<form action="grades.jsp" method="get">
    ID: <input type="text" name="studentID"><br>
    <input type="submit" value="Get My Grades">
</form>

the request object to the next filter in the chain

Explanation / Answer

An HTTP response consists of the following

Ans) status code, response headers, and response body       

Which, if any, of the following statements is equivalent to this code:
String type = request.getHeader("Content-Type");

Ans) String type = request.getContentType()

In Tomcat, a security constraint is coded in

Ans) the web.xml file

When an application uses form-based authentication,

Ans) the web.xml file provides the path for the login page

Before a server uses SSL to transmit data to a client, it

Ans) provides a digital secure certificate to the client

Which protocol is used to send a message from one mail server to another?

Ans) SMTP

Which of the following can not be stored in the mail session object?

Ans) the password for connecting to a mail server

To execute the Delete statement that follows, which statement would you use?
String query = "DELETE FROM Invoices " +
               "WHERE InvoiceTotal = 0 ";
Statement statement = connection.createStatement();

Ans) statement.executeUpdate(query);

If ps is a PreparedStatement object and product is a Product object, then the following statement
ps.setDouble(3, product.getPrice());

Ans) sets the third column in the prepared statement to the value that’s returned by the getPrice method

The result set retrieved by the following SELECT statement contains records that have
SELECT Balance, Num
FROM Accounts
WHERE Balance < 0

Ans)two fields from the Accounts table where Balance column is less than 0

Which of the following is not a way to insert data into a table?

Ans) a configuration file

Before you code a custom tag, you use a taglib directive to specify

Ans) the location of the TLD file

To reiterate the body of a tag,

Ans) the doAfterBody method should return EVAL_BODY_AGAIN

Which of the following is the correct EL code for getting the value of a cookie named userPreference?

Ans) ${cookie.userPreference.value}

The paramValues implicit object lets you use EL

Ans) to get the values of request parameters

If this is the useBean tag for a JavaBean
<jsp:useBean id="clock" class="business.Clock" scope="application" />
what is the correct code for setting the attribute for this JavaBean in a servlet before it is passed to a JSP.

Ans) ServletContext context = getServletContext(); context.setAttribute("clock", clock);

A session object is created

the first time a browser requests a servlet or JSP from a web site

Persistent cookies

Ans) are removed after the session ends

In the code that follows, the servlet is mapped to
<servlet-mapping>
    <servlet-name>DiagnoseTrouble</servlet-name>
    <url-pattern>/diagnostics/diagnoseTrouble</url-pattern>
</servlet-mapping>

Ans) the /diagnostics/diagnoseTrouble URL of the document root directory

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

Ans)is invalid JSP code

What happens when the button in the following form is clicked?
<form action="grades.jsp" method="get">
    ID: <input type="text" name="studentID"><br>
    <input type="submit" value="Get My Grades">
</form>

Ans)
the data in the studentID text box is passed to the grades.jsp file