JSP Concepts and Syntax, Exams of Nursing

Various concepts and syntax related to javaserver pages (jsp), a server-side programming technology used to create dynamic web pages. It discusses topics such as jsp actions, scripting elements, html code, directives, javabean instances, servlet containers, exception handling, session management, and more. Explanations and examples for a range of jsp-related features and functionalities, making it a valuable resource for web application developers and students studying server-side web technologies.

Typology: Exams

2024/2025

Available from 10/05/2024

TOPGradeBooster.
TOPGradeBooster. 🇺🇸

3.6

(63)

14K documents

1 / 40

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
PRJ321 Exam Questions and Answers 2025.
Which is NOT the main type of JSP constructs that you embed in a page?
A. actions
B. scripting elements
C. HTML code
D. directives - ANSWER A
Which statements are BEST to describe <jspzsetProperty> Action?
A. Sets a property in the specified JavaBean instance. A special feature of this
action is the automatic matching of request parameters to bean properties of the
same name.
8. Dynamically includes another resource in a JSP. As the JSP executes. the
referenced resource is included and processed.
C. Specifies the relative URI path of the resource to include. The resource must be
part of the same Web application.
D. Gets a property in the specified JavaBean instance and converts the result to a
string for output in the response. - ANSWER D
Which of the following is an INCORRECT statement about implicit objects and
scope?
A. page is of type java. lang.object
B. application can't be used to access other web application resources
C. PageContextfindAttribute() can't be used to return a session scope attribute if an
attribute of the same name exists in page scope. - ANSWER B
Which statement is true?
A. When is Thread Safe attribute of page directive is set to true. a thread is created
for each request for the page
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download JSP Concepts and Syntax and more Exams Nursing in PDF only on Docsity!

PRJ321 Exam Questions and Answers 2025.

Which is NOT the main type of JSP constructs that you embed in a page? A. actions B. scripting elements C. HTML code D. directives - ANSWER A Which statements are BEST to describe Action? A. Sets a property in the specified JavaBean instance. A special feature of this action is the automatic matching of request parameters to bean properties of the same name.

  1. Dynamically includes another resource in a JSP. As the JSP executes. the referenced resource is included and processed. C. Specifies the relative URI path of the resource to include. The resource must be part of the same Web application. D. Gets a property in the specified JavaBean instance and converts the result to a string for output in the response. - ANSWER D Which of the following is an INCORRECT statement about implicit objects and scope? A. page is of type java. lang.object B. application can't be used to access other web application resources C. PageContextfindAttribute() can't be used to return a session scope attribute if an attribute of the same name exists in page scope. - ANSWER B Which statement is true? A. When is Thread Safe attribute of page directive is set to true. a thread is created for each request for the page

B. If is Thread Safe attribute of page directive is set to true. then JSP container dispatches request fort he page sequentially C. Setting Thread Safe attribute to true for JSP pages. can lead to poor performance. - ANSWER A Which of these is legal return type of the doStart Tag method defined in a class that extends TagSupport class? A. EVAL_PAGE B. EVAL_BODY C. EVAL_PAGE_INCLUDE D. EVAL_BODY_INCLUDE E. SKIP_PAGE - ANSWER B (Choose 1 answer) Consider the code shown in the exhibitforthe initO method of a HTTP servlet Which of the following LOC "may" correctly retrieve the DBURL parameter at Ill? (Assume that servlet context is a reference to ServletContext for this servlet)(Choose one) public void init() ClassforName("sun.jdbc.odbc.JdchdbcDriver"): 1 Get DBURL here theConnection = DriverManager.getConnection(dbUrI. "admin". "admin"); A. this.getParameter("DBURL"): B. this.getlnitParameter("DBURL"): C. this.getContextParameter("DBURL"): - ANSWER B What will be the outcome of executing the following code?

case of a business exception that extends from java.Iang.Exception? (Choose one) A. Catch the exception. wrap it into ServletException and define the 'business exception to error-page' mapping in web.xml B. Don't do anything. the servlet container will automatically send a default error page. C. Don't catch the exception and define the 'exception to error-page' mapping in web.xml - ANSWER A (Choose 1 answer) Which of the following statement is true for A. The class attribute must be defined for . B. The scope attribute must be defined for . C. The id attribute must be defined for . - ANSWER C (Choose 1 answer) Which of the following statement correctly set a cookie from a servlet code? (Choose one) Assume that response and request referto HttpServIetResponse and HttpServIetRequest respectively. A. responseaddCookie("mycookie". "value"):

  1. response.addCookie(new Cookie("mycookie". "value")): C. response.setCookie("mycookie". "value"):

