100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
PRJ301 Questions and Answers 2024 $12.49   Add to cart

Exam (elaborations)

PRJ301 Questions and Answers 2024

 1 view  0 purchase
  • Course
  • Institution

PRJ301 Questions and Answers 2024

Preview 4 out of 125  pages

  • August 11, 2024
  • 125
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
avatar-seller
PRJ301 Questions and Answers 2024

Given the HTTP message fragment: HTTP/1.1 500 Internal Server Errors Choose the
correct statement Select one:
a. The fragment message describes the request line of HTTP response message
b. None of the others
c. The fragment message describes the status line of HTTP response message
d. The fragment message describes the status line of HTTP request message
e. The fragment message describes the header information of HTTP response message
** Answ** c

A JSP page called test.jsp is passed a parameter name in the URL using
http://localhost/Final/test.jsp?name=John. The test.jsp contains the following code. <%
String myName=request.getParameter("name");%> <% String test= "Welcome " +
myName; %> <%=test%> What is the output? Select one:
a. The program gives a syntax error because of the statement <%=test%>
b. The program gives a syntax error because of the statement <% String
myName=request.getParameter("name");%>
c. The program gives a syntax error because of the statement <% String test=
"Welcome " + myName; %>
d. None of the others.
e. The page display "Welcome John" ** Answ** e

Which scripting element lets you define methods or fields that get inserted into the main
body of the servlet class (outside of the _jspService method that is called by service to
process the request)? Select one:
a. expression
b. scriptlet
c. None of the others
d. declaration e. comment ** Answ** d

Which method returns the actual length of the request sent by the client? Select one:
a. getContentLength()
b. None of the others
c. getParameter()
d. getServerName()
e. getAttribute() ** Answ** a

Which of the followings is a correct syntax of the method that is used to get the
initialized parameter in ServletContext or ServletConfig? Select one:
a. String getInitializedParameter(String name);
b. String getInitParameter(String name);
c. All of the others.
d. String getContextParameter(String name); ** Answ** b

,To send text outptut in a response, the following method of HttpServletResponse may
be used to get the appropriate Writer/Stream object. Select one or more:
a. getOutputStream
b. getBinaryStream
c. getStream
d. getWriter ** Answ** a,d

Which of the following statements about Web Container is true? Select one:

a. Container is a program, which manages the execution of servlets
b. A Web application is accessible to all users connected to the Web
c. The performance of a servlet is independent of the efficiency of the container
d. The Web Container takes request from a servlet and passes it to a Web Server for
processing
e. None of the others ** Answ** a

Which of the following represents the XML equivalent of this statement <%@ include
file="a.jsp"%> .
Select one correct statement.
Select one:

a. <jsp:include page="a.jsp"/>
b. There is no XML equivalent of include directive.
c. <jsp:directive.include file="a.jsp"/>
d. None of the others
e. <jsp:include file="a.jsp"/> ** Answ** c

Which of the following attributes of the Page directive is used to specify the page to
display errors which may occur in the JSP page? Select one:

a. excption
b. isErrorPage
c. Error
d. None of the others
e. errorPage ** Answ** e

Name the implicit variable available to JSP pages that may be used to access all the
other implicit objects. Select one:

a. pageContext
b. request
c. response
d. page
e. out ** Answ** a

,Which of the following statement is an expression in scripting element? Select one:

a. <%= for(int i=0; i<n; i++) {out.println(i)} %>
b. <%= x + y - 8 %>
c. All of the others
d. <%= x + y; %> ** Answ** b

Given a JSP code fragment <% int a = Integer.parseInt("a"); %> Choose the correct
statement Select one:

a. The code is generated in jspInit method by JSP enginer
b. None of the others
c. The code is generated in _jspService method by JSP engine
d. The code is generated besides of _jspService method by JSP engine ** Answ** c

Which of the following statements about Request and Response message structure is
false? Select one:

a. Request message structure consists of request line and header information
b. Request line returns the User-Agent along with the Accept header
c. Header information in response message contains information such as server, last
modified date, content-length and content type
d. None of the others ** Answ** b

Assume that you need to write a JSP page that adds numbers from one to ten, and then
print the output.

<% int sum = 0;
for(j = 0; j < 10; j++) { %>
<% // XXX --- Add j to sum %>
<% } %>
<% // YYY --- Display ths sum %>

Which statement when placed at the location XXX can be used to compute the sum.
Select the one correct statement Select one:

a. = sum = sum + j;
b. sum = sum + j
c. = sum = sum + j
d. sum = sum + j; ** Answ** d

Which of the following statements about the Servlet is false? Select one:

a. Servlets are portable
b. Initialization code in servlets is executed every time the program is made to run
c. None of the others

, d. Servlets are easy to use ** Answ** b

A JSP page needs to perform some operations before servicing the first request. Where
can this be done? Select one:

a. within the page directive of the JSP page
b. within a method called jspInit
c. within a scriptlet at the top of the JSP page
d. within the XML element ** Answ** b

In a JSP life cycle, which of the following phases produces a Java Servlet (with
extension *.java) file? Select one:

a. None of the others
b. Initialization
c. Instantiation
d. Compilation
e. Translation ** Answ** e

Given a JSP error page, which implicit object refers to the uncaught Throwable that
resulted in the page being invoked? Select one:

a. request.exception
b. error
c. throwable
d. None of the others
e. exception ** Answ** e

A JSP page needs to generate an XML file. Which attribute of page directive may be
used to specify that the JSP page is generating an XML file? Select one:

a. <%@page contentType ="text/html">
b. None of the others
c. <%@page contentType ="html/xml">
d. <%@page contentType ="xml">
e. <%@page contentType ="text/xml"> ** Answ** e

Which of the following request dispatching techniques can be used to include the
content of another servlet into the current output stream? Select one:

a. include
b. forward
c. None of the others.
d. redirect ** Answ** a

Consider the description:

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller smartchoices. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75323 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.49
  • (0)
  Add to cart