P1

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

You do not want the user to see the data and the format being passed to your server when the user tries to submit the information for registering with your site. Which HTTP method would you use? a.GET b.POST c.PUT d. HIDDEN e. HEAD

B

Each page has its own instances of the page-scope implicit objects. a.True b.False

a

HTTP is a "stateless" protocol: each time a client retrieves a Web page, it opens a separate connection to the Web server, and the server does not automatically maintain contextual information about a client. a.True b.False

a

How to read parameter id in query string? /WebApp/TestServlet?id=1 a.Inside doGet method: request.getParameter("id"); b.Inside doPost method: request.getParameter("id"); c.Inside doGet method: request.getAttribute("id"); d.Inside doPost method: param.getAttribute ("id");

a

How to write for loop by using JSTL a.<c:forEach items="${items}" var="item"> b.<c:forEach begin="0" end="10" varStatus="loop"> c.<c:for begin="0" end="10" varStatus="loop"> d.<c:for items="${items}" var="item">

a

HttpSessions expire only when the browsing session ends or when the invalidate method is called. a.True b.False

a

If in test.jsp \${3+2-1} : ${3+2-1} What is the output? a.\${3+2-1} : 4 b. \$4 : 4 c.4 : 4 d. \4 : 4

a

Regarding URL rewriting for session support, which of the following is true? a.Every URL that the client uses must include jsessionid. b. Only the first request that the client makes must include jsessionid. c. All the URLs should include IP address in the URL. d. Both IP and machine name should be included in all the URLs.

a

Servlet Container calls the init method on a servlet instance ____ a.Only once in the life time of the servlet instance. b.For each request to the servlet. c.If the request is from the user whose session has expired. d.For each request to the servlet that causes a new thread to be created.

a

Standard Java EE web applications are deployed as: a.WAR files b.JAR files c.DLL files d.CLASS files

a

The JDBC API provides the abstraction and the JDBC drivers provide the implementation. a.true b.false

a

The web.xml file for a webapp contains the following XML fragment for configuring session timeout. <session-config> <session-timeout>300</session-timeout> </session-config> What would be the session timeout interval for the sessions created in this web application? a.300 minutes b.300 seconds c.300 milli seconds d.300 hours

a

To deactivate the evaluation of EL expressions: a.<%@ page isELIgnored ="true" %> b.<%@ page isELDisabled ="true" %> c.<%@ page isELCanceled ="true" %> d.<%@ page isELActivated ="false" %>

a

What is the correct URI of the Core Tag Library? a.http://java.sun.com/jsp/jstl/core b.http://java.sun.com/jsp/jstl/xml c.http://java.sun.com/jsp/jstl/fmt d.http://java.sun.com/jsp/jstl/sql e.http://java.sun.com/jsp/jstl/functions

a

What is the result of attempting to access the following JSP page? <html> <body> <%! public String methodA() { return methodB(); } %> <%! public String methodB() { return "JAD Final Test"; } %> <h2><%= methodA() %></h2> </body> </html> a. "JAD Final Test" is output to the resulting web page. b. A translation error occurs. c. A runtime error occurs. d. The web page is blank.

a

What will happen when a servlet makes the following call within its doGet() method? getServletContext().setAttribute("userid", userid); a.The userid attribute is placed in application scope. b.The code in complied error c.A SessionContextListener will be invoked. d.Nothing happend

a

When a Web server responds to a request from a browser or other Web client, the response typically consists of: (Choose one) a.a status line, some response headers, a blank line, and the document. b. a status line, a blank line, and the document. c. a blank line, a status line, some response headers and the document. d. a status line, some response headers, and the document.

a

Which interface and method should be used to retrieve a servlet initialization parameter value? (Choose one) a.ServletConfig : getInitParameter(String name) b.ServletConfig : getParameter(String name) c.ServletContext : getInitParameter(String name)) d.ServletConfig : getInitParameterNames(String name)

a

Which of the following element of web.xml defines a mapping between a servlet and a URL pattern? (Choose one) a. servlet-mapping b. mapping c. url_mapping d.servlet-url e. url_pattern

a

Which of the following holds data retrieved from a database after you execute an SQL query using Statement objects? a.ResultSet b.JDBC driver c.Connection d.Statement

a

Which of the following is a valid standard action that can be used by a jsp page to import content generated by another JSP file named another.jsp? a.<jsp:include page='another.jsp'/> b.<jsp:import page='another.jsp'/> c.<jsp:include file='another.jsp'/> d.<jsp:import file='another.jsp'/>

a

Which of the following is correct about dispatcher result type? a.It is used to forward to a servlet, JSP, HTML page, and so on, on the server. It uses the RequestDispatcher.forward() method. b.It is used to generate output using predefined templates. c.None of the others. d. It calls the standard response.sendRedirect() method, causing the browser to create a new request to the given location.

a

You have to send a gif image to the client as a response to a request. Which of the following calls will you have to make? (Choose one) a.response.setContentType("image/gif"); b.response.setType("application/gif"); c.response.setContentType("application/bin"); d.response.setType("image/gif");

a

Your jsp page uses classes from java.util package. Which of the following statement would allow you to import the package? (Choose one) a. <%@ page import="java.util.*"%> b. <%@import java.util.* %> c. <%import="java.util.*"@%> d. <%@ page import="java.util.*"@%> e. <%! page import="java.util.*"%>

a

Your jsp page uses java.util.TreeMap. Adding which of the following statement will ensure that this class is available to the page? (Choose one) a. <%@ page import="java.util.TreeMap"%> b. <%! page import="java.util.TreeMap"%> c. <%! import="java.util.TreeMap"%> d. <%@ import="java.util.TreeMap"%>

a

Your servlet may receive a request, which the servlet cannot handle. In such cases, you want to redirect the request to another resource which may or may not be a part of the same web application. Which of the following options can be used to achieve this objective? a.response.sendRedirect("some url"); b.RequestDispatcherrd = this.getServletContext().getRequestDispatcher("some url"); rd.forward(request, response); c.RequestDispatcherrd = request.getRequestDispatcher("some url"); rd.forward(request, response); d.request.sendRedirect("some url");

a

How to access a parameter named student by using the expression language? a.${param. student } b.${param["student "]} c.${ student } d.$[" student"]

b

How to get alue of the param named accountID in query string by using EL? a.${param.accountID} b.${request.accountID} c.${session.accountID} d.${page.accountID}

b

In MVC 2 architecture, which component receives all the request for the application and is responsible for taking appropriate action in response to each request. a.View b.Controller c.Model d.No answer is correct

b

Servlets usually are used on the client side of a networking application. a.True b.False

b

The method getWriter returns an object of type PrintWriter. This class has println methods to generate output. Which of these classes define the getWriter method? Select one correct answer. a. HttpServletRequest b. HttpServletResponse c. ServletConfig d. ServletContext

b

What JDBC stands for? a.Java Driver for Basic Connection b.Java Database Connectivity c.Joint Database Connectivity d.Joint Driver for Basic Connection

b

What kind of activities should NOT be done by a filter: a.Authentication b.Encryption c.Logging and Auditing d.CRUD actions for an Entity

b

Which of the following defines the class name of a tag in a TLD? a.tag-class-name b.tag-class c.class-name d.class

b

Which of the following executes the any kind of SQL statement? a.boolean execute() b.ResultSet executeQuery() c.int executeUpdate() d.None of the above.

b

Which of the following statements is true? (Choose one) a.Session data is shared across multiple webapps in the same webserver/servlet container. b.Any serializable object can be put into a session. c.A session can only be invalidated after "session-timeout" minutes of inactivity. d.To use session, the client browser must support cookies.

b

Which technique is likely to return an initialization parameter for a JSP page? a.<%= request.getParameter("myParm") %> b.<% String s = getInitParameter("myParm"); %> c.<% = application.getInitParameter("myParm") %> d.<%= getParameter("myParm") %> e.<% String s = getAttribute("myParm"); %>

b

Servlet Filters are Java classes that can be used in Servlet Programming for the following purposes: a.To intercept requests from a client before they access a resource at back end. b.To manipulate responses from server before they are sent back to the client. c.Both A and B are correct. d.None of A or B is correct.

c

What will be the result of pressing the submit button in the following HTML form? <form action="/servlet/Register"> <input type="text" name="fullName" value="Type name here" /> <input type="submit" name="sbmButton" value="OK" /> </form> a.A request is sent with the HTTP method HEAD. b. A request is sent with the HTTP method POST. c.A request is sent with the HTTP method GET. d. The parameter fullName is the only parameter passed to the web server in the request URL. e. The parameter fullName is the only parameter passed to the web server as part of the request body.

c

Which of the following step establishes a connection with a database? a.Import packages containing the JDBC classes needed for database programming. b.Register the JDBC driver, so that you can open a communications channel with the database. c.Open a connection using the DriverManager.getConnection () method. d.Execute a query using an object of type Statement.

c

How to create your own user custom Filter? a.Extends Filter b.Implements Filter c.Extends ServletFilter d.Implements ServletFilter

d

What are servlet filter method: a.public void doFilter (ServletRequest, ServletResponse, FilterChain) b.public void init(FilterConfig filterConfig) c.public void destroy() d.All of answers are correct

d

What are some problems of Java web application using MVC1 architecture? a.In Model 1 architecture, the presentation logic usually leads to a significant amount of Java code embedded in the JSP in the form of scriptlets. b.There is some separation between content (Model JavaBeans) and presentation (JSP) c.Application control is decentralized in Model 1 architecture since the next page to be displayed is determined by the logic embedded in the current page d.All of the answers are correct

d

Which of the following feature is present in Struts 2? a.POJO forms and POJO actions b.Tag support c.AJAX support d.All of the others.

d

Which of the following statement is true about servlet filter ? a.A filter is a reusable piece of code that can transform the content of HTTP requests, responses, and header information. b.Filters do not generally create a response or respond to a request as servlets do. c.Filters can act on dynamic or static content. d.All of the above

d

Which of these is legal return type of the doStartTag 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

d

The EL provides a way to use simple expressions to perform the following tasks: a. Dynamically read application data stored in JavaBeans components, various data structures, and implicit objects b. Dynamically write data, such as user input into forms, to JavaBeans components c. Invoke arbitrary static and public methods d. Dynamically perform arithmetic operations e. All answers are correct.

e

What are the components of Java Web Application? a.Servlets b.Jsps c.Filters d.listeners e.All of others

e


संबंधित स्टडी सेट्स

Intro to Business Chapter 14 Review

View Set

Texas Law of Contracts: Ch. 3 Quiz

View Set

Spanish 2 - Lección 6 - Estructura 6.2

View Set

Chapter 13: Psychosocial Health & Illness

View Set

Types of Life Policies (Section II)

View Set

Dual Credit History - Chapter 5 REVIEW QUIZ

View Set

Global 9: Chapter 5: Ancient Greece

View Set

bld 3: midterm 1 quiz based quizlet

View Set