D. requestsetCookieC'mycookie". "value"): - ANSWER B (Choose 1 answer) Which syntax is correct for JSP Scriptlets? A. <%= code%> B. <% code %> C. <%! code %> - ANSWER A (Choose 1 answer) Which statement is true about EJB 3.0 stateful session beans and stateless session beans? (Choose one) A. Both can have multiple remote and local business interfaces B. Both can be passivated by the EJB containerto preserve resource C. Only the stateful session bean class is required to implementjava.io.Serializable interface D. Only the stateless session bean class is required to implementjava.io.SeriaIizable interface - ANSWER A (Choose 1 answer) Which of the following statements are correct about HTTP Basic authentication mechanism?

(Choose 1 answer) Identify correct statement about a WAR file.(Choose one) A. It contains web components such as servlets as well as EJBs. B. It is an XML document C. It cannot be unpackaged by the container. D. It is used by web application developerto deliverthe web application in a single unit - ANSWER A (Choose 1 answer) Which of the following elements are used for error handling and are child elements of of a deployment descriptor? A. B. C. D. - ANSWER B (Choose 1 answer) provides a way to identify a user across more than one page request or visit to a Website and to store information about that user. A. Hidden Field

  1. URL Rewrite C.Cookie

D. Session management - ANSWER D (Choose 1 answer) A Java programmer wants to develop a browser-based multitier application for a large bank. Which Java edition (or editions) should be used to develop this system? A. Only J2ME B. Only JZEE C. JZSE and J2ME D. Only JZSE E. JZSE and J2EE - ANSWER E (Choose 1 answer) Which statements are BEST describe page attribute of Action? A. Forwards request processing to another JSP. servlet or static page. This action terminates the current JSP's execution. B. Dynamically includes another resource in a JSP. As the JSP executes. the referenced resource is included and processed. C. Specifies the relative URI path of the resource to include. The resource must be part of the same Web application. - ANSWER B (Choose 1 answer)

C. The name of a bean that can be used with method instantiate of class javabeansBeans to load a JavaBean into memory. D. The name used to manipulate the Java objectwith actions and . Avariable ofthis name is also declared for use in JSP scripting elements. The name specified here is ca E. The fully qualified class name of the Java object - ANSWER E (Choose 1 answer) 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? A. <°/o@page contentType ='texI/xml'> B. <°/o@page contentType ='xml'> C. <°/o@page contentType ='textjhtml'> - ANSWER A The method getWriter returns an object oftype PrintWriter. This class has println methods to generate output Which of these classes define the getWriter method? Select one correct answer. A. HttpServIetResponse B. ServletContext C. ServletConfig D. HttpServIetRequest - ANSWER A (Choose 1 answer)

A Java bean with a property color is loaded using the following statement

What is the effect of the following statement

Select one correct answer. A. An error gets generated because the value attribute of setAttribute is not defined B. The color attribute is assigned a value nuII C. The color attribute is assigned a value D. If there is a non-null request parameter with name color. then its value gets assigned to color property of Java Bean fruit - ANSWER D (Choose 1 answer) The sendRedirect method defined in the HttpServlet class is equivalent to invoking the setStatus method with the following parameter and a Location header in the URL. Select one correct answer. A. SC_INTERNAL_SERVER_ERROR B. SC_NOT_FOUND C. SC_OK D. SC_MOVED_TEMPORARILY E. ESC_BAD_REOUEST - ANSWER D (Choose 1 answer)

C. session.unbind(): D: session.removeAll() - ANSWER B (Choose 1 answer) Which of the following represents a correct syntax for using a Javabean? A. B. C. D. None ofthese - ANSWER C (Choose 1 answer) The two most common HTTP requests are get and put A. False B. True - ANSWER B (Choose 1 answer) A bean with a property color is loaded using the following statement

What happens when the following statement is executed. Select the one correct answer.

D. tag-attribute - ANSWER A (Choose 1 answer) A JSP file uses a tag as . The myTag element here should be defined in the which element of the taglib element in the tag library descriptor file A. tagname B. name C. tag D. prefix - ANSWER B (Choose 1 answer) The same servlet class can be declared using different logical names in the deployment descriptor. A. True B. False - ANSWER A (Choose 1 answer) Which statements are BEST describe prefix attribute of <%@ taglib prefix=_%>directive of JSP file? A. Allows programmers to include their own new tags in the form of tag libraries.

These libraries can be used to encapsulate functionality and simplify the coding of

A. A request is sentwith the HTTP method GET.

B. A request is sentwith the HTTP method POST. C. The parameterfullName is the only parameter passed to the web server in the request URL. D. A request is sentwith the HTTP method HEAD. E. The parameterfullName is the only parameter passed to the web server as part of the request body. - ANSWER A (Choose 1 answer) You have declared a useBean tag as:

In which type ofobjectwill this been be kept? A. ApplicationContext B. Servlet C. ServletContext D. HttpSession E. ServletConfig - ANSWER A (Choose 1 answer) The well-known port number for Web requests is 55. A. False