PRJ321

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

A custom tag can be nested inside another custom tag. A. true B. false

a

A parameter is defined in a <context-param> element of the deployment descriptor for a web application. Which of the following statements is correct? A. It is accessible only to the servlet it is defined for. B. It is accessible to all the servlets of all the webapps of the container. C. It is accessible to all the servlets of the webapp.

a

A stateful session bean must commit a transaction before a business method A. False B. True

a

Given that a servlet has been mapped to /account/*. Identity the HttpServletRequest methods that will return the/myapp segementforthe URI: /myapp/account/*. A. getPathlnfo B. getServletPath C. getContextPath

a

Identify the correct element is required for a valid <taglib> tag in web.xml (Choose one) A. <taglib-uri> B. <uri> C. <uri-name> D. <uri-location> E. <tag-uri>

a

If you want the same Servlet to handle both GET and POST and to take the same action for each, you can simply have doGet call doPost or vice versa. A. False B. True

a

What is the consequence of attempting to access the following JSP page? <html> <body> <%! public void JspService(HttpServletRequest request HttpServletResponse response) { outwrite("A"): } %> <% outwritef("B"): %> </body> </html> A. Duplicate method compilation error. B. "A" is output to the response before "B". C. "A" is output to the response. D. "B" is output to the response.

a

What would be the best directory in which to store a supporting JAR file for a web application? Note that in the list below, all directories begin from the context root A. \WEB-INF\lib B. \jars C. \WEB-INF D. \WEB-INF\classes

a

Which is NOT a standard technique for a session be definitely invalidated? A. If the session time out is set to 0 using setMaxInactivelntervalO method. B. No request comes from the client for more than "session timeout" period. C. A servlet explicitly calls invalidateO on a session object D. The container is shutdown and brought up again.

a

Which of the following classes define the methods setStatus(...) and sendError(...) used to send an HTTP error back to the browser? (Choose one) A. Both are defined in HttpServletResponse. B. Both are defined in ServletResponse C. HttpServletResponse and ServletResponse respectively. D. ServletResponse and HttpServletResponse respectively.

a

Which of the following methods can be used to add cookies to a servlet response? A. HttpServletResponse.addCookie(Cookie cookie) B. ServletResponse.addCookie(Cookie cookie) C. ServletResponse.addCookie(String contents) D. HttpServletResponse.addCookie(String contents) E. ServletResponse.addHeader(String name. String value)

a

Action <jsp:setProperty> has the ability to match request parameters to properties of the same name in a bean by specifying "*" for attribute property. A. False B. True

b

Consider the following java code: //in file Book.java package com.bookstore; public class Book { private long isbn; public BookO{ isbn = 0;} public long getlsbn(){ return isbn;} public void setlsbn(long value){ this.isbn = value;} } Code for browse.jsp: <jsp:useBean class="com.bookstore.Book" id="newbook"/> LINE 1: <jsp:setProperty name="newbook" property="isbn" value="1000"/> Which of the following statements are correct? A. The isbn property of new book will be set to 1000 if nbsp;nbsp;'value' attribute of 'setProperty' tag is given as: value=1000 B. The isbn property of newbookwill be set to 1000. C. It will not compile.

b

How can you ensure the continuity of the session while using HttpServletResponse.sendRedirect() method when cookies are not supported by the client? A. By using HttpServletRequestencodeURLO method. B. By enconding the redirect path with HttpServletResponse.encodeRedirectURLO method. C. By using hidden parameters.

b

If you want the same Servlet to handle both GET and POST and to take the same action for each , you can simply have doGet call doPost , or vice versa A.False B.True

b

Is this statement true or false? The deployment descriptor of a web application must have the name web.xml. In the same way the tag library descriptor file must be called taglib.xml. A. True B. False

b

Objects with application scope are part of a particular Web application. A. False B. True

b

Servlet methods are executed automatically. A. False B. True

b

What is the output of the following code snippet of a JSP page? ${empty""}<br> ${empty"sometext"} A. false B. false true C. true false D. true

b

When implementing a tag. if the tag does not include the body, then the tag handler class must extend the BodyTagSupport class. Is this statement true of false? A. True B. False

b

Which is NOT associated with the business tier in a JEE (J2EE) web-based application? A. Entity Beans B. JSP C. Stateless Session Beans

b

Which of the following statement is correct? A. Data Integrity means that the data cannot be viewed by anybody other than it's intended recepient B. Authentication means determining whether one has access to a particular resource or not C. Data Integrity means that the data is not modified in transit between the sender and the receiver.

b

Which of the following task may happen in the translation phase of JSP page? (Choose one) A. Instantiation of the servlet class. B. Creation of the servlet class corresponding to the JSP file. C. None of the others D. Execution of JspServiceQ method.

b

Which option can be used to predefine Java Persistence queries for easy use? A. @NamedNativeQuery annotation B. @NamedQuery annotation C. using the named-native-query element in the XML descriptor

b

Which security mechanism proves that data has not been tampered with during its transit through the network? A. Packet sniffing B. Data integrity C. Data validation D. Authentication E. Data privacy F. Authorization

b

Which statements are BEST describe class attribute of <jsp:useBean class=_.. /> Action? A. The name of a bean that can be used with method instantiate of class java.beans.Beans to load a JavaBean into memory. B. The fully qualified class name of the Java object C. The name used to manipulate the Java object with actions <jsp:setProperty> and <jsp:getProperty>. A variable of this name is also declared for use in JSP scripting elements. The name specified here is ca D. The type of the JavaBean. This can be the same type as the class attribute, a superclass of that type or an interface implemented by that type. The default value is the same as for attribute class.

b

A JSP_____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). A. expression B. scriptlet c. declaration

c

Consider the HTML code below. Which of the following method calls can retrieve the "email" value sent from the browser? (Choose one) A. getFormValue("email") of HttpServletRequest B. getField(email") of HttpServletRequest C. getParameter("email") ofServletRequest D. getParameters("email") of HttpServlet

c

Which are the correct lines of code to get information in the following<context-param> tag in the web.xml fi Assume that response and request refer to HttpServletResponse and HttpServletRequest respectively. A. response.getParameter('machineName'); B. requestgetParameter( machineName'); C. ServletContextsc = getServletContextO; String serverName = sc.getlnitParameter("machineName"); D. ServletConfigsc = getServletConfigO; String serverName = sc.getlnitParameterfmachineName"); -------------------------- <web-app> <concexc-param> <parair - narr.e >mach i neN ame < / p a r air - name > <parair.-value>cms-server</parair.-value> </context-parair.> </web-app>|

c

Which of the following is a sensible way of sending an error page to the client in case of a business exception that extends from java.lang.Exception? (Choose one) A. Don't do anything, the servlet container will automatically send a default error page. B. Don't catch the exception and define the 'exception to error-page' mapping in web.xml C. Catch the exception, wrap it into ServletException and define the 'business exception to error-page' mapping in web.xml

c

Which statements are BEST describe uri attribute of <%@ taglib uri=_%>directive of JSP file? A. The scripting language used in the JSP. Currently, the only valid value for this attribute is java. B. 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 JSP. C. Specifies the relative or absolute URI of the tag library descriptor. D. Specifies the required prefix that distinguishes custom tags from built-in tags. The prefix names jsp. jspx. java, javax. servlet sun and sunw are reserved.

c

Which technology is used for processing HTTP requests and mapping those requests to business objects A. EJB B. JMS C. Servlets D. MOM (Message-Oriented Middleware Product)

c

You have to send a pdf file to the client as a response to a request Which of the following calls will you have to make? (Choose one) A. response.setType("application/pdf"); B. response.setContentType("image/pdf"); C. response.setContentType("application/pdf"); D. response.setType("image/pdf);

c

(Choose 1 answer) Which of the statements regarding the following code are correct? public void doPost(HttpServletRequest req. HttpServletResponse res) throws lOException. ServletException { res.getWriterOprint("Hello"); RequestDispatcher rd = getServletContext().getRequestDispatcher(7testjsp"); rd.include(req. res); res.getWriter().print("World"): } A. Only "World" will be a part of the output B. Neither will be a part of the output C. Only "Hello" will be a part of the output D. "Hello" and "World" both will be a part of the output

d

A JSP page has the following page directives: <%@page isErrorPage='false' %> <%@page errorPage='/jsp/myerror.jsp' %> Which of the following implicit object is NOT available to the jsp page? A. session B. response C. application D. exception

d

A Java developer needs to be able to send email, containing XML attachments, using SMTP. Which JEE (J2EE) technology provides this capability? A. Servlet B. JSP C. EJB D. JavaMail

d

Identify the method used to get an object available in a session. (Choose one) A. get of Session B. getValue of HttpSession C. getAttribute of Session D. getAttribute of HttpSession

d

Identify the parent element of <session-timeout> element in web.xml A. <session-configuration> B. <webapp> C. <session_config> D. <session-config>

d

Identify the technique that can be used to implement 'sessions' if the client browser does not support cookies.(Choose one) A. It cannot be done without cookie support B. Using Http headers. C. URL Writing D. Hidden form fields.

d

Name the default value of the scope attribute of <jsp:useBean> A. request B. application C. session D. page

d

Study the statements: 1) The special directory/WEB-INF/lib contains Java class files—servlets and supporting code. 2) The special directory /WEB-INF/classes contains JAR files with supporting libraries of code. A. Only statement 1 is true B. Only statement 2 is true C. Both 1 and 2 are true D. Both 1 and 2 are not true

d

Which is NOT a core component of JSP? A. actions B. name of a jsp file C. tag libraries D. scriptlets E. directives

d

Which is NOT a correct statement about entity beans? A. They are used to share data among clients B. They are used to store persistent data C. They are used to represent data stored in a RDBMS D. They are used to implement business processes

d

Which of the following are correct JSP expressions? A. <%= outprintln("hello"); %> B. <% "Hello World"; %> C. <%= "Hello World"; %> D. <%= new Date() %>

d

Which of the following statements is correct? Select the one correct answer. A. The response from the server to a GET request does not contain a document B. The setStatus method defined in the HttpServletRequest class takes an int as an argument and sets the status of Http response C. The response from the server to a HEAD request consists of status line, content type and the document D. The HttpServletResponse defines constants like SC_NOT_FOUND that may be used as a parameter to setStatus method.

d

Your web application named "FWorks" uses SpecialMath.class. This is an unbundled class and is not contained in any jar file. Where will you keep this class file? A. FWorks/classes B. FWorks/WEB-INF/lib/classes C. FWorks/WEB-INF D. FWorks/WEB-INF/classes

d

______includes a static file in a JSP file, parsing the file's JSP elements A. <jsp:forward> B. <jsp:useBean> C. import directive D. include directive E. <jsp:include>

d

Which jsp tag can be used to set bean property? A. jsp:property B. jsp:useBean.setProperty C. jsp:useBean D. jsp:useBean.property E. jsp:setProperty

e


Set pelajaran terkait

Hunter Ed. Review Questions Chapter 8

View Set

FI-094 Individual Activity 1: The Income Statement Scramble

View Set

Form A Workplace Communica!on with Computers

View Set

LUOA World History Unit 8 Test Review

View Set

Unit 3: States and Changes of Matter - Chemistry Honors

View Set