This section presents you various set of Mock Tests related to JSP Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - Which of the following is true about Cleanup phase in JSP life cycle?
The destruction phase of the JSP life cycle represents when a JSP is being removed from use by a container.The jspDestroy() method is the JSP equivalent of the destroy method for servlets.
Q 2 - Which of the following is true about <jsp:useBean> action?
useBean action first searches for an existing object utilizing the id and scope variables. If an object is not found, it then tries to create the specified object. useBean is used to load java beans in jsp page.
Q 3 - Which of the following is true about <jsp:setProperty> action?
The setProperty action sets the properties of a Bean. The Bean must have been previously defined before this action.
Q 4 - Which of the following is true about <jsp:getProperty> action?
The getProperty action is used to retrieve the value of a given property and converts it to a string, and finally inserts it into the output.
Q 5 - Which of the following is true about <jsp:forward> action?
The forward action terminates the action of the current page and forwards the request to another resource such as a static page, another JSP page, or a Java Servlet.
Q 6 - Which of the following is true about response.sendRedirect(url)?
sendRedirect sends HTTP temporary redirect response to the browser, and browser creates a new request to go the redirected page.
Q 7 - What JSTL stands for?
JSTL, JavaServer Pages Standard Tag Library is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
Q 8 - What is Internationalization?
Internationalization means enabling a web site to provide different versions of content translated into the visitor's language or nationality.
Q 9 - What is Localization?
Localization means adding resources to a web site to adapt it to a particular geographical or cultural region for example Hindi translation to a web site.
Q 10 - Which of the following is true about locale?
Locale is a particular cultural or geographical region. It is usually referred to as a language symbol followed by a country symbol which are separated by an underscore. For example "en_US" represents english locale for US.
Q 11 - What is difference between <%-- comment --%> and <!-- comment -->?
Yes. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.
Yes. However, unlike Servlet, you are not required to implement HTTP-protocol specific methods like doGet() or doPost() within your JSP page. You can obtain the data for the FORM input elements via the request implicit object within a scriptlet or expression.
No. You are supposed to make use of only a JSPWriter object (given to you in the form of the implicit object out) for replying to clients.
Q 15 - How to pass information from JSP to included JSP?
Using <%jsp:param> tag you can pass information from JSP to included JSP.
Q 16 - What is the use of <c:set > tag?
The <c:set > tag is JSTL-friendly version of the setProperty action. The tag is helpful because it evaluates an expression and uses the results to set a value of a JavaBean or a java.util.Map object.
Q 17 - What is the use of <c:remove > tag?
The <c:remove > tag removes a variable from either a specified scope or the first scope where the variable is found (if no scope is specified).
Q 18 - What is the use of <c:catch> tag?
The <c:catch> tag catches any Throwable that occurs in its body and optionally exposes it. Simply it is used for error handling and to deal more gracefully with the problem.
Q 19 - What is the use of <c:if> tag?
The <c:if> tag evaluates an expression and displays its body content only if the expression evaluates to true.
Q 20 - Which of the following is true about <c:choose> tag?
The <c:choose> works like a Java switch statement in that it lets you choose between a number of alternatives. Where the switch statement has case statements, the <c:choose> tag has <c:when> tags. A a switch statement has default clause to specify a default action and similar way <c:choose> has <otherwise> as default clause.
Q 21 - Which of the following is true about <c:forEach > tag?
The <c:forEach > tag exists as a good alternative to embedding a Java for, while, or do-while loop via a scriptlet.
Q 22 - Which of the following is true about <c:param> tag?
The <c:param> tag allows proper URL request parameter to be specified with URL and it does any necessary URL encoding required.
Q 23 - Which of the following is true about <c:redirect> tag?
The <c:redirect > tag redirects the browser to an alternate URL by providing automatically URL rewriting, it supports context-relative URLs, and it supports the <c:param> tag.
Q 24 - Which of the following is true about <c:url> tag
The <c:url> tag formats a URL into a string and stores it into a variable. This tag automatically performs URL rewriting when necessary.
Q 25 - What's the difference between JavaBeans and taglib directives?
JavaBeans and taglib fundamentals were introduced for reusability. But following are the major differences between them −
Taglibs are for generating presentation elements while JavaBeans are good for storing information and state.
Use custom tags to implement actions and JavaBeans to present information.
|Question Number||Answer Key|