Following quiz provides Multiple Choice Questions (MCQs) related to JSP Fundamentals. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - What is the correct signature of jspInit() method of HttpJspPage class?
Correct Signature is void jspInit()
jsp is a server side technology.
Q 3 - Which of the following are the valid scopes in JSP?
The scope attribute identifies the lifecycle of the Action element. It has four possible values: (a) page, (b) request, (c) session, and (d) application.
scriptlet is not a jsp directive.
Q 5 - application is instance of which class?
The application object is direct wrapper around the ServletContext object for the generated Servlet and in reality an instance of a javax.servlet.ServletContext object.
Q 6 - What happens when buffer is set to a value "none"?
When buffer is set to "none", servlet output is immediately directed to the response output object.
Q 7 - What will happen if isScriptingEnabled attribute is set as false?
A translation-time error will be raised if the JSP uses any scriptlets, expressions (non-EL), or declarations.
Q 8 - 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 9 - 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 10 - 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.