JSP,Servlet and Design patterns

Which method in the HttpServlet class services the HTTP POST request? (Select one)
DoPost(ServletRequest, ServletResponse)
DoPOST(ServletRequest, ServletResponse)
DoPost(HttpServletRequest, HttpServletResponse)
ServicePost(HttpServletRequest, HttpServletResponse)
Which design pattern allows you to decouple the business logic, data representation, and data presentation? (Select one)
Value Object
Model-View-Controller
Bimodal Data Access
Business Delegate
What will be the output of the following code? (Select one) <% x="3;"> <% int="" x="5;"> <%! int="" x="7;"> x = <%=x%>, <%=this.x%>
Compilation error
X = 3, 5
X = 3, 7
X = 5, 3
Your web application, named simpletax, depends on a third-party JAR file named taxpackage.jar. Where would you keep this file?
Simpletax/WEB-INF/lib
Simpletax/WEB-INF/thirdparty
Simpletax/WEB-INF/jars
Simpletax/WEB-INF
What file is the deployment descriptor of a web application named BankApp stored in?
BankApp.xml
Server.xml
WebApp.xml
Web.xml
Which of the following lines would initialize the out variable for sending a Microsoft Word file to the browser?
OutputStream out = response.getOuputStream();
ServletOutputStream out = response.getServletOutputStream();
PrintWriter out = response.getServletOutput();
PrintWriter out = response.getOuputStream();
Which element is used to specify useful information about an initialization parameter of a servlet in the deployment descriptor?
Param-description
Info
Init-param-info
Description
Param-info
Consider the following doPost() method of a servlet: public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Inside doPost"); PrintWriter out = response.getWriter(); out.println("Hello, "); String name = getNameFromDBSomeHow(); if(name == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unable to get name."); } out.println(name); } Assuming that getNameFromDBSomeHow() returns null, which of the following statements regarding this code are correct?
It will throw an IllegalStateException while serving a request.
It will throw an InvalidStateException while serving a request.
It will throw a ServletException while serving a request.
It will not throw an exception.
Which of the following implicit objects is not available to a JSP page by default?
Session
Exception
Application
Config
Which of the following is a valid taglib directive?
<% taglib uri="/stats" prefix="stats" %>
<%! Taglib uri="/stats" prefix="stats" %>
<%@ taglib name="/stats" prefix="stats" %>
<%@ taglib uri="/stats" prefix="stats" %>
<%@ taglib name="/stats" value="stats" %>
Which of the options locate the bean equivalent to the following action? (Select three)
Request.getAttribute("address");
Request.getParameter("address");
GetServletContext().getRequestAttribute("address");
PageContext.getAttribute("address",PageContext.REQUEST_SCOPE);
PageContext.getRequest().getAttribute("address");
PageContext.getRequestAttribute("address");
PageContext.getRequestParameter("address");
What are the benefits of using the Data Access Object pattern? (Select two)
The type of the actual data source can be specified at deployment time.
The data clients are independent of the data source vendor API.
It increases the performance of data-accessing routines.
It allows the clients to access the data source through EJBs.
It allows resource locking in an efficient way.
Which of the following methods would you use to retrieve header values from a request? (Select two)
GetHeader() of ServletRequest
GetHeaders() of HttpServletRequest
GetHeader() of HttpServletRequest
GetHeaders() of ServletRequest
GetHeaders() of HttpServletRequest
Which of the following are the benefits of using the Value Object design pattern? (Select two)
It improves the response time for data access.
It improves the efficiency of object operations.
It reduces the network traffic.
It reduces the coupling between the data access module and the database.
Which of the following correctly declares that the current page is an error page and also enables it to take part in a session?
<%@ page pageType="errorPage" session="required" %>
<%@ page isErrorPage="true" session="mandatory" %>
<%@ page isErrorPage="true" session="true" %>
None of the above.
{"name":"JSP,Servlet and Design patterns", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Which method in the HttpServlet class services the HTTP POST request? (Select one), Which design pattern allows you to decouple the business logic, data representation, and data presentation? (Select one), What will be the output of the following code? (Select one) x = ,","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker